XSL-FO: render captions as run-in paragraphs, not centered#2966
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
Author
|
That Table of Contents commit was a mistake, it was meant to be part of #2937, and it should be gone now after a force-push. |
rbeezer
added a commit
that referenced
this pull request
Jun 23, 2026
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the XSL-FO → PDF route, a figure-like block's caption — a
figure'scaption, and the title of atable,listing, orlist— was set in atext-align="center"block. A short caption survives this, but a long one renders as awkward centered, ragged, multi-line text. A caption is really a paragraph and should follow the same rules: a bold run-in heading (the type name and number) leading body-aligned prose.This switches that block to the document's body alignment (
$text-alignment—justify, orstartwhen ragged-right), so the bold "Figure 5.3." / "Table 5.1." becomes a true run-in heading and the caption sets as ordinary prose. The paragraph following the figure already indents correctly via theptemplate'spreceding-sibling::prule, and acaptionholds inline content, so there are no paragraphs within it to indent.Testing
Sample article: the
figure-long-captiontest (Figure 10.31) now reads as a justified paragraph led by a bold "Figure 10.31." run-in heading, rather than a centered ragged block; short captions and the table/listing/list titles get the same flush run-in treatment. veraPDF--flavour ua1: 106 passed / 0 failed.Commits
XSL-FO: render captions as run-in paragraphs, not centeredClaude Opus 4.8, acting as a coding assistant for Rob Beezer