Extra vertical space on card (2.1.55 beta 4)

I have a card with the following HTML:

Consider a particle with position \(X\in \reals\) and velocity&nbsp;\(Y \in \reals.\) The following SDE is called the {{c1::<i>Ornstein-Uhlenbeck&nbsp;process</i>}}: \[\left\{\begin{aligned}mdY&amp;=\underbrace{-b Y d t}_{\text {dissipation }}+\underbrace{q d W}_{\text {fluctuation }} \\<br>d X&amp;={{c2::Y dt}}<br>\end{aligned}.\right.<br>\]

When the card is rendered while studying it, there looks like there are four or five blank lines between the text and the equation.

When I opened the card in the card browser, the preview was initially correct, but as soon as I trivially modified the HTML, the extra spaces appeared also appeared in the preview.

Logged on Styling changes have caused MathJax regression · Issue #2195 · ankitects/anki · GitHub

In a similar vein, MathJax is not rendering vertical bars correctly when used in conjunction with \left ... \right. For the following code, the second and third lines of the code are not producing vertical bars. Parentheses appear to render OK.

\[
|\int f(x) dx |, \quad 
\left\lvert \int f(x) dx \right\rvert, \quad 
\left| \int f(x) dx \right|, \quad
\left( \int f(x) dx \right).
\] {{c1::}}

I also noticed that I cannot undo edits made in the Card Browser after I have changed focus to the card preview.

@pwintz are you using custom JS/CSS in your notetype? I cannot reproduce the issues with the default Cloze notetype.

When I open the preview from the card browser, the vertical lines are rendered correctly but then disappear when the card is edited.

I do have a JS script, but I wouldn’t expect it to effect this:

<script> /* Configuration for pre-2.1.43 versions of Anki */ MathJax.Hub.Config({   TeX: {     Macros: {       invs: '{^{-1}}',       dom: '{\\operatorname{dom}}',       trans: '{^{\\top}}',       reals: '{\\mathbb R}',       abs:['{\\left|#1\\right|}', 1],        xdot: '{\\dot{x}}'     }   } });   MathJax.Hub.Configured(); </script> <script> /* Configuration for version 2.1.43 and later */ MathJax.config.tex.macros =  {       invs: '{^{-1}}',       dom: '{\\operatorname{dom}}',       trans: '{^{\\top}}',       reals: '{\\mathbb R}',       abs:['{\\left|#1\\right|}', 1],        xdot: '{\\dot{x}}',        prob: '{\\operatorname{Pr}}'     }; MathJax.startup.getComponents(); </script> {{cloze:Text}}

I’m not sure why the " " (U+2029 : PARAGRAPH SEPARATOR ) is showing up in the copied text, but here is a cleaned-up version:

<script> /* Configuration for pre-2.1.43 versions of Anki */ MathJax.Hub.Config({   
TeX: {     
Macros: {       
invs: '{^{-1}}',       
dom: '{\\operatorname{dom}}',       
trans: '{^{\\top}}',       
reals: '{\\mathbb R}',       
abs:['{\\left|#1\\right|}', 1],        
xdot: '{\\dot{x}}'     
}   
} });   
MathJax.Hub.Configured(); </script> 
<script> /* Configuration for version 2.1.43 and later */ MathJax.config.tex.macros =  {       
invs: '{^{-1}}',       
dom: '{\\operatorname{dom}}',       
trans: '{^{\\top}}',       
reals: '{\\mathbb R}',       
abs:['{\\left|#1\\right|}', 1],        
xdot: '{\\dot{x}}',        
prob: '{\\operatorname{Pr}}'     }; 
MathJax.startup.getComponents(); 
</script> {{cloze:Text}}
1 Like

Ok, so this is not specific to the beta, and is caused by multiple calls to MathJax.startup.getComponents(); . Maybe you could avoid it by setting a variable to ensure you only call it once.

1 Like