Pluto.jl
Pluto.jl copied to clipboard
LaTeX equation labeling in markdown
There seems to be a problem with equation labeling:
md"""
```math
\begin{equation}\label{blahbel}
\partial^2 \approx 7
\end{equation}
```
"""
runs correctly the first time it is run, but if you press shift-enter a second time, it gives an error in the LaTeX code. The error goes away when you change the label, so it seems to come from LaTeX complaining about "multiply defined labels" or whatnot.
Check if similar to #488
In addition to label change, error also goes away when the page is refreshed.
Same thing appears to happen if you do actually use the label twice on the page
Seems related to MathJax processing, not #488 (which is caused by pre-processing the MathJax with text{}
). MathJax has already seen that label so complains multiply defined. Something related to this?: http://docs.mathjax.org/en/latest/web/typeset.html#updating-previously-typeset-content
Even if this is fixed, would the \label
feature be useful? How do you reference to a labeled equation?
It could be useful in a notebook with a lot of text and equations.
You use \ref
or \eqref
,
though the numbering doesn't seem to be working
Edit: Seems that the referencing only works properly if the displayed equation numbers are enabled this way: http://docs.mathjax.org/en/latest/input/tex/eqnumbers.html (has another warning about dynamic page modification at the bottom)
But how do you use \ref
? Can MathJax generate clickable links inside the svg?
It might still be a good idea to call typesetClear
https://github.com/fonsp/Pluto.jl/issues/678#issuecomment-727957475
But how do you use
\ref
? Can MathJax generate clickable links inside the svg?
Yes, blue clickable jump links that take you to the equation. I put an example of usage in <details>
of my previous comment (In equation $\ref{label}$...
), though the jumping/numbering doesn't currently work with equation numbering not enabled. I can confirm it does work properly (in a simple MathJax test page) with svg output if equation numbering is enabled though.
it would be great to be able to cross-reference equations in a notebook, I hope this issue can be solved
http://docs.mathjax.org/en/latest/web/typeset.html#tex-reset looks useful
A workaround was provided in this discussion https://discourse.julialang.org/t/pluto-how-to-number-equations-in-latex-mode/59900/9
@CarloLucibello Thanks for linking the post. Just clarifying that the solution in the discourse post uses KaTeX (and it has been very shallowly tested) so it can't be directly applied to deal with equation numbering/labelling in mathjax using the standard latex synthax from @md_str
AFAICT now Pluto uses MathJax, has the status of this issue changed somehow?
Pluto always used MathJax from what I remember (and the issue is/was related to that). The latest comment on Katex was just for the workaround in the link above (which creates a custom function for rendering latex equations that skips markdown/mathjax and use katex directly
Experimentem isto: $$ \begin{align} \tag{1.1} V_{sphere} = \frac{4}{3}\pi r^3 \end{align} $$