feat(docrender): bundle nasa, ieee and acm themes and fix the PDF default font stack - #561
Merged
Merged
Conversation
… families The print and pandoc stylesheets asked for bare serif, sans-serif and monospace, which fontconfig resolves to DejaVu on most Linux machines while the Times-metric Liberation faces installed beside it go unchosen. The default body, heading, code and page-number stacks now name the conventional families, their metric-compatible free equivalents and the generic family last. Sizes, margins and page size are unchanged; print.css also declares the opensysml-print-theme layer a theme's print companion fills. Co-Authored-By: jason.han <hanhuijun@gmail.com>
A theme may carry themes/<name>.print.css, laid by the PDF backend over its print sheet in the opensysml-print-theme layer so the theme's page size, margins, faces, body size, heading scale and footer reach paper. Themes() leaves companions out of the public list. nasa, ieee and acm follow the NASA STI, IEEE Transactions and ACM acmart conventions; print and report gain companions so their print faces and sizes now print. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Usage text, manual page, CLI reference, outputs manual and the backend design note name every bundled theme, the print-companion cascade order, the sources and choices behind nasa, ieee and acm, and their limits; changelog fragments for the themes and the default font stack. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Theme discovery lists the seven themes and no companion; each convention theme's tokens are asserted; a fake-tool test pins default/theme, print sheet, companion, KaTeX, reader order and that -html-no-default-css drops every bundled sheet; installed-toolchain tests read /BaseFont, MediaBox and the body size back from the PDF for the default and each theme. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
…onvention-themes Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # internal/doc/docpdf/integration_test.go # internal/doc/docrender/html_test.go
devin-ai-integration
Bot
changed the base branch from
develop
to
feature/positioned-label-fitting
September 24, 2026 06:34
…' into feature/document-convention-themes
…n without a title page The acm theme documented 9pt tables but sized only the landscape wide-table path; an ordinary table stayed at the 10pt body. A --sysml-table-font-size token now applies to every acm table in HTML and PDF. The nasa companion reset the page counter on the first main page, which was the bare title heading when a contents list was asked for without a title page: the title counted 1, the contents ii and the body continued at 3. The title heading leading a contents list now shares its front page, and the article itself is the main page, so running text ahead of the first section opens the body at 1. Installed-toolchain tests read the table size back under each convention theme and the footer sequence back from a nasa report under every title-page and contents combination. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ptions in the convention's face The nasa companion kept the page counter for the front matter and reset it on the first main page, so a body opening on a landscape wide page printed the physical page number and the next portrait page restarted at 1. The cover and front pages now leave the page counter at 0 and count in roman on a front counter, so the body opens at 1 whichever named page it starts on. nasa table captions take the sans face like the rest of the table; acm captions take the text face acmart sets them in. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Base automatically changed from
feature/positioned-label-fitting
to
develop
September 24, 2026 13:31
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.
Stacked on #560; merge that first.
What and why
Two faults in the PDF form of
-render-document, and three new themes on top of the fix.The PDF default was set in DejaVu.
internal/doc/docpdf/print.cssasked for bareserif,sans-serifandmonospace. fontconfig resolves those to DejaVu on most Linux machines (fc-match serif→ DejaVu Serif), a face some 15 % wider and taller than Times at the same nominal size, so an 11pt page read like 13pt — while the Times-metric Liberation Serif installed beside it was never chosen because nothing named it. The default stacks now name the conventional families first, their metric-compatible free equivalents next and the generic family last:The same stacks go into
pandoc.css(body, headings, code and the page-number footer, which was the one place DejaVu still leaked through). Page size, margins and every point size are unchanged; the HTML sheet keepssystem-ui, a system face being the deliberate default for a page.A theme could not govern the PDF page.
print.csssits in@layer opensysml-print, declared after the theme'sopensysmllayer, so its--sysml-font-size: 11pt, faces and heading scale won over any theme's. Rendering-html-theme report -doc-form pdfondevelopconfirmed it:/BaseFontDejaVu Serif, body 11pt — the theme's Charter/Georgia stack and 1.0625rem body never reached the page. The fix is a print companion: a theme may carrythemes/<name>.print.css, one block of@layer opensysml-print-theme, whichprint.cssdeclares after its own layer (@layer opensysml-print, opensysml-print-theme;) and whichdocpdf.htmlOptionsinlines right after the print sheet through the newdocrender.ThemePrintStylesheet(name). A companion writes:rootpage tokens,@pagerules and page-margin boxes, and.sysml-documenttokens, so it controls page geometry, typography, captions, tables, heading scale and the page-number footer.Themes()filters companions out of the public list andThemeStylesheetrefuses their names. The cascade for an HTML-input engine is-html-no-default-cssleaves the default sheet, the print sheet and the companion out together; the pandoc engine still refuses-html-themeand-html-no-default-csswith the typedunsupported-optionerror.printandreportgain companions carrying the tokens their sheets already set, so what they always meant for paper now prints.Three convention themes,
nasa,ieeeandacm, each a<name>.cssplus<name>.print.css. All three are black on white (--sysml-text,--sysml-accent,--sysml-ruleblack,--sysml-surfacetransparent), rule tables with thin horizontal lines only, title tables above and caption figures below, set code in Courier/Liberation Mono, leave the measure unconstrained on paper, and set the same faces and point sizes on screen as on paper so a page and its PDF agree. The public theme list isdefault, acm, ieee, modern, nasa, print, report.nasacover(unnumbered), contentsfront(lower-roman), first body page resets the counter to 1ieeeacmacmart), https://www.acm.org/publications/proceedings-template"Libertinus Serif", "Linux Libertine O", "Linux Libertine", "Times New Roman", "Liberation Serif", serif; sans"Libertinus Sans", "Linux Biolinum O", "Linux Biolinum", Arial, Helvetica, "Liberation Sans", sans-serif); 10pt body; letter page; numbered bold sans headings; 9pt captions in the body face; single-columnacmsmall/manuscriptstyles existacmartsets it; 9pt tables and page numbersDocs:
docs/reference/cli.md(flag row, theme list, layer order),docs/manual/outputs.md(theme table, three-layer cascade),docs/project/html-document-backend.md(new Bundled themes section with the sources and choices above, the companion mechanism, the limits),cmd/sysml/usage.goand the regeneratedpackaging/man/man1/sysml.1. Changelog fragmentsdocument-convention-themes.added.mdandpdf-default-font-stack.fixed.md.Known limits
ieeeandacm. IEEE Transactions are two 3.5 in columns; migrated tables and wide diagrams do not fit one, soieeeis a single-column manuscript of a two-column journal. ACM'sacmsmall/manuscriptstyles are single-column, soacmis a layout ACM itself publishes.sysml-section-numberand the contents list repeats it, so CSS can neither restyle that text as roman nor replace it with a counter without hiding the number the markup carries.ieeekeeps arabic numbers rather than faking roman ones.nasastyles the existing title-page block and invents nothing. Its roman front matter covers the pages the markup can name (title page, contents); a render without-doc-title-page/-doc-tocsimply has fewer of them.acmfalls through to Times metrics (Liberation Serif on Linux) where it is absent — the documented fallback, as the evidence below shows.Specification basis
Not a SysML behaviour change; no row of
docs/project/spec-compliance.mdmoves. The typographic values are those the sources named above state, and each value not stated by a source is recorded as a choice indocs/project/html-document-backend.md.How it was verified
New and updated tests:
internal/doc/docrender/html_test.go—Themes()lists the seven themes and no.print.csscompanion;ThemePrintStylesheetreturns a companion foracm,ieee,nasa,print,report, none fordefault/modern, an error for an unknown name; each companion is one@layer opensysml-print-themeblock whose selectors are:root,.sysml-document…or@page; each convention theme sets its font stacks, body size, caption/table sizes, page size and margin, black-on-white tokens and thin horizontal rules;-html-default-cssoutput never contains a companion.internal/doc/docpdf/docpdf_test.go— fake-tool test pins the page handed to WeasyPrint:@layer opensysml→ theme sheet →@layer opensysml-print→ companion inlined whole → KaTeX link → reader inline → reader link, each once, andNoDefaultStylesheetdrops every bundled sheet while keeping the reader's; the print sheet contract test expects@layer opensysml-print, opensysml-print-theme;.internal/doc/docpdf/integration_test.go—TestRenderThemesWithInstalledEnginesrenders the telescope fixture and a prose fixture under the default and each theme, and reads back from the PDF bytes (Go only, flate streams inflated): MediaBox (A4 vs letter),/BaseFontnames (Times/Arial/Courier-compatible, no DejaVu) and the dominant text size (11/11/12.8/12/10/10pt). A control renders the generic-family stack and asserts DejaVu does appear, so the check is load-bearing. Pandoc is asserted to refuse-html-themewith the typed error.cmd/sysml/render_document_html_test.go— invalid-theme message lists all seven.Gates, all clean:
go build ./...,go vet ./...,gofmt -l .(empty),go test ./...,make lint,make docs-check(links, doc-ids, figures, changelog, census),make man && make man-check, andEvidence
Observatory::MassReportrendered frominternal/doc/docrender/testdata/telescope_report.sysml(telescope) anddocs/manual/examples/observatory.sysml(worked example) with-pdf-title-page -pdf-toc -pdf-number-sections, read back with pypdf. "Body size" is the size most extracted glyphs are set at; for the telescope fixture underieeethat is the 8pt of its many tables and captions (paragraph text is 10pt, 634 glyphs against 728), and forreport12.8pt is 1.0625rem at the 12pt root./BaseFont(subset prefixes stripped)develop)report, before (develop)nasaieeeacmreportnasaieeeacmreportThe
nasaPDF's footers read (title page) nothing, (contents)ii, (body)1,2,3— checked withpdftotextpage by page.First two pages of the telescope fixture (pypdfium2, scale 1.3):
Default, before:
Default, after:
nasa:ieee:acm:report:HTML output of the same fixture in Chrome, so screen and paper agree (
nasa12pt Times-compatible body with bold sans heads;ieee10pt body, centred small-caps heads, 8pt tables and captions;acm10pt body in the Times-metric fallback, bold sans heads, 9pt captions):nasa:ieee:acm:Checklist
make testandmake lintpass locallychanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (compliance rows need nothing: the census is counted at docs build)F4,K5) in the body, docs, or changelog