I am using the built-in MathJax support to render math for a while, on both macOS desktop and iOS mobile application. Recently I would like to introduce several shortcuts, so following this I add this script at the beginning of both the front side and the back side in the card template:
Since that post, MathJax was updated to MathJax 3, which is much, much faster than the previous MathJax 2.
However this also changed how to configure MathJax.
Thanks for your answers. I tested on macOS and iOS and found @hengiesel 's answer works on both platforms. Using JavaScript like
however, doesn’t work on iOS, and I think it’s a problem related to different rendering mechanisms or strategies. Nevertheless, doing \def is robust.
I suggest this solution be added to the Anki documentation to prevent further confusion. I will try to figure out how to do this later, or you can give me some clues about how to do this.
I don’t have an iOS device, so I don’t know anything about AnkiMobile. This is just a guess, but if the version of MathJax bundled with AnkiMobile is 2.x, the following script might work.
Note that AnkiDroid 2.15, which is currently in its Alpha version will also update to MathJax 3, at which point the different Anki implementations will have the same MathJax version again.
AnkiMobile’s on MathJax 3 already. I’ve made a note to look into why the JS approach is not working, but in this case the other approach looks simpler.