Open eeholmes opened 3 weeks ago
When we do
\begin{equation} \label{eq-eq1}
a+b
\end{equation}
we get
<p><span class="math display">\[\begin{equation} \label{eq1}
a+b
\end{equation}\]</span></p>
<p>The cross-ref with <code>\eqref{eq1}</code> to get <span class="math inline">\(\eqref{eq1}\)</span>.</p>
The MathJax javascript library is handling the anchor for eq1 and adding the numbers for the equation. You don't see that in the html. While if we do this
$$
a+b
$$ {#eq-eq1}
we get
<p><span id="eq-eq1"><span class="math display">\[
a+b \tag{1.1}\]</span></span></p>
<p>Then you cross-ref with <code>@eq-eq1</code> which gives you this: <a href="#eq-eq1" class="quarto-xref">Equation <span>1.1</span></a>.
You can see that Quarto has processed the math code and 'tricked' MathJax into not making its own equation numbers by using a fixed \tag{1.1}
. But when we need MathJax to use its amsmath code processor, this is a problem. We don't want to stop MathJax from working to figure out the equation numbering. That can be complex in amsmath with all the different options.
So Quarto, understandably, taps into its cross-ref mechanism while using pure amsmath taps into MathJax cross-ref system. Quarto uses \tag{}
to show the tag wo triggering MathJax eqn number machinery. So I need to dig into the Quarto cross-ref code to figure out how it knows the chapter number from @eq-eq1
Made some progress with a lua filter but still not luck. My lua filter writing skills are poor.
It might be productive for us to do a video pairing session over this. Would you be available? If so, please email me at carlos.scheidegger@posit.co, and we'll figure it out.
Problem
The number should be (3.1) and not (1)
Solution
I think MathJax tagformat extension but how to get the chapter info to MathJax???
https://docs.mathjax.org/en/latest/input/tex/extensions/tagformat.html#tex-tagformat