2

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:

enter image description here

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.

  • 2
    Please tell us more about your computing setup in general and about how anki is installed and being used. – Mico Apr 23 '17 at 11:14
2

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),

enter image description here

  • 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. – Idios 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. – StefanH 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. – Idios Apr 23 '17 at 12:55
  • 1
    I thought that pdftex automatically detects if it's a tex or latex code. Are you sure that your explanation is correct? – Dr. Manuel Kuehner Apr 23 '17 at 13:24
  • 1
    @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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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