Skip to content

Place the PolicyEngine wordmark in the PDF and HTML title blocks - #2

Draft
MaxGhenis wants to merge 1 commit into
mainfrom
wordmark-title-blocks
Draft

MaxGhenis wants to merge 1 commit into
mainfrom
wordmark-title-blocks

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

Status: draft. It moves out of draft once the new Check workflow passes on both Quarto versions and a GPT-6.1 Sol review agrees.

Problem

theme-policyengine.yml declares wordmark: assets/policyengine-wordmark.svg, but no partial reads it, so neither policyengine-paper-pdf nor policyengine-paper-html ever placed the logo. The SVG was also invalid XML. Line 2's comment contained --primary, and XML forbids a double hyphen inside <!-- -->, so xmllint and rsvg-convert both rejected it ("Double hyphen within comment").

PolicyEngine/crfb-m4a@77ab70f worked around this locally. It added a converted PDF and a per-document policyengine-wordmark-pdf key in a vendored title.tex. This PR fixes it upstream.

Change

  • SVG: the comment now says "the primary token" and names its source, policyengine-ui-kit/src/assets/logos/policyengine/teal.svg. The path data is unchanged and identical to ui-kit f6a462b.
  • Vector PDF asset: assets/policyengine-wordmark.pdf is built from the SVG by scripts/build-wordmark-pdf.sh (rsvg-convert, SOURCE_DATE_EPOCH pinned, so the output is byte-stable for a given cairo). It is listed under the PDF format-resources, so xelatex includes it with no conversion at render time. The SVG is an HTML format-resource. Quarto copies format resources beside the document by basename. The theme therefore names the copies: wordmark-pdf, wordmark-svg and wordmark-alt replace the unused wordmark path.
  • PDF title block: \includegraphics[height=0.3in,alt={PolicyEngine}] above the kicker. before-title.tex loads graphicx, because Quarto's template loads it only under its graphics variable.
  • HTML title block: <img class="policyengine-wordmark" src="policyengine-wordmark.svg" alt="PolicyEngine"> above the kicker, styled 2.25rem tall in policyengine.scss.
  • Opt-out: both formats default to wordmark: true. wordmark: false omits the wordmark from a document, or from one format when set under that format.
  • Byline: while the wordmark shows, it replaces the theme's fallback "PolicyEngine" affiliation line, which prints only when no author lists an affiliation. Author affiliations always print. With the wordmark off, the fallback byline returns. The HTML no longer emits an empty policyengine-affiliations div.
  • Docs: the README documents the key, the copied files and the rebuild step. example/paper.qmd sets wordmark: true with a comment.
  • CI: the repo had no checks. scripts/check.sh and .github/workflows/check.yml now run on Quarto 1.7.34 (the declared quarto-required floor) and 1.10.19 (current stable).

Properties checked (scripts/check.sh)

  1. Every tracked SVG parses as XML.
  2. The committed PDF depicts the SVG. Both are rasterized at the SVG's size and differing pixels are counted at 10% fuzz. Locally 115 of 206,172 differ (0.06%, antialiasing). The threshold is 0.5%, and a blank or mirrored wordmark differs on 10–18%.
  3. Example (author affiliation): the wordmark is in both formats, the SVG sits beside the HTML, and the author affiliation prints.
  4. No affiliation: the wordmark is in both formats and neither has the fallback byline.
  5. wordmark: false: no wordmark in either format, and the fallback byline prints in both.
  6. wordmark: false under policyengine-paper-pdf only: no wordmark in the PDF, wordmark in the HTML.
  7. embed-resources: true: the wordmark is inlined as a data:image/svg+xml URI with no link to the file.
  8. The base policyengine-html format places the wordmark.
  9. A website project with output-dir copies the SVG beside the rendered page.

Mutation runs confirm the script fails when the double hyphen is restored, when the PDF drifts, when title.tex drops the wordmark, and when the HTML ignores the opt-out.

Verification

  • scripts/check.sh passes locally: 29/29 on Quarto 1.9.36, pandoc 3.8.3, TeX Live 2026.
  • The example was rendered and inspected visually. In the PDF at 300 dpi, the wordmark is vector, flush with the text margin, and 0.3in above the kicker. The HTML was checked in a browser at 1024px and 375px widths: the SVG loads at 996×207, renders at 184×38px, aligns with the kicker and title, and causes no horizontal scroll.
  • The status-rule colour is unchanged (#2C7A7B before and after).

Known gap, not changed here

The base extension's policyengine-pdf format already fails on main, before this change. Quarto resolves its policyengine-font-dir: fonts to ../_extensions/policyengine/fonts, pandoc escapes the underscore to \_, and fontspec cannot load the fonts ("Missing \begin{document}"). The policyengine-paper-pdf format is unaffected, because fonts does not exist relative to that extension. scripts/check.sh therefore renders only the base HTML format. A follow-up will fix the base PDF format.

axiom: n/a: Quarto document format, no policy logic

🤖 Generated with Claude Code

The theme declared a wordmark that neither title partial used, and the
SVG was invalid XML: its comment contained "--primary", which XML
forbids inside <!-- -->, so rsvg-convert refused the file.

- Reword the SVG comment and record the ui-kit source file.
- Ship a vector policyengine-wordmark.pdf, built by
  scripts/build-wordmark-pdf.sh and listed under the PDF
  format-resources, so xelatex includes it with no conversion at render
  time. The SVG is an HTML format-resource.
- Both title blocks place the wordmark above the kicker by default.
  `wordmark: false` omits it, for a document or for one format. While
  it shows, it replaces the theme's fallback "PolicyEngine" byline.
- before-title.tex loads graphicx, which Quarto's template loads only
  under its `graphics` variable.
- scripts/check.sh validates the SVGs, checks that the PDF still
  matches the SVG, and renders the example plus opt-out, per-format,
  embedded, base-format and website cases. A new Check workflow runs it
  on Quarto 1.7.34 and 1.10.19.
- README and example/paper.qmd document the key and the copied files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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