Attach heading labels that follow on the next line

A \label on the line after \section without a blank line was discarded with the
rest of the text after the heading's closing brace, so \ref printed "??".
heading_command now keeps any immediately following \label groups (allowing
whitespace/newlines) in the heading text, which lets the numbering pass attach
them to that heading; other trailing text is still ignored as before.

A preview test puts \label{sec:intro} directly under \section{Introduction},
refers to it, and checks "See 1." with no warnings and no "??".
This commit is contained in:
gloamxun committed 2026-10-27 02:27:17 +08:00
1 parent 723b9e220f
commit d3baa78e1e
4 files changed
+45 -8

No files matched your search

+2 -2
View File
@@ -14,12 +14,12 @@ cargo fmt --all -- --check
cargo test --workspace --offline
```
The workspace currently passes **1028 tests**:
The workspace currently passes **1029 tests**:
| Suite | Tests |
| --- | --- |
| route-D unit (engine) | 437 |
| engine binary unit | 399 |
| engine binary unit | 400 |
| server integration | 63 |
| v1 integration | 71 |
| pdfLaTeX oracle | 42 |