Can't get latex to render on Anki Desktop

So I’ve installed miktex and have written up some anki cards to make use of latex, but I keep getting errors.

Some errors I’ve been able to troubleshoot and figure out on my own, but while I’ve whittled down the errors to 1, I’m still not finding a way to progress past this with all my googling. If someone with more knowledge on this could help make sense of my error, it would be much appreciated!

Error executing <U+2068>latex<U+2069>.
Generated file: <U+2068>C:\Users\MyName\AppData\Local\Temp\anki_temp\tmp.tex<U+2069>

This is pdfTeX, Version 3.141592653-2.6-1.40.25 (MiKTeX 23.12) (preloaded format=latex.fmt)
 restricted \write18 enabled.
entering extended mode
(tmp.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-01-04>
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/base\article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/base\size12.clo))
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/base\inputenc.sty)
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsfonts\amssymb.sty
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsfonts\amsfonts.sty))
 (C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsmath\amsmath.sty
For additional information on amsmath, use the `?' option.
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsmath\amstext.sty
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsmath\amsgen.sty))
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsmath\amsbsy.sty)
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsmath\amsopn.sty))
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/l3backend\l3backend-dvi
ps.def)
No file tmp.aux.
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsfonts\umsa.fd)
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsfonts\umsb.fd)
! Extra }, or forgotten $.
l.9 ...[ \log_{b}\left( u \right) \right] = [...]}
                                                  $
[1] (tmp.aux) )
(see the transcript file for additional information)
Output written on tmp.dvi (1 page, 460 bytes).
Transcript written on tmp.log.

And here is the tmp.log file that the above directs you to:

This is pdfTeX, Version 3.141592653-2.6-1.40.25 (MiKTeX 23.12) (preloaded format=latex 2024.1.25)  25 JAN 2024 22:01
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**./tmp.tex
(tmp.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-01-04>
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/base\article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/base\size12.clo
File: size12.clo 2023/05/17 v1.4n Standard LaTeX file (size option)
)
\c@part=\count187
\c@section=\count188
\c@subsection=\count189
\c@subsubsection=\count190
\c@paragraph=\count191
\c@subparagraph=\count192
\c@figure=\count193
\c@table=\count194
\abovecaptionskip=\skip48
\belowcaptionskip=\skip49
\bibindent=\dimen140
)
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/base\inputenc.sty
Package: inputenc 2021/02/14 v1.3d Input encoding file
\inpenc@prehook=\toks17
\inpenc@posthook=\toks18
)
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsfonts\amssymb.sty
Package: amssymb 2013/01/14 v3.01 AMS font symbols

(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsfonts\amsfonts.sty
Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support
\@emptytoks=\toks19
\symAMSa=\mathgroup4
\symAMSb=\mathgroup5
LaTeX Font Info:    Redeclaring math symbol \hbar on input line 98.
LaTeX Font Info:    Overwriting math alphabet `\mathfrak' in version `bold'
(Font)                  U/euf/m/n --> U/euf/b/n on input line 106.
)) (C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsmath\amsmath.sty
Package: amsmath 2023/05/13 v2.17o AMS math features
\@mathmargin=\skip50

For additional information on amsmath, use the `?' option.
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsmath\amstext.sty
Package: amstext 2021/08/26 v2.01 AMS text

(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsmath\amsgen.sty
File: amsgen.sty 1999/11/30 v2.0 generic functions
\@emptytoks=\toks20
\ex@=\dimen141
))
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsmath\amsbsy.sty
Package: amsbsy 1999/11/29 v1.2d Bold Symbols
\pmbraise@=\dimen142
)
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsmath\amsopn.sty
Package: amsopn 2022/04/08 v2.04 operator names
)
\inf@bad=\count195
LaTeX Info: Redefining \frac on input line 234.
\uproot@=\count196
\leftroot@=\count197
LaTeX Info: Redefining \overline on input line 399.
LaTeX Info: Redefining \colon on input line 410.
\classnum@=\count198
\DOTSCASE@=\count199
LaTeX Info: Redefining \ldots on input line 496.
LaTeX Info: Redefining \dots on input line 499.
LaTeX Info: Redefining \cdots on input line 620.
\Mathstrutbox@=\box51
\strutbox@=\box52
LaTeX Info: Redefining \big on input line 722.
LaTeX Info: Redefining \Big on input line 723.
LaTeX Info: Redefining \bigg on input line 724.
LaTeX Info: Redefining \Bigg on input line 725.
\big@size=\dimen143
LaTeX Font Info:    Redeclaring font encoding OML on input line 743.
LaTeX Font Info:    Redeclaring font encoding OMS on input line 744.
\macc@depth=\count266
LaTeX Info: Redefining \bmod on input line 905.
LaTeX Info: Redefining \pmod on input line 910.
LaTeX Info: Redefining \smash on input line 940.
LaTeX Info: Redefining \relbar on input line 970.
LaTeX Info: Redefining \Relbar on input line 971.
\c@MaxMatrixCols=\count267
\dotsspace@=\muskip16
\c@parentequation=\count268
\dspbrk@lvl=\count269
\tag@help=\toks21
\row@=\count270
\column@=\count271
\maxfields@=\count272
\andhelp@=\toks22
\eqnshift@=\dimen144
\alignsep@=\dimen145
\tagshift@=\dimen146
\tagwidth@=\dimen147
\totwidth@=\dimen148
\lineht@=\dimen149
\@envbody=\toks23
\multlinegap=\skip51
\multlinetaggap=\skip52
\mathdisplay@stack=\toks24
LaTeX Info: Redefining \[ on input line 2953.
LaTeX Info: Redefining \] on input line 2954.
)
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/l3backend\l3backend-dvi
ps.def
File: l3backend-dvips.def 2024-01-04 L3 backend support: dvips
\l__pdf_internal_box=\box53
\g__pdf_backend_object_int=\count273
\l__pdf_backend_content_box=\box54
\l__pdf_backend_model_box=\box55
\g__pdf_backend_annotation_int=\count274
\g__pdf_backend_link_int=\count275
\g__pdf_backend_link_sf_int=\count276
)
No file tmp.aux.
\openout1 = `tmp.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 7.
LaTeX Font Info:    ... okay on input line 7.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 7.
LaTeX Font Info:    ... okay on input line 7.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 7.
LaTeX Font Info:    ... okay on input line 7.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 7.
LaTeX Font Info:    ... okay on input line 7.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 7.
LaTeX Font Info:    ... okay on input line 7.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 7.
LaTeX Font Info:    ... okay on input line 7.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 7.
LaTeX Font Info:    ... okay on input line 7.
LaTeX Font Info:    Trying to load font information for U+msa on input line 9.
(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsfonts\umsa.fd
File: umsa.fd 2013/01/14 v3.01 AMS symbols A
)
LaTeX Font Info:    Trying to load font information for U+msb on input line 9.

(C:\Users\MyName\AppData\Local\Programs\MiKTeX\tex/latex/amsfonts\umsb.fd
File: umsb.fd 2013/01/14 v3.01 AMS symbols B
)
! Extra }, or forgotten $.
l.9 ...[ \log_{b}\left( u \right) \right] = [...]}
                                                  $
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

