Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chapter numbering #2

Open
eeholmes opened this issue Aug 17, 2024 · 3 comments
Open

chapter numbering #2

eeholmes opened this issue Aug 17, 2024 · 3 comments

Comments

@eeholmes
Copy link
Member

eeholmes commented Aug 17, 2024

Problem

The number should be (3.1) and not (1)

image

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

@eeholmes
Copy link
Member Author

eeholmes commented Aug 17, 2024

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&nbsp;<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

@eeholmes
Copy link
Member Author

Made some progress with a lua filter but still not luck. My lua filter writing skills are poor.

@cscheid
Copy link

cscheid commented Aug 19, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants