civilytics-reveal: PDF output has no slide margins (print-pdf overrides section padding) #25

Open
opened 2026-09-25 16:07:55 -04:00 by jared · 0 comments
Owner

Problem

Decks rendered with civilytics-reveal and printed to PDF (reveal.js ?print-pdf, or headless Chrome Page.printToPDF) have no side margins. Titles, tables and bullets run to the page edge, even though the HTML view looks right.

Cause

civilytics.scss pads every slide:

.reveal .slides > section,
.reveal .slides > section > section {
  padding: 48px 72px;
  ...
}

reveal.js's print-pdf stylesheet then overrides section padding with !important, so the theme's padding is lost in print. Found 2026-09-25 on version 1.0.0 of the extension (civilytics 0.3.1).

Fix used in a deck (deck-local CSS)

html.print-pdf .reveal .slides section,
html.reveal-print .reveal .slides section {
  padding: 32px 56px !important;
  box-sizing: border-box !important;
}
html.print-pdf .reveal .slides section.stack,
html.reveal-print .reveal .slides section.stack {
  padding: 0 !important;
}

Notes for the upstream fix

  • Restoring the full 48px 72px in print pushed three text-dense slides of a 29-slide deck onto extra pages. 32px 56px kept every slide on one page. The print value may need to be smaller than the screen value, or a variable decks can override.
  • The rule belongs in quarto/extensions/civilytics-reveal/civilytics.scss.
  • Check the title slide and section.stack (vertical slides) after the change.
  • Verify by rendering to PDF and viewing the pages. The HTML view does not show the bug.
## Problem Decks rendered with `civilytics-reveal` and printed to PDF (reveal.js `?print-pdf`, or headless Chrome `Page.printToPDF`) have no side margins. Titles, tables and bullets run to the page edge, even though the HTML view looks right. ## Cause `civilytics.scss` pads every slide: ```scss .reveal .slides > section, .reveal .slides > section > section { padding: 48px 72px; ... } ``` reveal.js's print-pdf stylesheet then overrides section padding with `!important`, so the theme's padding is lost in print. Found 2026-09-25 on version 1.0.0 of the extension (civilytics 0.3.1). ## Fix used in a deck (deck-local CSS) ```css html.print-pdf .reveal .slides section, html.reveal-print .reveal .slides section { padding: 32px 56px !important; box-sizing: border-box !important; } html.print-pdf .reveal .slides section.stack, html.reveal-print .reveal .slides section.stack { padding: 0 !important; } ``` ## Notes for the upstream fix - Restoring the full `48px 72px` in print pushed three text-dense slides of a 29-slide deck onto extra pages. `32px 56px` kept every slide on one page. The print value may need to be smaller than the screen value, or a variable decks can override. - The rule belongs in `quarto/extensions/civilytics-reveal/civilytics.scss`. - Check the title slide and `section.stack` (vertical slides) after the change. - Verify by rendering to PDF and viewing the pages. The HTML view does not show the bug.
jared added the
ws
quarto
type
defect
labels 2026-09-25 16:07:55 -04:00
Sign in to join this conversation.
No labels
type
defect
ws
quarto
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Civilytics/civilyticsR#25