I'm using Anki and LaTeX to format my flash cards. This problem that I'm about to outline only occurs with the cloze card type.

I basically want to express a fraction with multiple exponents like such $\frac{a^{cd}}{b^{ef}}$ and I tested that this works with a basic flash card type.

However, as soon as I wrap this line in cloze deletion tags as such:


I get errors such as "! Missing } inserted.".

Note couple of things. When i remove {} surrounding the exponent as such $\frac{a^cd}{b^ef}$ it works, but obviously i get a wrong fraction. Additionally, it also works when the term is not within a fraction as such {{c1::$a^{abc}$}} (this works with cloze).

Editted: The whole post.

  • 2
    We'd need to replicate the behaviour. Can you trim down your current document into something we call a minimal working example? – Werner Nov 7 '19 at 19:14
  • I'm not seeing a difference between "when I attempt something like ... $\frac{1}{a^{n-m}}$" which gives you errors and "$\frac{1}{a^{n-m}}$ produces an incorrect fraction" but no errors. – Teepeemm Nov 7 '19 at 19:27
  • Teepeemm and @Werner I edited the post to show at which point exactly the error occurs. – Vocaloidas Nov 7 '19 at 19:30
  • 1
    @Vocaloidas: This seems like a mis-interpretation by Anki, thinking the double closing braces inside the \frac is also the closing braces for the "cloze card type", since your other examples seem to echo that. There are ways around it, but the problem seems to be Anki-related, not LaTeX-related. – Werner Nov 7 '19 at 19:35
  • I see, i guess I'll look elsewhere. – Vocaloidas Nov 7 '19 at 19:35

The issue is as @Werner described. In Anki cloze is delimited as {{c1::}} and in LaTeX fractions take the format of $\frac{}{}$. When you couple that with exponents as such $\frac{a^{}}{b^{}}$ and wrap it in cloze tags as such {{c1::$\frac{a^{}}{b^{}}$}}. Anki treats the first set of }} as indication that it's the end of the cloze expression. This ofcourse causes the ""! Missing } inserted." errors.

The solution to this is documented in https://apps.ankiweb.net/docs/manual.html#latex-conflicts (Thanks to a reddit user who pointed this out).

And simply involves putting a space inbetween the '}}' that are ought to be part of fraction's expression. This completely solves the problem.

|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.