Start chapters on a new page
This commit is contained in:
1 parent
a798221817
commit
5a54386dee
5 files changed
+16
-6
No files matched your search
@@ -490,7 +490,7 @@ advisory breaks, starred `\vspace`/`\hspace`, `center`, `\hrule`, `\fbox`,
|
|||||||
| Notes/floats | footnotes with page-bottom insertion area, title/author `\thanks`, figure/table `[htbp]` placement (top/bottom/page/here approximations) | deferred float queue, `\textfraction` |
|
| Notes/floats | footnotes with page-bottom insertion area, title/author `\thanks`, figure/table `[htbp]` placement (top/bottom/page/here approximations) | deferred float queue, `\textfraction` |
|
||||||
| Contents | `\tableofcontents`, `\listoffigures`, `\listoftables` generated from numbered headings and captions, dotted leaders, page numbers resolved after pagination | per-chapter book/report contents |
|
| Contents | `\tableofcontents`, `\listoffigures`, `\listoftables` generated from numbered headings and captions, dotted leaders, page numbers resolved after pagination | per-chapter book/report contents |
|
||||||
| Pages | A4/Letter/... page sizes, margins/geometry, automatic pagination, `\newpage`, `\pagebreak`, plain/fancy page styles, `\thispagestyle`, fancyhdr L/C/R headers and footers | — |
|
| Pages | A4/Letter/... page sizes, margins/geometry, automatic pagination, `\newpage`, `\pagebreak`, plain/fancy page styles, `\thispagestyle`, fancyhdr L/C/R headers and footers | — |
|
||||||
| Classes/packages | built-in + local classes, option protocol, local package options, base font sizes 10/11/12pt, chapter headings and numbering | class-specific formatting (automatic chapter page breaks) |
|
| Classes/packages | built-in + local classes, option protocol, local package options, base font sizes 10/11/12pt, chapter headings and numbering, chapter page breaks | class-specific formatting beyond chapter breaks |
|
||||||
| Live preview | incremental paragraph cache, page-hash diffing, SVG refresh | — |
|
| Live preview | incremental paragraph cache, page-hash diffing, SVG refresh | — |
|
||||||
|
|
||||||
The compatibility layer also covers spacing macros, text symbols/letters, style
|
The compatibility layer also covers spacing macros, text symbols/letters, style
|
||||||
|
|||||||
@@ -1262,6 +1262,9 @@ impl Parser {
|
|||||||
let level = level.min(3);
|
let level = level.min(3);
|
||||||
if level == 0 {
|
if level == 0 {
|
||||||
self.has_chapters = true;
|
self.has_chapters = true;
|
||||||
|
if !self.document.blocks.is_empty() {
|
||||||
|
self.push_block(Block::PageBreak);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let runs = if numbered {
|
let runs = if numbered {
|
||||||
let number = self.next_section_number(level);
|
let number = self.next_section_number(level);
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ styles (plain/fancy, `\thispagestyle`, fancyhdr headers/footers, `\thepage`);
|
|||||||
geometry-aware `\textwidth`/`\textheight` named length registers; table of
|
geometry-aware `\textwidth`/`\textheight` named length registers; table of
|
||||||
contents and figure/table lists with dotted leaders; native PDF rectangles; unified pagination;
|
contents and figure/table lists with dotted leaders; native PDF rectangles; unified pagination;
|
||||||
`\centering`/`\raggedright`/`\raggedleft` declarations and environments;
|
`\centering`/`\raggedright`/`\raggedleft` declarations and environments;
|
||||||
chapter headings with chapter-prefixed section numbering
|
chapter headings with chapter-prefixed section numbering and page breaks
|
||||||
(`build_positioned_pages` is the only page builder and no separate break
|
(`build_positioned_pages` is the only page builder and no separate break
|
||||||
planner remains).
|
planner remains).
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -38,7 +38,8 @@ the source changes; the SVG preview is refreshed per page.
|
|||||||
figures/tables, with dotted leaders and page numbers resolved after
|
figures/tables, with dotted leaders and page numbers resolved after
|
||||||
pagination.
|
pagination.
|
||||||
- Chapters: `\chapter` is a level-0 heading; chapter numbers prefix section
|
- Chapters: `\chapter` is a level-0 heading; chapter numbers prefix section
|
||||||
numbers (`1.1`, `1.1.1`) and reset lower counters.
|
numbers (`1.1`, `1.1.1`) and reset lower counters. Chapters after the first
|
||||||
|
block start on a new page.
|
||||||
- Class sizes: 10pt/11pt/12pt set the body size and propagate through
|
- Class sizes: 10pt/11pt/12pt set the body size and propagate through
|
||||||
headings, title material, lists, tables, block boxes, footnotes, and the
|
headings, title material, lists, tables, block boxes, footnotes, and the
|
||||||
default paragraph indent (10/12pt use 15pt; 11pt uses 17pt).
|
default paragraph indent (10/12pt use 15pt; 11pt uses 17pt).
|
||||||
@@ -66,8 +67,7 @@ See `docs/ROADMAP.md` for concrete implementation plans.
|
|||||||
collected; the insertion area currently follows the page where the paragraph
|
collected; the insertion area currently follows the page where the paragraph
|
||||||
ends rather than the exact reference line.
|
ends rather than the exact reference line.
|
||||||
- Contents: chapter headings are listed with chapter-prefixed section
|
- Contents: chapter headings are listed with chapter-prefixed section
|
||||||
numbers, but contents are not split per chapter and `\chapter` does not
|
numbers, but contents are not split per chapter.
|
||||||
force a page break.
|
|
||||||
- Miscellaneous: a document-level `\renewcommand{\maketitle}` is ignored in
|
- Miscellaneous: a document-level `\renewcommand{\maketitle}` is ignored in
|
||||||
favor of the engine title block.
|
favor of the engine title block.
|
||||||
|
|
||||||
|
|||||||
+8
-1
@@ -966,7 +966,14 @@ fn chapter_headings_number_sections_and_enter_contents() {
|
|||||||
"#;
|
"#;
|
||||||
let value = fresh_preview(source, "chapters.tex");
|
let value = fresh_preview(source, "chapters.tex");
|
||||||
assert_eq!(value["status"], "ok", "{}", value["message"]);
|
assert_eq!(value["status"], "ok", "{}", value["message"]);
|
||||||
let svg = page_svg(&value, 0);
|
assert!(
|
||||||
|
pages(&value).len() >= 2,
|
||||||
|
"chapters did not start on a new page: {value}"
|
||||||
|
);
|
||||||
|
let svg = (0..pages(&value).len())
|
||||||
|
.map(|index| page_svg(&value, index))
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join("");
|
||||||
for needle in [
|
for needle in [
|
||||||
"Contents", "First", "Chapter", "Alpha", "Beta", "Gamma", "1.1", "1.1.1", "2.1",
|
"Contents", "First", "Chapter", "Alpha", "Beta", "Gamma", "1.1", "1.1.1", "2.1",
|
||||||
] {
|
] {
|
||||||
|
|||||||
Reference in new issue
Block a user