taylormitchell / ankify_roam

A command-line tool which brings flashcards created in Roam to Anki.
MIT License
36 stars 6 forks source link

Extremely weird bug parsing latex #44

Open Etyre opened 2 years ago

Etyre commented 2 years ago

So first, of all, I realized that there is already a way to get latex that imports to anki.

I can just write the latex that I want in roam, and bracket it with the symbols that anki (not roam) uses to parse latex.

Screen Shot 2022-02-09 at 9 21 32 PM

When I'm not editing, this shows up in roam like this:

Screen Shot 2022-02-09 at 9 26 52 PM

Which is pretty good! This gives me just what I need.

This also works in anki, modulo one weird bug. Square root signs (and from what I've seen, only square root signs) add an extra "1" at the front of the number under the square root.

Screen Shot 2022-02-03 at 2 10 26 PM

I don't know why that would be!

Etyre commented 2 years ago

Whoops. That last image should be:

Screen Shot 2022-02-09 at 9 25 27 PM
Etyre commented 2 years ago

Tinkering a bit more, it isn't just the square root signs.

This...

Screen Shot 2022-02-10 at 10 36 02 AM

...becomes this...

Screen Shot 2022-02-10 at 10 36 47 AM

Maybe it is the last thing in a latex bracket?

Etyre commented 2 years ago

I'm gonna do some experiments and keep tinkering.

Etyre commented 2 years ago

Note that I found a workaround that solved this: https://github.com/taylormitchell/ankify_roam/issues/46#issuecomment-1086743449

taylormitchell commented 2 years ago

Tinkering a bit more, it isn't just the square root signs.

This...

Screen Shot 2022-02-10 at 10 36 02 AM

...becomes this...

Screen Shot 2022-02-10 at 10 36 47 AM

Maybe it is the last thing in a latex bracket?

I'm guessing ankify_roam was inferring that {3} is a cloze deletion and then assigning a 1 as a cloze id to get the 13. In the latest version, this shouldn't be a problem on basic cards, because cloze brackets aren't processed on basic cards anymore. Should be easy to fix properly by adding the $$ tokens to the parser. I'm not gonna prioritize this highly since you have a workaround but I'll see if I can sneak a fix into the next release

msf999 commented 1 year ago

Tinkering a bit more, it isn't just the square root signs. This...

Screen Shot 2022-02-10 at 10 36 02 AM

...becomes this...

Screen Shot 2022-02-10 at 10 36 47 AM

Maybe it is the last thing in a latex bracket?

I'm guessing ankify_roam was inferring that {3} is a cloze deletion and then assigning a 1 as a cloze id to get the 13. In the latest version, this shouldn't be a problem on basic cards, because cloze brackets aren't processed on basic cards anymore. Should be easy to fix properly by adding the $$ tokens to the parser. I'm not gonna prioritize this highly since you have a workaround but I'll see if I can sneak a fix into the next release

Any chance of getting this fixed? Trying to create basic cards where the front card contains latex ends up creating another cloze card as well. Thank you so much! :)