Skip to content

XSL-FO: render captions as run-in paragraphs, not centered#2966

Merged
rbeezer merged 1 commit into
PreTeXtBook:masterfrom
rbeezer:fo-caption-alignment
Jun 23, 2026
Merged

XSL-FO: render captions as run-in paragraphs, not centered#2966
rbeezer merged 1 commit into
PreTeXtBook:masterfrom
rbeezer:fo-caption-alignment

Conversation

@rbeezer

@rbeezer rbeezer commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

In the XSL-FO → PDF route, a figure-like block's caption — a figure's caption, and the title of a table, listing, or list — was set in a text-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-alignmentjustify, or start when 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 the p template's preceding-sibling::p rule, and a caption holds inline content, so there are no paragraphs within it to indent.

Testing

Sample article: the figure-long-caption test (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 centered

Claude Opus 4.8, acting as a coding assistant for Rob Beezer

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rbeezer rbeezer merged commit efa08e3 into PreTeXtBook:master Jun 23, 2026
@rbeezer rbeezer deleted the fo-caption-alignment branch June 23, 2026 21:41
@rbeezer

rbeezer commented Jun 23, 2026

Copy link
Copy Markdown
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

rbeezer commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator Author

While fixing #2937, I messed up #2966 here via a force-push. So the initial reported merge is gone, and I have re-done it as fb8d9b4, which is the most recent report.

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