Getting Latex to work on Android

Hello,
could someone help me to get my cards display latex on Anki android app? Right now it just displays the code.



I am a beginner and after surfing for answers did not manage to solve it on my own.

I use a lot of formulas so I have set up the template to display latex. I have added screenschots of my setting.

Can you follow these steps and see if it renders?

  1. Create a card that uses [latex] tags if you haven’t already.
  2. From the main page, click on Tools>Check Media to update all media.
  3. Sync the desktop and then AnkiDroid.
  4. View the card you created from AnkiDroid.
1 Like

Thanks for your reply. I followed the steps. It does not work with latex tags. It works on computer only with latex equation tags ([$][/$] or [$$][/$$]). On app the latex does not work at all, just gives me the code when I use [$][/$] or [$$][/$$].

Edit: I actually think it has to do with my template but I do not know how to solve it.


If you remove the [latex] tags from the template and add it to an individual note’s Front field and run the above 4 steps again, does that work? As far as I understand, Anki doesn’t scan media tags outside of fields.

Also, I think you edited out something about a missing LaTeX package. To diagnose that, you should start by replacing the header in your first screenshot with this minimal version (the default):

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

But based on the fact that the LaTeX renders in your other screenshots, it shouldn’t be necessary, and I don’t understand how you could have gotten that error.

I also don’t understand what you mean by “Right now it just displays the code.”. I would like to see a screenshot. If you’re talking about the first screenshot you posted, that dialog is supposed to show the code.

1 Like

Thank you a lot! Problem solved!

I did a new test with a new deck with the original Anki Basic template and it worked both on laptop and app!

Also, I saw that I had the \usepackage[utf8]{inputenc}missing in my custom template and adding it fixed it: the latex code displays as it should also on my app now.

(Reason for the earlier edit: I also deleted bunch of shared decks I had downloaded earlier. I assume these had also some problems in their templates but as I dont use them the easy fix was to just delete them.)

1 Like