quarto-dev/quarto-vscode

Preview TeX Maths breaks with a cross reference

iandol opened this issue · 4 comments

When I hover an equation, if there is a cross reference of the form:

$$\frac{d}{dx}\left( \int_{a}^{x} f(u)\,du\right)=f(x).$$ {#eq-marginalia}

Then the preview fails to render:

Screenshot 2022-09-21 at 13 43 50

Adding a newline betwee $$ and {#... and the preview works as expected (but a newline will then break the cross reference when rendering):

Screenshot 2022-09-21 at 15 30 33

Thanks for reporting this! Fix is here: 8cc0a42

Available in the latest release (v1.43.0)

Hi @jjallaire thank you. However I still don't see this working. Here is V1.43.0 with a space between the equation and label:
Screenshot 2022-09-30 at 09 50 56

Notice the grey background highlighting block extends down to the closing :::. If I add a newline before for the label then the grey background disappears and the equation renders:
Screenshot 2022-09-30 at 09 50 21

There is some greedy regex or something eating up the block, here is an example without a surrounding div:

Screenshot 2022-09-30 at 09 56 09_SMALL

Here is the text for that example:

See both @eq-one and @eq-two for more details:

$$t' = \frac{t - \dfrac{v}{c^{2}}x}{\sqrt{1 - \dfrac{v^{2}}{c^{2}}}}$$ {#eq-one}

Sint meis quo et, vis ad fæcete dolorem!   

$$\nabla \times \mathbf {H} ={\frac {1}{c}}\left(4\pi \mathbf {J} _{\text{f}}+{\frac {\partial \mathbf {D} }{\partial t}}\right)$$ {#eq-two}

Tritani posidonium suscipiantur ex duo, meæ essent mentitum ad.

Yeah, we aren't fully in control of those regexes unfortunately. If you try this it will work:

$$
t' = \frac{t - \dfrac{v}{c^{2}}x}{\sqrt{1 - \dfrac{v^{2}}{c^{2}}}}
$$ {#eq-one}

Ok, understood, and cheers!