# Anki and Latex not working

I've just instaled texlive-core in order to create LaTex based Anki cards however for some reason Anki isn't compiling the LaTex and I'm running into this error
Error executing latex.
Generated file: /tmp/anki_temp/tmp.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch Linux) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode

Any ideas as to what might be going on?

What is anki?

Please share what exactly you do and what exactly the output is. you could share the latex log file as well.

Can you compile a simple test.text file?

Which lexlive packages have you installed? Only texlive-core ?

1 Like

Did you try to compile it from your shell or like suggested above, compiled a test document? So please try from your terminal pdftex tmp.tex (in this anki folder) and lualatex tmp.tex to check if it's an error produced by pdfTeX.
In addition, which packages do you use? Maybe one of them caused the error.

@mbod @LeaRain
Anki is a flashcards app. So basically you can make cards that have Latex in them. I've only installed texlive-core.

I have just tried compiling a .tex file from the shell but I'm getting an error saying the following:
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch Linux) (preloaded format=pdftex)
restricted \write18 enabled.
entering extended mode

can you share the tex file please?

Hi. Maybe you can try to install texlive-most and see if the issue remains. Or you can try to figure out what particular texlive packages are needed for that anki cards.

I may have an idea. You try to compile your file with pdfTeX, right? So your compiler tries to interpret TeX. Your document is a LaTeX document, not a TeX document. I can reproduce your error with pdfTeX. Can you try to compile with pdflatex instead, please?
And I guess you have a little typo, it's lualatex (or LuaLaTeX). I asked you to compile with LuaLaTeX to check if it's just a problem of your pdf(La)TeX.

I've looked up anki documentation and found that using anki with LaTeX assumes some knowledge of LaTeX:

Anki’s LaTeX support is not turn-key: it is assumed that you know how to use LaTeX already, and that you have it installed. If you have no experience with LaTeX, please consult one of the many guides available on the internet. If you are having trouble with markup, please ask on a LaTeX forum.

So are you familiar with LaTeX? Have you used it before?

i can't find texlive-most under with pamac, only tex-live-most-doc

I have tried issuing the command pdflatex to my .tex file and the same error came up. Here's the contents of the latex document i'm trying to compile if it's of any use.

\begin{document}
First document. This is a simple example, with no
extra parameters or packages included.
\end{document}

and the error is

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Arch Linux) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./x.tex
LaTeX2e <2019-10-01> patch level 1
(./x.aux)

! LaTeX Error: The font size command \normalsize is not defined:
there is probably something wrong with the class file.

See the LaTeX manual or LaTeX Companion for explanation.
Type H for immediate help.
...

l.3 \begin{document}

?

Yes I'm quite familiar with LaTex and have also tried copying formulas from overleaf just to make sure that I haven't mistyped anything.

What's your documentclass? Maybe you can add an \documentclass{article} above your \begin{document}. If I try to compile without a class, I get your error too.

Sorry yeah I added \documentclass{article} and was able to rund pdflatex without a problem. So the problem seems to be coming fro Anki, is that right?

I guess so, your LaTeX seems to work. Maybe Anki compiles with pdfTeX as command and not pdfLaTeX. Maybe Anki doesn't set documentclasses. Can you try to compile a .tex file produced by Anki with your shell?

I'm not exactly sure where I could find the .tex file that's produced by Anki, though this is what's on the Anki card itself
$\lim _{x \rightarrow c} f(x)=L$

This LaTex syntax seems to be correct since when I added it to a .tex file and ran pdflatex it worked.
Thanks a lot for your help by the way. Have you used Anki before? Also this is the error that I'm getting from within Anki

In your first post (and your picture) is a path:  /tmp/anki_temp/tmp.tex
Maybe you could check there. And yes, your LaTeX syntax on your card is correct, so this isn't part of the problem.
Anki loads a lof of packages, so maybe some packages are updated and have commands with the same name, what could cause these command \(n)CI already defined errors. I would try to find this generated tmp.tex and make a testing copy. In this copy, I would remove all packages (or comment them out) and enable them step by step to the point/package where this problem appears for the first time. I would try to disable the package in Anki, if that was possible.

Personally, my experience with Anki is very limited, I'm just familiar with LaTeX and confusing LaTeX debugging. If I checked the Anki website correctly, the current version was published in 2016? Please correct me, if I'm wrong. So it's based on the versions of packages from 2016. A few years later, today, packages could act a little bit... weird, causing such errors.

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