HTML and PDF disagree on the number of an item in a "conclusion"

Aperta
#2,905 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à
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
html, latex, xml
Ambito
build-system

Direzione di ricerca

Reproduce with the minimal <chapter> XML in the issue and compare the generated HTML and PDF numbers for thm-intro, thm-body, thm-concl, and their <xref>s. Then trace the HTML assembly-time numbering and the LaTeX/PDF counter reset around <conclusion>; the issue points to #2885 and #2904 as prior changes to the same numbering path. Done when conclusion items and every cross-reference agree across formats, including equations and footnotes.

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

Descrizione

A numbered item (theorem-like block, figure, project, numbered equation, footnote, …) placed in the <conclusion> of a structured division receives a different number in HTML than in PDF. In HTML the conclusion's items continue the division's running count (they are pooled after the body); in LaTeX/PDF the native counters restart, so the same item gets a lower number. The item — and every cross-reference to it — disagrees between the two formats.

This is specific to <conclusion>. Items in an <introduction> agree across formats, because an introduction is the division's first content and both formats begin the count there.

Minimal example
<chapter xml:id="ch">
  <title>Chapter</title>
  <introduction>
    <theorem xml:id="thm-intro"><statement><p>An introduction theorem.</p></statement></theorem>
  </introduction>
  <section xml:id="s1">
    <title>Body</title>
    <theorem xml:id="thm-body"><statement><p>A body theorem.</p></statement></theorem>
  </section>
  <conclusion>
    <theorem xml:id="thm-concl"><statement><p>A conclusion theorem.</p></statement></theorem>
  </conclusion>
</chapter>

Build HTML and PDF and compare. thm-intro gets the same number in both formats (introductions agree, being the division's first content). thm-concl does not — HTML continues the chapter's running count while LaTeX/PDF restarts in the conclusion — and every <xref> to it inherits the discrepancy. (Exact values depend on the numbering-level configuration.)

Expected

The same item has the same number in every output format.

Background

The cause is structural: HTML derives numbers from a single assembly-time count that pools introduction/conclusion items at a division's edges, while LaTeX/PDF uses native counters that restart per division. Numbered equations and footnotes have used that assembly-time count since #2885, so they already show this disagreement in a conclusion; #2904 brings theorem-like blocks, figures, and projects under the same approach, extending the behavior to them.

Recorded as a known-behavior bug. Related: #2906 (inline exercises in an introduction or conclusion).

Claude Opus 4.8, acting as a coding assistant for Rob Beezer

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 Build System

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.