MathJax Breaks Cloze

Is it possible to cloze the word Thrombokinase here:

I’m using MathJax to render this.

\(\ce{Prothrombin→[Thrombokinase] Thrombin}\)

If I cloze the above,

\(\ce{Prothrombin→[{{c1:Thrombokinase}}] Thrombin}\)

I get this:

If anyone knows any alternatives to MathJax here, please let me know.

Also want to ask, if something can be done from Anki’s side to prevent this, particularly with the formatting of cloze deletions. MathJax breaks the custom cloze formatting I use on my cards and it’s not always possible to have the cloze outside MathJax delimiters.

1 Like

Enclosing the cloze with {} works for me:

<anki-mathjax>\ce{Prothrombin→[{ {{c1::Thrombokinase}} }] Thrombin}</anki-mathjax>

It will show this on the front:
anki
And this on the back:
anki

Sidenote:
You’re missing a : here:

Though that’s not the reason it didn’t work (in your picture you had it right).

2 Likes

Pretty sure you just have to insert an extra space between brackets that occur inside a cloze.

So ‘…ase}}’ becomes ‘ase} }’

I’ve run into this a million times myself, and took me a while to figure it out.

2 Likes

This doesn’t work for me. I get a message stating “You have a cloze note type but have not made any cloze deletions. Proceed?”

This solved it. Source for this black magic we’re doing here?

I tried spacing for the mathjax brackets but didn’t work :frowning:

No source. I just thought: “That looks like maybe something needs to be escaped” but escaping wasn’t the answer (I tried it). Then I had the idea that maybe the cloze syntax somehow interferes and needs a “box” (the {} I enclosed it with). Although I don’t remember specific situations, this “box” thingy helped me in other IT related problems as well, so I tried it here too (somethimes the “box” is not a {, but rather a ", ', [, ( or ` character.).

1 Like

In this case the manual didn’t provide a solution. Maybe we should add this solution above to the manual. I can do that later if desired.

Actually, I looked into mhchem’s documentation and it did mention this :sob:

So sorry, I didn’t know that’s how it worked. I learned this by looking other people’s cards.

So I guess no need to add this to ankis manual?

For future readers: Now that sorata mentioned it I found the manual here and this is what is says:

1 Like

Now what about my use case where I need the text in the cloze to be parsed in that manner? :(
Instead of thrombokinase in the catalyst section, I have CoCl₂, which is also a cloze. The same error shows up, but I can’t escape the entire text.

I can make this work:

\(\ce{->[{ {{c1::CoCl_2}} }]}\)

Here is how it renders:

Screenshot-2025-01-15-00-32-11-57-a9eef3a2a561b80d5c76daebd0f9a14c

The cloze is fine in this case. I can’t make HTML tags etc. work though.

1 Like

Ah, right. I didn’t think about manually making that as subscript.
I was tinkering around, and realised that you can nest a \ce within that “ignore parsing” bit.
\(\ce{stuff ->[{ \ce{ {{c1::CoCl2}} }}]}\) also does the same thing.
Edit: Fixed the number of braces

Hmm… I tried this before and it didn’t work but now it’s working. But I needed an extra {} for \ce:

\(\ce{stuff ->[{ \ce{ {{c1::CoCl2}} } }]}\)
1 Like

Yeah, mb, I didn’t realise that the number of braces was incorrect.