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

Abierto Apto para principiantes
#3,236 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
74/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
latex

Línea de trabajo

El cambio está en la plantilla del modo get-clause-punctuation en xsl/pretext-common.xsl, donde la puntuación se envuelve como \text{...}. Cambia el envoltorio a \mathpunct{\text{...}} y comprueba que la salida del modo no cambie cuando $punctuation está vacío. Está terminado cuando el ejemplo del issue se renderiza en MathJax sin espacio antes de la coma o el punto y sin errores de MathJax.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
XSLT
Estrellas
466
Forks
251
Merge medio
4 min
PR fusionados (30 d)
13

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PreTeXtBook/pretext

Todos los issues de PreTeXtBook/pretext

Issues similares

Más issues de Documentation

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.