# How to use LaTeX in Anki. I use Windows and Tex Live 2018

As I found on Apple.Stackexchange , I downloaded anki add-on. I am Windows user so couldn't do 'which latex' as the step of that page says.

Anki still didn't work and it says

latex 실행 중 오류 발생.

생성된 파일: C:\Users(myname)\AppData\Local\Temp\anki_temp\tmp.tex latex와 dvipng/dvisvgm을 설치하셨습니까?

Translation

error occured while running latex.

produced file: C:\Users(myname)\AppData\Local\Temp\anki_temp\tmp.tex did you install latex and dvipng/dvisvgm?)

The solutions on web/stackexchange are all about MikTex, but I have installed Tex Live 2018. It has all the Packages, like dvipng or latex. It doesn't have same setting page like Miktex. How can this problem be solved?

• Although my guide was for MiKTeX the principles are similar for Tex Live Firstly the add-on you link was mainly for Apple Mac and I am uncertain how useful for windows, I have not tested it. Anki depends on a suitable stable working LaTeX and the steps for testing that on windows are using a CMD console run> WHERE /r \ latex.exe the response should show you where you installed Tex Live binaries (= some bin folder) when you run> PATH if bin folder is not listed then = same problem and fix as miktex tex.stackexchange.com/questions/471146/… – user170109 Mar 18 '19 at 3:35
• So everything else (running code in Tex Live is OK, cmd finds WHERE latex.exe ...) is fine, and I added C:\usr\texlive\2018\bin to path, but the situation is same.. Did you mean something else? – user549067 Mar 18 '19 at 5:05
• An MWE will show your problem. starting with \documentclass{...} and ending with \end{document}. If from any where you can run a CMD and get a response by typing LATEX and DVIPNG and DVISVGM the first message, then when you get that ANKI message DO NOT Accept or Dismiss the message, because it will then delete the temp files. Using files explorer you can type in the top address bar  %temp%\anki_temp to quickly find the TeX files then you can review what may be wrong and if not clear then edit question 1) show us what you entered as a MWE = tmp.tex and 2) the error log = tmp.log  – user170109 Mar 18 '19 at 12:01
• I'm sorry, but I can't figure out what does "If from any where you can run a CMD and get a response by typing LATEX and DVIPNG and DVISVGM the first message" mean. run cmd anywhere and type latex says it is not a command, runnable program nor batch(?) file. – user549067 Mar 18 '19 at 12:39
• produced file:C:\Users(myname)\AppData\Local\Temp\anki_temp\tmp.tex so we need to see that file and in same folder we need to see \tmp.log however IF you are not able to run Latex (=not a command) then that must be cleared first so looks like path is still not correct recheck that WHERE LATEX and PATH perhaps let us see your related path entries (do those paths have CJK characters?) – user170109 Mar 18 '19 at 12:49

The equivalent to which on Windows is where the following MUST be true to use any TeX

These two commands from a console prompt must be identical

Where /r \ latex
Where \$path:latex


for example both may reply C:\texlive\2018\bin\w32\latex.exe

If they are not the same then there is a failing in the path setting and anki will not be able to run the tmp file.

A second problem is system user name is used for documents and tmp directory. Having spent a week trying to solve a LyX issue the ONLY simple solution was to change username from Hangul characters to ascii (added a new user account just for LyX use).

I think the problem is that you must use XeLaTeX (or pTeX or something else) to output CJK (Chinese, Japanese & Korean) fonts (such as "中文", "실행").

The default setting of anki is LaTeX so you get the error.

You need the add-on "Edit LaTeX build process" to change the build process and its default setting is still LaTeX, so you still get the error.

(I also get this when setting the environment properly.)

(It seems that it only outputs this error when it meets trouble.)

If you must use XeLaTeX to output CJK (Chinese, Japanese & Korean) fonts (or something else needs XeLaTeX), have a look at my answer at How do you get Anki 2.1 to work with XeTeX (+ Edit latex build process)?. (Theoretically, it works for All the CJK. I don't know much about pTeX or something else. I use CTeX package.)

And the second thing is setting the environment properly.

And setting environment properly is quite complex if you are new to TeX, command line and so on.

So if you don't want to trouble yourself just use the default and not use LaTeX in Anki because Anki works well with CJK fonts using HTML.