Mathjax not rendering when reviewing cards

Hello!

I am running Anki on Fedora 44. The Anki version is the newest one available (26.09.3).

When I include Mathjax in my cards, it renders correctly in edit mode, but not in review mode. Restarting Anki does not help. I do not have any addons or templates installed. The card type is the standard front/back.

Thank you for your help!

Can you share the template contents?

Hi!

The front is

{{Front}}

Back is

{{FrontSide}}

<hr id=answer>

{{Back}}

Styling is

.card {
    font-family: arial;
    font-size: 20px;
    line-height: 1.5;
    text-align: center;
    color: black;
    background-color: white;
}

It is simply the standard card type, I have made no changes to it. Is this what you mean?

What’s the HTML of the front and back fields (click the “<>” button)?

<div>What do Fermat's little theorem and Euler's theorem mean for RSA?</div>
<pre><code>- n = pq (distinct primes)</code></pre><pre><code>- <anki-mathjax>\varphi(n) =\varphi(p)\cdot\varphi(q)=(p-1)(q-1)</anki-mathjax><br>
- </code><anki-mathjax>x^{k\varphi(n)+1}\equiv x(\bmod n)</anki-mathjax><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">for all x and integers k</span></pre><pre><br></pre>

Do you mean this?

Yes. That explains it.

I don’t know the technical details, but <pre> is meant to be used for literal text, i.e. “render this text exactly as it is”.

Did you copy paste this from an LLM or something like that? It shouldn’t happen when you type normally.

No, the text is copied from my lecture notes, which I take in markdown. I’ll have to do some investigating to see if and how this causes the problem. Thank you though! Now I know what to look for, at least (:

The HTML tags <pre> [preformatted text] and <code> [code block] are both problematic.