Anki 2.022/Latex/Mavericks Problems and Solutions

For the last few days, I’ve been working through an unexpected problem with lovely, dependable Anki, which is a flashcard program that I use to memorize everything from my students’ names (it’s genius for this) to tricky integral and derivative formulas.

It turns out that all previous versions of Anki (so far as I can tell) worked with whatever TeX distribution you install on your Mac, as long as

  1. You had dvipng.
  2. latex and dvipng were on your default path.

This is not true with Anki 2.022 (presumably it will continue to fail for higher versions of Anki), which won’t find latex at all unless you’ve installed MacTeX (which installs in /usr/texbin) or BasicTeX (which I guess installs either in the same place, or someplace else that Anki can find it).

If, like me, you have a TeXLive distribution, you’re in trouble until you discover the “Edit_LaTeX_and_dvipng_calls” add-on for Anki (tip of the hat to one Soren Bjornstad for this one– you, sir, have saved my bacon royally with this one). The trick is to open the add-on, which gives you a piece of Python code containing the line

newLatex = [“latex”, “-interaction=nonstopmode”]

which you need to edit to insert the complete path to latex, as in

newLatex = [“/usr/local/texlive/2013/bin/x86_64-darwin/latex”, “-interaction=nonstopmode”]

If you don’t know the path, you can get it by opening terminal and typing “which latex”. This should show you the entire path on your machine. 

Repeat the process with the line

newDviPng = [“dvipng”, “-D”, “200”, “-T”, “tight”]

which, again, needs the entire path to dvipng, as in

newDviPng = [“/usr/local/texlive/2013/bin/x86_64-darwin/dvipng”, “-D”, “200”, “-T”, “tight”]

As before, you can get the path (if you don’t know it) by typing “which dvipng” in terminal.

It’s likely that if you have TeXShop (or TeXWorks) or something similar, then you have either TeTeX or TeXLive as the underlying TeX distribution, and you’ll have to do this. Or, I guess, install MacTeX on top of your existing distribution.

Happy memorizing! And many thanks to Damien Elmes of Anki, who helped me work through all this.

One Comment

  1. […] I found the answer here Anki+Latex. […]

Comments are Disabled