Punctuation absorbed into mathematics is spaced as an ordinary symbol; \mathpunct would fix it

Aperta Adatta ai principianti
#3,236 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
74/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
latex
Ambito
documentation

Direzione di ricerca

La modifica riguarda il template per la modalità get-clause-punctuation in xsl/pretext-common.xsl, dove la punteggiatura è racchiusa in \text{...}. Cambia il wrapper in \mathpunct{\text{...}} e verifica che l'output della modalità resti invariato quando $punctuation è vuoto. È completato quando l'esempio della issue viene visualizzato in MathJax senza spazio prima della virgola o del punto e senza errori di MathJax.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Punctuation absorbed into mathematics is spaced as an ordinary symbol

Summary

When PreTeXt moves clause-ending punctuation into mathematics, it wraps the mark as \text{,}. TeX, and MathJax following TeX's spacing rules, treats \text{...} as an ordinary symbol, so the space between the last item of the mathematics and the punctuation is whatever TeX puts before an ordinary symbol. After an operator name, or after a relation, that is a visible space. For example,

<p>... on its restriction to the Brunnian group <m>\operatorname{Brun}_4</m>, then it is faithful ...</p>

becomes \operatorname{Brun}_4\text{,} and renders in HTML as "Brun₄ , then", with a gap before the comma. Likewise <m>a \le</m>. renders with a gap before the period.

Proposed change

Mark the punctuation as punctuation: \mathpunct{\text{,}}. TeX puts no space between an operator, a relation, or an ordinary symbol and a following punctuation atom. The space TeX adds after punctuation does not arise, since the mark ends the mathematics.

The wrapping is written by the template in mode get-clause-punctuation in xsl/pretext-common.xsl:

<xsl:if test="not($punctuation = '')">
    <xsl:text>\text{</xsl:text>
    <xsl:value-of select="$punctuation" />
    <xsl:text>}</xsl:text>
</xsl:if>

The change would be \mathpunct{\text{ and }}.

Checked

Rendered in a browser with MathJax 3.2.2 and MathJax 4.1.3 (the CDN builds), each with CHTML and with SVG output, the current form against the proposed form:

last item of the mathematics \text{,} \mathpunct{\text{,}}
operator: \operatorname{Brun}_4 space before the comma no space
relation: a \le space before the period no space
ordinary: x no space no space (unchanged)

None of the four configurations reported an error. In 4.1.3, the version under script/mjsre, \mathpunct is in the base TeX package (BaseMappings, a TeXAtom of class PUNCT).

Not checked: LaTeX itself (\mathpunct is a TeX primitive, and the LaTeX conversion absorbs punctuation into display mathematics, so displays would get the new wrapping), and the change inside PreTeXt. Observed at 352a11ea.

Lingua principale
XSLT
Stelle
466
Fork
251
Merge medio
4m
PR unite (30g)
13

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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.

Altre issue di PreTeXtBook/pretext

Tutte le issue di PreTeXtBook/pretext

Issue simili

Altre issue su Documentation

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.