[Tex/LaTex] Anki – LaTeX, Math Font Size, & DeclareMathSizes

ankifontsizemath-mode

I use the Anki flashcard program and render math equations using LaTeX within the program.

The problem is that the font sizes are generally too big, unless the equation is really long, in which case the equation automatically sizes down in order to fit the screen.

This is the default LaTeX header in Anki:

\documentclass[12pt]{article}
\special{papersize=3in,5in}
\usepackage{amssymb,amsmath}
\pagestyle{empty}
\setlength{\parindent}{0in}
\begin{document}

And this is the default footer:

\end{document}

To call LaTeX within Anki when creating a flashcard, you use [latex] and [/latex], which I assume refer to the header and footer respectively. (I'm neither an Anki nor a LaTeX expert.)

Anyway, I've tried inserting the following right before \begin{document}:

\DeclareMathSizes{2}{2}{2}{2}

Yes, I realize this is supposed to make the text really tiny, but more importantly, nothing changes. My equations are still too big (or too small, if the equation is really long).

Please help!

Best Answer

Tools -> Manage Note Types... -> Options; in the last line of the Header field after \begin{document} just type

\tiny

And your LaTeX will be made smaller. Because previously rendered latex is cached as image files, you may have to delete those files before the change is apparent. On my Mac the files are in ~/Anki/User 1/collection.media/latex-*.png

For me this makes my [$$][/$$] equations the same size as the surrounding Anki font.

I hope this helps!


UPDATE: On Linux, the media directory seems to be located in ~/Documents/Anki/User 1/collection.media/