In this tutorial, we will learn how to effectively use Anki flashcards for learning mathematics. For this, we are going add a little bit of magic to our cards by using MathJax and LaTeX.

This approach has the following benefits over Anki’s built-in LaTeX support or other users’ solutions:

• Resolution-independent rendering (your equations will look sharp on any device, be it your phone or your laptop)
• Card editing does not require any additional software except Anki (even AnkiWeb works)
• Works flawlessly in Anki desktop, AnkiWeb and AnkiDroid (and probably on iOS as well, although I have not tested it there)
• Does not require the JS Booster addon
• Relatively easy to setup

And if you have been wondering, it also works offline on AnkiDroid after you have synced and reviewed your cards with an active internet connection once. The MathJax code will be cached by AnkiDroid.

## Requirements

This tutorial assumes that you are already familiar with the Anki software and have edited card templates before. If not, have a look at the Anki manual, particularly the Cards and Templates section. Some knowledge of HTML and JavaScript might come in handy, but is not required. For that extra bit of fine tuning, take a look at Anki 2: Styling Cards as well. Now to the interesting parts.

## Integrating MathJax with Anki

To make use of MathJax in our cards, we have to add some boilerplate code, which I will explain in detail.

First, we will add the MathJax configuration script. Insert the code at the end of your front and your back template. The card type does not matter, but I personally prefer cloze cards for mathematics. I also suggest cloning one of the default card types instead of modifying them directly.

<script type="text/x-mathjax-config">
MathJax.Hub.processSectionDelay = 0;
MathJax.Hub.Config({
messageStyle: 'none',
showProcessingMessages: false,
tex2jax: {
inlineMath: [['$', '$']],
displayMath: [['$$', '$$']],
processEscapes: true
}
});
</script>