[1

] (tmp.aux)
 ***********
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-01-04>
 ***********
 ) 
Here is how much of TeX's memory you used:
 1711 strings out of 474486
 24675 string characters out of 5743760
 1925539 words of memory out of 5000000
 24036 multiletter control sequences out of 15000+600000
 562714 words of font info for 54 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 56i,5n,65p,218b,104s stack positions out of 10000i,1000n,20000p,200000b,200000s

Output written on tmp.dvi (1 page, 460 bytes).

What’s the latex code? maybe you have an error there. As always, I recommend using MathJax if it works for your needs, as it works out of the box and doesn’t need any setup.

https://docs.ankiweb.net/math.html

1 Like

There’s a bunch, but they all follow the following general format:

Constant Multiple Rule:
[$]\frac{d}{dx} \left[ cu \right] = {{c1::cu’}}[/$]

The card type is cloze (technically cloze 1, but I don’t see any other cloze options), and the desired output would be something like this:

Screenshot 2024-01-28 121252

Only the answer would be hidden, hence the cloze formatting.

Update: I’ve sort of figured out a work around/possibly what’s the cause here.

So I’ve noticed that if I choose to format my question using “LaTex math env.” instead of “LaTex equation” (from the fx menu in anki desktop) that I’m able to get some of the LaTex equations to run, but some others don’t run.

Cards that run:

  1. [$$]\frac{d}{dx} \left[ cu \right] = {{c1::cu’}}[/$$]
  2. [$$]\frac{d}{dx} \left[ uv \right] = {{c1::uv’ + vu’}}[/$$]
  3. [$$]\frac{d}{dx} \left[ c \right] = {{c1::0}}[/$$]
  4. [$$]\frac{d}{dx} \left[ \sin\left( u \right) \right] = {{c1::\left( \cos\left( u \right) \right)u’}}[/$$]
  5. [$$]\frac{d}{dx} \left[ \tan\left( u \right) \right] = {{c1::\left( \sec^{2}\left( u \right) \right)u’}}[/$$]
  6. [$$]\frac{d}{dx} \left[ \sec\left( u \right) \right] = {{c1::\left( \sec\left( u \right)\tan\left( u \right) \right)u’}}[/$$]

Cards that don’t run:

  1. [$$]\frac{d}{dx} \left[ \log_{b}\left( u \right) \right] = {{c1::\frac{u’}{u} . \frac{1}{\ln\left( b \right)}}}[/$$]
  2. [$$]\frac{d}{dx} \left[ \log_{b}\left( x \right) \right] = {{c1::\frac{1}{x} . \frac{1}{\ln\left( b \right)}}}[/$$]
  3. [$$]\frac{d}{dx} \left[ \arcsin\left( u \right) \right] = {{c1::\frac{u’}{\sqrt{1-u^{2}}}}}[/$$]
  4. [$$]\frac{d}{dx} \left[ \arctan\left( u \right) \right] = {{c1::\frac{u’}{1+u^{2}}}}[/$$]
  5. [$$]\frac{d}{dx} \left[ ln\left( u \right) \right] = {{c1::\frac{u’}{u}}}[/$$]

So the question is, why do some of these run and some of these not run? I think the issue is related to the cloze formatting and the fraction LaTex formatting conflicting with each other in some way where the anki program doesn’t know how to interpret the information.

For example, if I take card # 3 from the cards that don’t run list, and I instead write it as a basic card, as follows:

Front: [$$]\frac{d}{dx} \left[ \arcsin\left( u \right) \right] = ?[/$$]
Back: [$$]\frac{u’}{\sqrt{1-u^{2}}}[/$$]

Or even (just to test), if I make a card as follows:

Front: [$$]\frac{d}{dx} \left[ \arcsin\left( u \right) \right] = [$$]\frac{u’}{\sqrt{1-u^{2}}}[/$$]
Back: [$$]\frac{u’}{1+u^{2}}}}[/$$]

Both of those cards run just fine with the cloze formatting removed. The only annoyance I have is that I’d like to be able to format my problems in cloze formatting to keep everything visually consistent. Is there any workaround anyone knows for this?

https://docs.ankiweb.net/math.html#cloze-conflicts

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