# Formatting fractions

I am using Anki (with LaTeX support), and have made a few fractions. However, the following doesn't work:

[$] \sin^2 \theta_m = \frac{{(n^{\omega }_o)}^{-2} - {(n^{2\omega }_o)}^{-2}} {{(n^{2\omega }_e)}^{-2}-{(n^{2\omega }_o)}^{-2}} [/$]


I can get the four bracketed quantities to appear, with both sub- and super- script characters. However, when I add the two sets of { and } brackets around the numerator and denominator, the output fails to display. The desired look is this:

The error log says: "This is pdfTeX, Version 3.14159265-2.6-1.40.16 (MiKTeX 2.9)"

Edit: Provided answer has working solution, with the condition that the pair of curly braces, {{, have a space between them to prevent Anki from interpreting the following text as a field - i.e.,

\sin^2 \theta_m = {{(n^{\omega}_o)^{-2} - (n^{2\omega}_o)^{-2}}\over{(n^{2\omega}_e)^{-2}-(n^{2\omega}_o)^{-2}}}


Note that the latter pair of curly closing braces, }}, doesn't need a space as Anki isn't looking for these if the first pair, { {, has a space between the braces.

– Mico
Apr 23 '17 at 11:14

This should probably be a comment but the expression was too big. It seems you have pdfTeX as compiler, but \frac is a LaTeX command and needs pdfLaTeX. You have two alternatives, either change compiler in the settings or change the command. For the first alternative I don't know how to set Anki, but you might get some help from https://askubuntu.com/a/671265. For the second you should use \over instead of \frac, something like this:

\sin^2 \theta_m = {(n^{\omega}_o)^{-2} - (n^{2\omega}_o)^{-2}\over(n^{2\omega}_e)^{-2}-(n^{2\omega}_o)^{-2}}


where I get (with pdftex),

• I get the same as you, but with "unknownfield" before the first term in the denominator. Any ideas? I think this is due to Anki interpreting a pair of identical curly braces as being Anki code, not LaTeX code. In this case, it's looking for a field. Apr 23 '17 at 12:41
• @Idios, You can remove one set of curly braces, if that is the problem. I have updated the code above. Apr 23 '17 at 12:50
• I see, thanks. Before, we had {numerator}\over{denominator}, and now we have {numerator \over denominator} - which works too. Apr 23 '17 at 12:55
• I thought that pdftex automatically detects if it's a tex or latex code. Are you sure that your explanation is correct? Apr 23 '17 at 13:24
• @Idios - {...\over...} is Plain-TeX syntax, while \frac{...}{...} is LaTeX syntax. See this posting for more information on this subject.
– Mico
Apr 23 '17 at 13:25