Numbering, consistency with LaTeX

17 views
Skip to first unread message

Rob Beezer

unread,
Mar 30, 2026, 7:24:23 PMMar 30
to prete...@googlegroups.com
I've been looking into some (long-overdue) changes to how PreTeXt computes the
numbers of various objects. Since the very beginning, we have looked to LaTeX
as our style guide. Not always a good idea, but for numbering it has served us
well.

Turns out for subnumbered figures (a #figure as a #sidebyside panel, with the
#sidebyside inside an overall #figure), LaTeX likes to write "Figure 26.2(b)",
while in HTML (and elsewhere) we have for a long time been writing "Figure
26.2.(b)". You hadn't noticed? Me either, until today.

And it was not by laboriously scanning HTML output side-by-side with a PDF. I
have, with a little help from Claude, added a flag, debug.numbering.check, which
writes a whole pile of assertions into LaTeX source, indicating the number
PreTeXt computes as an argument to a macro. The macro gets the LaTeX number,
*at compile time*, and will write a warning into the *.log file if there is a
mismatch. Look for lines prefixed with "PreTeXt Warning:". Covers blocks
numbered by tcolorbox and divisions (so not absolutely everything, we do
hard-code some numbers in LaTeX output).

Two minor bugs have surfaced, one known, another new. Quite obscure, it'll take
me some time to attack them.

Should have added this a long time ago. ;-)

See https://github.com/PreTeXtBook/pretext/pull/2811 for more details.

Rob

Rob Beezer

unread,
Mar 31, 2026, 8:22:55 PMMar 31
to prete...@googlegroups.com
The "multi-number" template (for making the structural parts of numbers) is very
old and has evolved in undesirable ways. It was suspected in an obscure
numbering bug, but I could never screw up the courage to wrestle with that template.

That's OK, because now the template is gone and the bug is gone too. The
replacment moves much of the logic and computation into the pre-processor.
Eventually we might get all of the numbering logic into the pre-processor.

It has undergone a lot of testing, 12 before/after comparisons of HTML with
varying structure and varying publication file choices. Thanks, Claude.

So this is mostly just a heads-up.

Details can be found at: https://github.com/PreTeXtBook/pretext/pull/2812

Rob
Reply all
Reply to author
Forward
0 new messages