Journal texstyles: no space after the title of a `case`, and a bare `case` loses its period
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
- 88/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- latex
- Ambito
- build-system
Direzione di ricerca
Il bug si trova nel template match="case" di xsl/pretext-latex-classic.xsl (intorno alla riga 573), dove i rami del titolo e del nome del tipo scrivono \textit{...} senza spazio né punto successivi. Confronta con l'intestazione dell'ambiente case in xsl/pretext-latex-common.xsl (mode="environment", intorno alla riga 2577). Costruisci la sorgente minima con il file di pubblicazione per riviste e controlla il main.tex generato. È completato quando i rami del titolo e del nome del tipo emettono uno spazio (e un punto dopo il nome del tipo) e il PDF riporta "First case. Text..." e "Case. Text...".
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
In the LaTeX conversion for a journal style (the pretext-latex-classic.xsl conversion that every texstyle imports), a case of a proof with a title prints the title in italics and then the first paragraph immediately, with no space: "First case.Text of the first case." A case with neither title nor direction prints its type name the same way, and without the period: "CaseText of a case with no title." A case with a direction is right, because that branch alone writes a space.
Minimal source
main.ptx:
<?xml version="1.0" encoding="UTF-8"?>
<pretext xml:lang="en-US">
<article xml:id="case-test">
<title>A case title in a journal style</title>
<section xml:id="section-one">
<title>A section</title>
<theorem xml:id="theorem-cases">
<statement><p>Something holds.</p></statement>
<proof>
<case><title>First case</title><p>Text of the first case.</p></case>
<case direction="forward"><p>Text of the forward direction.</p></case>
<case><p>Text of a case with no title.</p></case>
</proof>
</theorem>
</section>
</article>
</pretext>
publication.ptx:
<?xml version="1.0" encoding="UTF-8"?>
<publication>
<common><journal name="ams"/></common>
</publication>
Command:
pretext/pretext -c doc -f pdf -p publication.ptx -d out main.ptx
Observed
In out/main.pdf:
First case.Text of the first case.
(⇒) Text of the forward direction.
CaseText of a case with no title.
The generated main.tex has, for the first case,
\noindent{}\textit{First case.}\label{theorem-cases-2-1}%
Text of the first case.%
Expected
What the same source gives without the journal entry in the publication file, and in HTML:
First case. Text of the first case.
(⇒) Text of the forward direction.
Case. Text of a case with no title.
Cause (xsl/pretext-latex-classic.xsl at bf795ab1)
The template match="case" (line 573):
<xsl:template match="case">
<xsl:text>\par\medskip%
</xsl:text>
<xsl:text>\noindent{}</xsl:text>
<xsl:if test="@direction">
<xsl:apply-templates select="." mode="case-direction"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:if test="title">
<xsl:text>\textit{</xsl:text>
<xsl:apply-templates select="." mode="title-full" />
<xsl:text>}</xsl:text>
</xsl:if>
<xsl:if test="not(title) and not(@direction)">
<xsl:text>\textit{</xsl:text>
<xsl:apply-templates select="." mode="type-name"/>
<xsl:text>}</xsl:text>
</xsl:if>
<!-- label -->
<xsl:text>\label{</xsl:text>
<xsl:apply-templates select="." mode="unique-id" />
<xsl:text>}%
</xsl:text>
<xsl:apply-templates select="*"/>
</xsl:template>
The direction branch ends with a space; the title branch and the type-name branch end with } and go straight to \label{...}% and the paragraph. title-full supplies the title's period, but nothing supplies one after the type name. For comparison, the ordinary LaTeX conversion defines a case environment (pretext-latex-common.xsl, mode="environment", line 2577) whose heading is
\notblank{#2}{#2\space{}}{}\textit{\notblank{#3}{#3\space{}}{}\notblank{#2#3}{}{#1.\space{}}}
a space after the direction, after the title, and after the type name, and a period after the type name.
Suggested fix
In the two branches, write the space (and the period for the type name) as the common conversion does:
<xsl:if test="title">
<xsl:text>\textit{</xsl:text>
<xsl:apply-templates select="." mode="title-full" />
<xsl:text>} </xsl:text>
</xsl:if>
<xsl:if test="not(title) and not(@direction)">
<xsl:text>\textit{</xsl:text>
<xsl:apply-templates select="." mode="type-name"/>
<xsl:text>.} </xsl:text>
</xsl:if>
The \label{...}% that follows ends its line with %, so the space before it survives into the paragraph; if it is thought safer, \space{} instead of a literal space.
Environment: commit bf795ab1 (2026-10-02), xelatex (TeX Live 2024), Debian 13.
- 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PreTeXtBook/pretext
-
The print preview leaves writing space short by the margins of hidden headers, footers and solutionsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
PreTeXtBook/pretext#3329 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
PreTeXtBook/pretext#3305 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
PreTeXtBook/pretext#3297 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
PreTeXtBook/pretext#3285 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
PreTeXtBook/pretext#3283 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di PreTeXtBook/pretext
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
NativeScript/ios#577 ·
I maintainer di solito rispondono entro 1 giorno
-
bot:ai-assisted component:platform-js status:untriaged
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 74/100
midnightntwrk/platform-js#38 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
oxc-project/tsrs#1010 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
rubys/roundhouse#2217 ·