Can the MathJax live preview be turned off?

Hi, I’m wondering if the MathJax live preview in the newest version of Anki (2.1.50) can be turned off?

I have lots of cards with a syntax like: \[F = {{c1::ma}}\]

These produce either strange-looking formulae or a MathJax syntax error in the live preview, so I’d like to be able to just turn off the feature. And actually when I think about it, I prefer being able to edit the MathJax directly like I’m used to, rather than click on it to show the markup.

1 Like

I think making the MathJax handle optional is a good idea. Edit: but maybe it could be

To anyone interested in implementing such an option in the preferences: I’d like to request an option for the image handle too, because that one has no use for people who use template CSS to set image sizes.

I can’t reproduce this with the formula you provided. This is how it displays for me:

image

Would you mind providing a formula that produces a syntax error?

2 Likes

Thanks. You’re right, I see now that the syntax on breaking in more specific circumstances. Here’s an example that gives a syntax error:

the likelihood function for <anki-mathjax>X</anki-mathjax>&nbsp;is<anki-mathjax block="true">\begin{align}L &amp; = {{c1::\prod_{i=1}^n \left(e^{-\left(\sum_{k \neq i} \mu_{ik}\right)v_i} \prod_{k \neq i} \mu_{ik}^{d_{ik} }\right)\\ &amp; = \prod_{i \neq j} \left(e^{-\mu_{ij} v_i} \mu_{ij}^{d_{ij} }\right)}}\end{align}.</anki-mathjax>

Looks like it’s got something to do with having an alignment character (&) inside a cloze.

This card also crashes Anki if I try to type “\(” onto it, but I guess that is a separate issue.

Thanks for the example!

That equation doesn’t work on the front side during review either, so it seems like this is more of an issue regarding the use of clozes within MathJax in general.

Are there any other reasons why you would prefer to turn the new MathJax handle off? The longer I think about it, the more I feel like it should be solved with UX improvement of the handle rather than making it optional (same goes for the image handle).

Really? On mine the front side during review looks like this:

L = […].

(Getting an error when I try to upload a screenshot right now!) What do you mean when you say the front side doesn’t work? For me reviews are fine, only the editor is giving me grief.

1 Like

Oh sorry, you’re right. I have accidentally used a modified Cloze template, which was causing the issue. It displays fine with the default Cloze notetype :sweat_smile:

Does the extra click outweigh the benefit of being able to see the rendered formulae, though?

1 Like

Yeah I’m not so fussed about having an option any more. I only had very few cards that had that specific problem with a cloze and an alignment character at the same time, so I’ve just edited those.

Seeing “c1” in my rendered LaTeX formulae is a bit weird but I can live with it. The main reason I wanted to be able to go back to the old way was the ugly “small red text with yellow highlighting” that would show up when the live preview got an error. (Which is now fixed for my collection anyway.)

Thanks again.

Glad you could resolve your issues.

Judging from your examples, you seem to be a MathJax power user, so any further suggestions for improvement on Anki’s MathJax support are certainly valuable to the devs :wink::+1:

2 Likes

No problem, I’ll sure I’ll think of something!