Journal texstyles: no space after the title of a `case`, and a bare `case` loses its period
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- latex
- Domain
- build-system
Research direction
The bug is in the match="case" template of xsl/pretext-latex-classic.xsl (around line 573), where the title and type-name branches write \textit{...} with no following space and no period. Compare with the case environment heading in xsl/pretext-latex-common.xsl (mode="environment", around line 2577). Build the minimal source with the journal publication file and inspect the generated main.tex. Done when the title and type-name branches emit a space (and a period after the type name), and the PDF reads "First case. Text..." and "Case. Text...".
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- XSLT
- Stars
- 466
- Forks
- 251
- Avg merge
- 4m
- Merged PRs (30d)
- 13
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PreTeXtBook/pretext
-
The print preview leaves writing space short by the margins of hidden headers, footers and solutionsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PreTeXtBook/pretext#3329 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
PreTeXtBook/pretext#3305 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PreTeXtBook/pretext#3297 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
PreTeXtBook/pretext#3285 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PreTeXtBook/pretext#3283 ·
Maintainers usually reply within 1 day
All issues in PreTeXtBook/pretext
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 91/100
rchillyard/TableParser#132 ·
Maintainers usually reply within 1 day
-
bug priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
storytold/photocraft#15500 · 1 comment ·
Maintainers usually reply within 1 day
-
Eigen 3.3 compatibility CI job fails on the Ubuntu 26.04 runner imagePossibly taken @jc-macdonald claimed this today. Openbug ci
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
yoavram-lab/VBPCApy#377 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
NativeScript/ios#577 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
phantoslayer21/wronggpu#274 ·
Maintainers usually reply within 1 day