Skip to content

tabular: \noalign contributes its vertical material (tex.web §785) - #598

Merged
tannevaled merged 1 commit into
mainfrom
parity-noalign
Oct 10, 2026
Merged

tannevaled merged 1 commit into
mainfrom
parity-noalign

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

Two parsers read alignments in this engine, and only one of them honoured
\noalign. halign.go has implemented it since a TikZ node needed it; the
tabular parser — which collects the whole body as tokens before building any of
it — dropped both the command and its group.

The census of skipped commands puts it at 64 uses over 8 papers of the
fidelity corpus, almost all of them one idiom:

\hline\noalign{\vskip .5mm}

so those tables sat tighter than the reference's by a skip per use.

tex.web §785 makes the group vertical material contributed to the list
between the rows, and that is where it now goes. The group is a real group, as
§785 opens one, so a \vskip or a font change inside it stops at it.

Measured against the reference

A witness with \vskip 10pt after an \hline, first row's baseline:

without with shift
tectonic 133.57 143.53 9.96bp
gotex 133.55 143.51 9.96bp

9.96bp is 10pt read in big points, and the absolute positions agree to 0.02bp.

The expectation written into the test is that measurement, not a number I chose.

Tests

Two, each checked with mutate against the half it covers:

mutation caught
the body collects the \noalign and never emits it ✓
the body does not collect it at all ✓

The second test is the one that matters beyond the skip: an empty \noalign, or
one with no group, must leave the table and the rest of the document standing.
A parser that mistakes either for a data row builds a row of no cells — which is
exactly how a missing \noalign once took the remainder of a document with it
(see scanNoalign's own note).

🤖 Generated with Claude Code

Two parsers read alignments here, and only one of them honoured \noalign.
halign.go has implemented it since TikZ needed it; the tabular parser, which
collects the whole body as tokens before building any of it, dropped both the
command and its group. The census of skipped commands put it at 64 uses over
8 papers of the fidelity corpus, almost all of them one idiom:

    \hline\noalign{\vskip .5mm}

so those tables sat tighter than the reference's by a skip per use.

tex.web §785 makes the group VERTICAL material contributed to the list
between the rows, and that is where it now goes. The group is a real group,
as §785 opens one, so a \vskip or a font change inside it stops at it.

Measured against the reference on a witness with \vskip 10pt after an \hline,
first row's baseline:

            without   with    shift
    tectonic  133.57  143.53   9.96bp
    gotex     133.55  143.51   9.96bp

9.96bp is 10pt read in big points, and the absolute positions agree to
0.02bp.

Two tests, each proved to fail without the fix (mutate): the table grows by
exactly the skip, and an empty \noalign — or one with no group — leaves the
table and the rest of the document standing, which is the failure mode a
missing \noalign produced in a TikZ node.

Co-Authored-By: Claude Opus 5 <[email protected]>
@tannevaled

Copy link
Copy Markdown
Contributor Author

Correction: the fix removes 19 of those 64 uses, not all of them

I quoted the census figure — 64 uses over 8 papers — where a reader takes it for
what this change removes. Measured, with measure skipsweep over exactly those 22
corpus papers, before and after:

before   \noalign   8 papers   64 uses
after    \noalign   6 papers   45 uses

So this covers 2 papers and 19 uses: the ones that write \noalign in a
tabular, which is what this parser reads. The other 45 come from somewhere else
entirely, and none of those six papers writes \noalign in its own source at all —
it arrives by expansion from the IEEEtran.cls they ship:

IEEEtran.cls:3730   \noalign{\penalty\@eqpen\vskip\jot\vskip #1\relax}}
IEEEtran.cls:3938   \cr\noalign{\if@IEEEeqnarrayboxnojot\else\vskip\jot\fi\vskip#1\relax}
IEEEtran.cls:4650   \def\@IEEEauthorblockNtopspaceline{\cr\noalign{\vskip…}}
IEEEtran.cls:4714   \def\@@@IEEEauthorhaligncr[#1]{\ifnum0=`{\fi}\cr\noalign{\vskip#1\relax}}

Those are \halign-based constructs — \IEEEeqnarray and the author block — and
halign.go does implement \noalign. So the remaining 45 are a different
defect: the engine substitutes its own \IEEEauthorblockN/A (packages.go:1476) and
has its own \IEEEeqnarray strut handling, and these \noalign tokens reach a
point where no alignment is open. That wants its own issue and its own witness, not
a wider claim here.

The rest of this PR stands as measured: the witness shifts by 9.96bp on both sides,
and the two tests still fail without their half of the fix.

This is my own rule caught late — a frequency rank is a rank of candidates, and
I printed one as an effect.

🤖 Generated with Claude Code

(Localised further in #602.)

@tannevaled
tannevaled merged commit 32d55c9 into main Oct 10, 2026
18 checks passed
@tannevaled
tannevaled deleted the parity-noalign branch October 10, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant