Skip to content

Solution page breaks - #3193

Open
kylemonette wants to merge 2 commits into
PreTeXtBook:masterfrom
kylemonette:solution-page-breaks
Open

Solution page breaks#3193
kylemonette wants to merge 2 commits into
PreTeXtBook:masterfrom
kylemonette:solution-page-breaks

Conversation

@kylemonette

Copy link
Copy Markdown
Contributor

Commit 1: js/src/pretext-printouts.js:

Fixes addSpilloverPages() incorrectly splitting a page mid-question when repaginating an authored-page worksheet or handout after a solution is revealed. The retreat loop that searches for a legal page break stopped one row too early, so a candidate split right after the first content row was never validated and could open a new page with blank writing space or separate a question from its own solution. The fix checks that candidate like any other, and adds a fallback: when no legal split exists before the point of overflow (an oversized question/solution/workspace group), it searches forward for the next legal boundary instead, isolating the oversized group onto its own page rather than producing an illegal split or leaving the layout stuck.

Commit 2: css/targets/print-worksheet/print-worksheet.scss:

Fixes a Safari-only bug (as far as I know) where printing (or generating a PDF from) a worksheet or handout inserts a blank page after every page. .onepage was given a fixed height equal to the printable area, computed independently of the browser's own @page-margin-derived page height. A small rounding disagreement between the two causes Safari to paginate the tiny overflow onto its own blank page. Switching .onepage to height: auto lets it size to its already-correctly-paginated content instead of a second, independently-rounded height, removing the mismatch. break-after/break-inside are added alongside the existing page-break-* properties for broader engine support.

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.

2 participants