MathJax "breaks" with .txt import

I have made a comparison card type where the fields are “Category”, “Greater” “Lesser”, “First Symbol” (> or =, because of some exceptional cases where both have same value) and “Second Symbol” (< or =). To make all the cards of these, I used a python program where it stores it in the required format in a .txt file. Now, for some of these cards, I have added the “Greater” and “Lesser” values in MathJax and when it is imported, it does not display properly while in studying the card. In the “Browse Cards” window, the text is displayed properly however.

I did find a way to fix this, but it is only possible if I manually change some text in the field. This is most definitely inconvenient to change for several hundred cards (I think the count is over 500). Does anybody have any idea as to why this is happening and what I can do to fix it?
The issue is slightly inconsistent however. It sometimes happens for both “Greater” and “Lesser” (about a fourth of the time), sometimes for only one of them (around two-thirds of the time) and sometimes for neither (not very common). It also occurs in the “Category” field when there is MathJax in it.

Below are some screenshots of what it looks like.

The first two cards work, the next two don’t.
for card 2 in the first screenshot
for card 3 in the first screenshot
In “Browse Cards” (no difference in either)
When studying the problematic card
When studying the card having no error

Are the MathJax lines written correctly in your import file?

2 Likes

I can’t tell you whether I used that or not while importing as I’m not certain and the text file is now overwrriten, but I believe that is the reason why. Thanks for telling me this. Now what do I do about the cards that are there right now? Will I have to sacrifice their reviews and do the import all over again?
Edit: I just had a look through my code, and indeed, I have used <anki-mathjax> to create the text in the field.

1 Like

Are these issues in the first field of the note? That first field and note type are how Anki (by default) identifies notes on text import to decide whether they need to be created/duplicated or updated. As long as the first field remains the same, another import will simply update the notes, and all of your review history will remain intact. Text Files - Anki Manual

Since you don’t have the original file anyway, it will probably be easiest to export these notes as text, so that you can edit them outside of Anki. If you do need to edit the first field, you can have Anki include the GUID/unique identifier in the export. Text Files - Anki Manual

1 Like

This issue is present mainly in the second field of the note (not the field sorted by), but it does occur in the first field.
The first field is common for several cards (unfortunately, also unavoidable) so I am slightly worried about the cards imported from txt being mapped to the wrong ones already present (while importing the second set, I already faced this issue and I had to recreate the first set and choose the option to duplicate cards) . I think the GUID/unique identifier thing should work, I’ll try this tomorrow and report back to you.
Thanks for such a quick response!

That GUID that is there in the text, what format is it in? It looks like a bunch of gibberish, but it is supposed to stand for a number right?

1 Like

It’s not a number. It’s a randomly generated string that acts as a unique identifier. Also see this:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.