Repository navigation
Give a presentation's [[!style]] the size of its text - #422
Merged
Merged
Conversation
A deck's text was one size, and a slide that did not fit could only be
cut down. [[!style]]{size=small|normal|large} sets a factor of every font
size on a slide in the browser and the class's size in points in the
Beamer PDF; normal is today's size in both, and the editor warns of a
size it does not know (WP5.147 of docs/PLAN.md).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
A browser example: the same slide at small, normal and large, its text by 9/11 and 12/11 and its box unchanged, and its fit marked again. Fixes of the render tests' imports, and the formatter's order. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
The measure behind the choice: what a slide of filler text holds at each size, in the PDF and in the browser. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
On a slide a listing with rows=N, a code block's copy button and an interactive SVG's download link had sizes fixed in rem, so they kept their size while the text around them changed. They take the deck's factor now, the same at the normal size. The listing's height cap is in its own lines, so it follows. Also: the preview's test gives the new measureFits field (#418), and the detached preview's test checks the size's class on the window's deck. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
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.
WP5.147, first step: the size of a presentation's text, for the whole deck. The owner asked whether the size of the text in presentations can be set, and chose the whole deck first, with a size for one slide or a piece of one to follow.
What is built
[[!style]]{theme=dark aspect=4:3 size=small}: a third attribute,size, withsmall,normal(today's size, the default) andlarge.TextSize = SmallText | NormalText | LargeText, asizefield inDeckOptions, read as the other two attributes are (any case, blanks around).slides-size-small,-normalor-large(deckClasses, so every place a deck is drawn has it: the viewer, the prerender, the editor's preview in both modes, the detached preview, an embedded deck). The stylesheet sets--slide-text-factorto 9/11 for small and 12/11 for large; the slide's four base sizes (title, body, footer, the title slide's title) multiply by it, and everything sized in em inside them follows (code, tables, footnotes, formulas, paddings). The slide's box and aspect do not change. The factor is inherited, so a later value on one slide can override it.normaladds nothing, so its LaTeX is byte for byte what it was (Beamer's 11pt).docs/markdown.md, which the assistant's reference embeds.Why 9pt and 12pt
Measured with one filler paragraph, in the real export's TeX compiled with xelatex and in Chromium with the stylesheet: characters that fit on a slide.
At 16:9 the browser holds less than the PDF at every size, so a slide that fits in the browser fits in the PDF; 10pt and 14pt would have made the PDF hold relatively less than the browser's small and large do. At 4:3 the browser already held more than the PDF at
normalbefore this change (1427 against 1223), and small widens that a little.Where it differs from the plan's text
sizewarns; theme and aspect are left silent so that existing decks gain no warnings (Slides.unknownOptionsis written so that they can be added).{theme=…}snippet and completes no attribute names, and is unchanged.Known and left
htmlfence's frame and the cap on an image's height do not scale with the size.deckClasses.Tests
\documentclassline for each size.normalis what it was (24.576 px); title, body, footer and inline code at 9/11 and 12/11 of it; the slide's box 1024×576 at all three; the fit changing with the size.normalgiven 11pt (the class line and the pinned LaTeX); a size changing the aspect (the box);normalgiven a factor (the font).Verification
Run locally:
build-native,build-wasm,format,lint; wiki-core's slides and problems groups (110),wiki-core-html-test(211), the assistant's (126); the server's exports with pandoc (156; one PDF example on SQLite failed once under load and passed alone, its PostgreSQL twin passed in the same run); wiki-app's preview, deck viewer, README and guide groups (218); the browser group "A presentation in the editor" alone (73). The whole native wiki-app suite and the other browser groups are left to CI.Codex
main, not from the work:maingained a field onPreview.Input(measureFits, Show a presentation as slides in the detached preview #418) and the branch's new test helper builds the record without it, sowiki-app-testdoes not compile on this head; CI's native jobs are red for that. (2) A code fence withrows=Non a slide has its size fixed inrem, so its text and its cap of lines do not follow the deck's size.Round 1's fixes (d0d3346). The test's helper sets
measureFits(the editor's pane); the whole native tree builds with no warning, and nothing else of the branch touched whatmainhad changed. The detached window draws a deck through the samePreviewnow (#418), so the size's class reaches it; a check of that is added, and the changelog names the window. On a slide, three sizes that were fixed inremmultiply by the factor: a scrolling listing (its text and its cap of N lines), the copy button, the download link of an interactive SVG; atnormaleach is exactly what it was (13.6 px, 12 px, 12.8 px). Left, with reasons: paddings and margins inrem(spacing, which does not follow the slide's width today either), the speaker's notes (not on the slide), Mermaid's drawings and anhtmlfence's frame. Found and left, older than this change: on a slide the code inside a scrolling listing is 0.85em of the listing's size, so the cap of N lines holds about 1.18×N lines of code. The browser's walk has a slide with arows=3listing, which scales with the rest and failed with the rule out. Run locally:build-native(the whole tree),format,lint; the preview's, the deck viewer's and the live preview's native groups (36); the browser group "A presentation in the editor" alone (73).(rounds are added here)
🤖 Generated with Claude Code
https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM