Format Cloze Deletions in MathJax?

When a cloze deletion happens in an equation, such as

\[{{c2::n=k m}}\]

then the deletion is not styled using the .cloze style defined in the CSS:

.cloze {
 font-weight: bold;
 color: blue;
}

In particular, the color is not applied:
image

Could we change how Anki handles cloze deletion so that [...] and the revealed answer use the styling? Perhaps we can use the following functions:

https://docs.mathjax.org/en/latest/input/tex/extensions/html.html

1 Like

So we can’t just load html and use \color?

If we are styling only the [...] part it works when I do it from the editor like this:

\(\require{html} \color{red}{\mathbb{[...]} } \)

And o3 is unable to find contexts where it doesn’t work (it just listed when you have ye wrong syntax).

Perhaps someone experienced will know better than me.


Also, pinging @pwintz in case they aren’t aware of \require. Anki supports it so you can load these extensions yourself.

For some comparison, here is how my clozes normally look:

Screenshot_2025-06-08-19-49-27-06_a9eef3a2a561b80d5c76daebd0f9a14c

Here is how they look inside a MathJax block:

Interestingly, it improves a lot when I apply \text on it:

If I manually add the cloze class to [...] then it looks pretty much like my original:

(except it’s not bolded enough unless I load amsmath and use pmb)

1 Like