2anki / server

Server to create Anki flashcards faster, easier and better today ⭐️
https://2anki.net
Other
301 stars 33 forks source link

Extra cloze cards generated for specific inputs - possibly involving Latex #1411

Open cjappl opened 6 months ago

cjappl commented 6 months ago

Describe the bug There are a "more than expected" number of cards generated for cloze deletions. These cards all contain LaTex formatting in the cloze deletion. For instance, a card with 2 sections that are cloze sections may generate 4 cards. The last two cards if opened have an error in Anki.

To Reproduce

  1. In Notion, have cloze generations like the following, with Latex in place equations: "DFT: symbol $t_n$ denotes the time at sample $n$." (formatted correctly, using latex inside of cloze blocks)

    Screenshot 2024-02-09 at 11 50 32 AM
  2. Export using 2Anki

  3. Open cards in "browse"

Expected behavior 2 cloze cards generated, one for each code block

Observed behavior

Screenshot 2024-02-09 at 11 51 34 AM

4 cards are generated. If you attempt to open the 3rd or 4th card you get an error

Screenshot 2024-02-09 at 11 53 04 AM

Desktop (please complete the following information):

Additional context This does not seem to happen on ALL cloze of this type.

Screenshot 2024-02-09 at 11 54 59 AM

properly generates 3

Screenshot 2024-02-09 at 11 55 20 AM Screenshot 2024-02-09 at 11 55 51 AM

Improperly generates 3

Screenshot 2024-02-09 at 11 56 11 AM
cjappl commented 6 months ago

It does seem that having cloze deletions that are Latex in-line formulas does not behave well in many but not all cases.

Symptoms described above, but also there are situations where an unexpectedly many number of clozes are created (for instance in spaces around words, around formulas)

if an inline formula is "$f" for purposes of me writing it here, a statement, and quotes "" surround the intended cloze

Hello "$f" I am testing the cloze "deletion with $f latex symbols like $f"

You would expect the clozes to be $f deletion with $f latex symbols like $f

but many times there are a bunch, like: $f deletion ' ' (empty space) with ' $f' latex symbols ' ' (empty space) 'like ' $f