Rob Beezer
unread,Jun 10, 2026, 3:26:05 PM (10 days ago) Jun 10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to prete...@googlegroups.com
Announcement over on pretext-announce about refactoring of numbering code. A
few notes for interested developers.
We now do a depth-first traversal of the document tree in the assembly
(pre-processor) phase, checking each structural division's level versus the
desired level of numbering given in the publisher file. At "terminal" divisions
(leaves) we form a node-set of all items to number, and compute an object's
serial number from its location in that node-set. Once we descend below the
numbering level, we form a node-set of all the items to number in the whole
subtree below a division and compute serial numbers relative to that collection.
Recorded as attributes, they are trivial to use when needed (rather than being
re-computed!). All very natural in XSL. (Skipping a few fine points!)
Largely this matches what LaTeX does with standard/rational setups for counters.
A new set of commits will add numbering for "open problem" blocks, partly as a
tutorial on how to support new blocks (which I was afraid to do before).
The sample article now builds as HTML for me in 4 seconds, rather than 5
seconds. The XSL itself is about 25% faster (thanks Andrew for the profiling
tools!). This is due in part to the sample article having extensive examples of
#xref (which would recompute numbers before). But other examples (e.g. sample
book), show gains of 10-15% or so. So some real improvement, and lots of old
bad code is gone.
We now have (optional) separate (distinct) counters for blocks: figure-like,
project-like, inline exercise, and soon for "open problems". And rational
publisher entries to match, plus documentation. I feel like that is enough.
There is now a "numbering test document." This was written by Claude AI, for
use by Claude AI. But it is worth knowing about - lots of structure, lots of
numbered objects (many in oddball places), and just enough context so Claude
does not get lost (I do, it is a mess!). Recent changes sometimes involved over
100 builds to check before/after, and HTML/PDF differences across many varied
sets of publisher options for numbering.
The numbering code got moved around to different stylesheets and an xsl:import
is now a xsl:include. That all seems fine, but problems there are sometimes
hard to see in advance. Claude was a lot of help with this, organizing a
sequnce of commits that allowed for careful testing at each step.
Holler if you see any odd behavior, and we'll keep an eye on pretext-support.
Rob