quarto-dev / quarto-dev/quarto-cli

enhancement: add MathJax equation numbering for math environments in html

Aperta
#4,136 12 commenti 2 reazioni 1 assegnatario Vedi su GitHub

@cscheid ci sta già lavorando.

Dal 28/1/2023.

crossref enhancement math
Lingua principale
JavaScript
Stelle
6k
Fork
458
Merge medio
1g 9h
PR unite (30g)
41

Descrizione

By default, MathJax does not have equation numbers when the LaTeX math environments are used. This:

---
title: "test6"
format: html
---

\begin{equation}\label{eq-a}
a
\end{equation}

produces this:
image
instead of this (with numbers)
image

The reason is that the default behavior for MathJax is to not show the equation numbers. This causes endless confusion for those who use the math environment, which is used for more complex math.

It'd be great if Quarto turned on equation numbering in math environments by default so that html and PDF output behaves the same. All that is needed is to have this script in the header if the equation engine is mathjax:

<script>
MathJax = { 
    tex: { 
        tags: 'ams'  // should be 'ams', 'none', or 'all' }
     };
</script>

Obviously you can turn this on manually with

---
title: "test5"
  html:
    include-in-header: mathjax.html
---

with mathjax.html having the script above but most users spend hours and hours trying to debug lack of numbers until they stumble upon the right solution. What is worse, is that the solution depends on the MathJax version. The above is the method for the version being used by Quarto (by default).

I don't think there is any reason to have the numbering turned off. Anyone using the LaTeX math environment is likely to be a LaTeX user and we have a standard methods for selectively turning off numbers on an equation if that were wanted.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.