Why does latex do not render inside a <code> tag?


Today I tried to insert a inline latex inside a <code> tag, but when reviewing my cards I saw that they were not rendered properly.

Here is a demo:

The html source for this card is:

Why does<br>
<code>this \( latex \)</code><br>
do not render, but<br>
<custom_code>this \( latex \)</custom_code><br>

As far as I can see Anki handles <code> tags differently.

Do I really need to use some sort of <custom_code> tag in order to render latex inside a “code-like” tag or am I writing something wrong inside <code> tag?

MathJax does not recognize math expressions inside styled content.

I see…

But in that case I do not understand why latex is rendered inside <custom_code> but not in <code> since both have the same css style.

It’s not a “fix” help or something like that, it’s just that I’m really curious about the why. :stuck_out_tongue:

This is standard MathJax behaviour, not something specific to Anki.


Thanks for your attention, Dae!