Run AtBeginDocument setup and newgeometry as preamble
Class files such as the arXiv template set the page block inside
\AtBeginDocument{\newgeometry{...}}. Route-D treated the hook body as document
text, so the setup commands were typeset at the top of page one and the page
measure stayed at its default.
Lift \AtBeginDocument bodies in front of \begin{document}, join a multi-line
\newgeometry argument into one line, and read it through the geometry option
parser. Explicit textheight/textwidth options now win over margins, so
textheight=9in with top=1in keeps 9in instead of recomputing it from the
paper height.
The arXiv project now applies its 6.5in/9in block and no longer reports a
\newgeometry warning; unit tests cover the multi-line hook, the option
precedence, and the no-leak case. A remaining leak from multi-line macro
definitions in the same class file is separate work.
This commit is contained in:
1 parent
2f9b18c95c
commit
ebf2070295
3 files changed
+117
-6
No files matched your search
@@ -48,7 +48,7 @@ floats (`\floatsep`, `\textfloatsep`, `\intextsep`, `\topfraction`,
|
||||
`\bottomnumber`, `\totalnumber`), insertion classes (`\skip`, fraction and
|
||||
absolute limits, splitting), marks, Rust output hook, multi-page PDF, and the
|
||||
route-D service endpoints (`/api/route-d/preview|pdf|edit`, project preview and
|
||||
PDF opt-in with `?engine=route-d`). 967 workspace tests are green and no oracle
|
||||
PDF opt-in with `?engine=route-d`). 969 workspace tests are green and no oracle
|
||||
fixture is ignored. Preview JSON also carries a `warnings` array naming
|
||||
environments route-D cannot lay out and control words that survived layout, so
|
||||
unsupported source is reported instead of being silently typeset.
|
||||
@@ -312,6 +312,10 @@ both penalties between line nodes (150 by default) and refuses any penalty of
|
||||
above and `\belowdisplayskip` below (the 10/11/12pt class defaults, overridable
|
||||
from the source in TeX's `7\p@ \@plus 2\p@` spelling too), and a page fixture
|
||||
shows a display near the page goal moving to the next page with pdfLaTeX.
|
||||
`\AtBeginDocument{...}` setup is lifted ahead of the body and `\newgeometry{...}`
|
||||
is applied as preamble geometry, with an explicit `textheight`/`textwidth`
|
||||
taking precedence over margins, so class files that set their page block in a
|
||||
begin-document hook get the intended measure instead of a text warning.
|
||||
|
||||
### P3 — `\halign` / `\valign` (L2)
|
||||
|
||||
|
||||
+2
-2
@@ -360,7 +360,7 @@ M5 (partial): display-list text carries `FontFace::{Roman,Bold,Italic,BoldItalic
|
||||
|
||||
M6 (partial): `DisplayItem::Image` becomes a PDF XObject; `DisplayItem::Link` becomes `/Annots /Subtype /Link /URI`; `DisplayItem::Special` injects raw content-stream operators. SVG previews show images as grey rectangles and specials as comments.
|
||||
|
||||
M2 (partial): `Page::display_list_with_goal(page_goal)` places insertion material at `page_goal - insertion_height`, adds a 0.4pt separator above footnotes, splits oversized insertions at item boundaries, and paints top/bottom floats from their vertical `content` at the page edges; empty floats keep a dimension rectangle. Floats also size themselves from content, respect `text_fraction_percent`, respect `top_fraction_percent` (TeX `\topfraction`, default 70%) and `bottom_fraction_percent` (TeX `\bottomfraction`, default 30%), and can take a dedicated float page. The incremental edit path applies the same float fractions, float number limits, insertion-class limits and per-class `skip` rules as full layout. `Document::float_sep` (TeX `\floatsep`, default 12pt) reserves a gap between stacked floats of the same placement in both paths. `Document::text_float_sep` (TeX `\textfloatsep`, default 20pt) reserves exactly one gap between the float block and the body text on a page that has both, again in both paths; `Page::display_list_with_layout(page_goal, text_float_sep)` applies the same gap when rendering, while `display_list_with_goal` stays gap-free for callers that do not know the document settings. Float material at the top of a page starts at the top margin: `\topskip` is consumed only by body text, matching TeX float pages. A `[t]` float seen while a page is already being filled is installed at the top of that same page, exactly as TeX's `\@toplist` does: the page height gains the float plus one `\textfloatsep` (or `\floatsep` between stacked floats), so the body stops earlier instead of the float waiting for the next page; only a break before the float moves it forward. `FloatPlacement::Here` models `[h]` floats: they keep their place in the body flow with `Document::in_text_sep` (TeX `\intextsep`, default 12pt) above and below, move to the next page when they do not fit, and count against `\totalnumber`. The page stores the float's `gap_after` so the display list advances the flow by the same amount the builder reserved. A standalone `page::PageBuilder` implements TeX's candidate-breakpoint cost model (page badness from accumulated glue stretch/shrink plus break penalties, `\topskip` for the first box, `\maxdepth` depth shifting) with unit tests covering overfull avoidance, exact glue filling, forced and costed breaks, `\topskip`, `\maxdepth`, marks, insertion limits and top-float placement; every fragment records the penalty that broke it. `Engine::layout_paged` now builds pages through it for documents whose units are single vertical items (boxes, rules, paragraphs, math, haligns, glue, penalties, marks and insertion classes, including per-class limits and held-over material; held-over material starts with `Document::split_top_skip` (TeX `\splittopskip`, default 10pt) when the class capacity can also hold its first item, and `Document::split_max_depth` (TeX `\splitmaxdepth`, `\maxdimen` by default) clamps the first held box's depth while moving the excess into its height); `Document::max_depth` feeds TeX's `\maxdepth` into the builder, and among equal-cost breakpoints the later candidate wins, matching the page builder's `least_page_cost` update with `<=`, so a page can take a later break even when it overfills the goal slightly; when no break fits within the glue shrink, the least overfull break is used instead. Paragraphs also split across pages at line boundaries, so body material no longer overflows a page as one box. Each multi-line paragraph inserts TeX's `\clubpenalty` after its first line and `\widowpenalty` before its last (150 in LaTeX, overridable through `\clubpenalty`/`\widowpenalty`); a page penalty of 10000 or more is not a legal breakpoint, and forcing either register to -10000 breaks exactly where pdfLaTeX does (two page oracle fixtures). Display math units also reserve LaTeX's `\abovedisplayskip` above and `\belowdisplayskip` below (10pt plus 2pt minus 5pt at 10pt, 11pt/12pt class values otherwise); the four registers, including the short forms, are read from the source in both `\abovedisplayskip=10pt plus 2pt` and class-file `\abovedisplayskip 7\p@ \@plus 2\p@` spelling, `\belowdisplayskip \abovedisplayskip` copies resolve, and a page oracle pins a display that no longer fits moving to the next page exactly as pdfLaTeX does. Paragraph boxes carry TeX depth: each node reports its last line's descent, so `\pagedepth` sees it, and the builder adds every box descent beyond `\maxdepth` to the page height while keeping the rest as page depth (TeX's per-box rule); route-D sources default `\maxdepth` to LaTeX's 5pt (0.5\topskip), and the page fixtures set it explicitly. A standalone `\smallskip`, `\medskip`, `\bigskip`, `\vskip` or `\vspace{...}` line between paragraphs becomes the following unit's `space_before` glue, carrying TeX's width plus its `plus`/`minus` parts (`\smallskip` is 3pt plus 1pt minus 1pt, and so on). Both page builders reserve it, the paged builder gets a real breakpointLine truncated
|
||||
M2 (partial): `Page::display_list_with_goal(page_goal)` places insertion material at `page_goal - insertion_height`, adds a 0.4pt separator above footnotes, splits oversized insertions at item boundaries, and paints top/bottom floats from their vertical `content` at the page edges; empty floats keep a dimension rectangle. Floats also size themselves from content, respect `text_fraction_percent`, respect `top_fraction_percent` (TeX `\topfraction`, default 70%) and `bottom_fraction_percent` (TeX `\bottomfraction`, default 30%), and can take a dedicated float page. The incremental edit path applies the same float fractions, float number limits, insertion-class limits and per-class `skip` rules as full layout. `Document::float_sep` (TeX `\floatsep`, default 12pt) reserves a gap between stacked floats of the same placement in both paths. `Document::text_float_sep` (TeX `\textfloatsep`, default 20pt) reserves exactly one gap between the float block and the body text on a page that has both, again in both paths; `Page::display_list_with_layout(page_goal, text_float_sep)` applies the same gap when rendering, while `display_list_with_goal` stays gap-free for callers that do not know the document settings. Float material at the top of a page starts at the top margin: `\topskip` is consumed only by body text, matching TeX float pages. A `[t]` float seen while a page is already being filled is installed at the top of that same page, exactly as TeX's `\@toplist` does: the page height gains the float plus one `\textfloatsep` (or `\floatsep` between stacked floats), so the body stops earlier instead of the float waiting for the next page; only a break before the float moves it forward. `FloatPlacement::Here` models `[h]` floats: they keep their place in the body flow with `Document::in_text_sep` (TeX `\intextsep`, default 12pt) above and below, move to the next page when they do not fit, and count against `\totalnumber`. The page stores the float's `gap_after` so the display list advances the flow by the same amount the builder reserved. A standalone `page::PageBuilder` implements TeX's candidate-breakpoint cost model (page badness from accumulated glue stretch/shrink plus break penalties, `\topskip` for the first box, `\maxdepth` depth shifting) with unit tests covering overfull avoidance, exact glue filling, forced and costed breaks, `\topskip`, `\maxdepth`, marks, insertion limits and top-float placement; every fragment records the penalty that broke it. `Engine::layout_paged` now builds pages through it for documents whose units are single vertical items (boxes, rules, paragraphs, math, haligns, glue, penalties, marks and insertion classes, including per-class limits and held-over material; held-over material starts with `Document::split_top_skip` (TeX `\splittopskip`, default 10pt) when the class capacity can also hold its first item, and `Document::split_max_depth` (TeX `\splitmaxdepth`, `\maxdimen` by default) clamps the first held box's depth while moving the excess into its height); `Document::max_depth` feeds TeX's `\maxdepth` into the builder, and among equal-cost breakpoints the later candidate wins, matching the page builder's `least_page_cost` update with `<=`, so a page can take a later break even when it overfills the goal slightly; when no break fits within the glue shrink, the least overfull break is used instead. Paragraphs also split across pages at line boundaries, so body material no longer overflows a page as one box. Each multi-line paragraph inserts TeX's `\clubpenalty` after its first line and `\widowpenalty` before its last (150 in LaTeX, overridable through `\clubpenalty`/`\widowpenalty`); a page penalty of 10000 or more is not a legal breakpoint, and forcing either register to -10000 breaks exactly where pdfLaTeX does (two page oracle fixtures). Display math units also reserve LaTeX's `\abovedisplayskip` above and `\belowdisplayskip` below (10pt plus 2pt minus 5pt at 10pt, 11pt/12pt class values otherwise); the four registers, including the short forms, are read from the source in both `\abovedisplayskip=10pt plus 2pt` and class-file `\abovedisplayskip 7\p@ \@plus 2\p@` spelling, `\belowdisplayskip \abovedisplayskip` copies resolve, and a page oracle pins a display that no longer fits moving to the next page exactly as pdfLaTeX does. Class setup written inside `\AtBeginDocument{...}` is lifted ahead of `\begin{document}` and executed as preamble, and `\newgeometry{...}` applies its options there; an explicit `textheight`/`textwidth` wins over margins, so the arXiv template's `\newgeometry{textheight=9in,textwidth=6.5in,top=1in}` keeps its 6.5in measure (the display-skip and geometry warnings it produced are gone). Paragraph boxes carry TeX depth: each node reports its last line's descent, so `\pagedepth` sees it, and the builder adds every box descent beyond `\maxdepth` to the page height while keeping the rest as page depth (TeX's per-box rule); route-D sources default `\maxdepth` to LaTeX'sLine truncated
|
||||
preview pages apply the same offsets to their display list so the editor and
|
||||
PDF agree. `Document::paper_width` and `paper_height` (TeX `\paperwidth`/`\paperheight`, default US Letter) set the PDF MediaBox and the preview page box, and both route-D endpoints strip leading `\hoffset`/`\voffset`/`\paperwidth`/`\paperheight`/`\vsize`/`\textheight` dimension assignments from the source (preamble included) and apply them, and the same pass reads `\parindent`, `\parskip`, `\baselineskip`, `\leftskip`, `\rightskip`, `\emergencystretch`, `\tolerance`, `\pretolerance`, `\hangindent`/`\hangafter`, `\spaceskip`/`\xspaceskip` and `\frenchspacing` into the paragraph styles; `\textwidth`/`\hsize` (including `\setlength{\textwidth}{...}`) set the paragraph measure, and `\setlength` also applies to the supported layout lengths with `\parskip` keeping its plus/minus glue; body paragraphs are measured with CMR10/per-face TFM advances rather than fixed cells; `\textheight` wins over `\vsize` because LaTeX resets `\vsize` from `\textheight` on every page, and project previews reuse the same geometry parsing. `Engine::top_mark`, `first_mark` and `bot_mark` implement TeX's carried mark registers per class. `Document::output_routine` runs an interpreted `\output` program over the paged fragments (`output::OutputProgram`: `\shipout\box255`, `\relax`, `\message`, `\ifdim`, `\ifnum`, `\ifodd` and `\ifcase` over the page registers, now including `\pageno`, `\outputpenalty`, `\deadcycles` and `\maxdeadcycles`), dropping pages the routine does not ship. A `\mark{...}` or classed `\marks<n>{...}` write inside the routine is recorded by the interpreter and placed at the front of the next page's marks, so the carried marks TeX exposes to the following page are reproduced. Assignments such as `\pageno=10`, `\deadcycles=0`, `\count2=2000`, `\dimen2=30pt`, `\skip2=6pt` and `\vsize=300pt` mutate the per-page context; `\advance`, `\multiply` and `\divide` adjust those registers in place (`\advance\pageno by 2`, `\divide\deadcycles by 2`, `\advance\dimen2 by 5pt`), and an arithmetic `\vsize` change retargets later pages exactly like an assignment; `\pageno` and the insertion registers keep their assigned values for later pages, since TeX's output registers are global; Route-D sources map a standalone `\newpage` or `\clearpage` onto `Document::page_breaks`, so the next paragraph starts on a fresh page (the paged builder turns each break into a `-10000` penalty node); the paged builder runs the routine after each page, so an assigned `\vsize` sets the goal of the pages the routine has not seen yet: the remaining fragments are rebuilt from the next node index with the new goal, which works with insertion material because class limits apply while the page is assembled; a deferred bottom float disables the retarget because the carried queue cannot be rebuilt. The `\pagegoal` register handed to the output routine is reduced by the insertion space reserved on that page. `\vbadness` carries the page's break badness and `\insertpenalties` counts insertion items the class limits held over, so an output routine can react to overfull breaks or split insertions. Paged layouts record the node index that starts each page, so `Engine::edit` on a paged layout reuses the sealed prefix and rebuilds only from the edited unit's page onward; an interpreted `\output` routine still forces a full rebuild, and an edit whose replay would begin before the first insertion does too, because held-over material and dropped pages move page boundaries. A document that contains a bottom float likewise rebuilds in full: a deferred float is carried on the page fragment, and a suffix replay starting at a page boundary cannot recover that queue. The scrolling builder's float path remains to be ported. The oracle harness also compares whole pages: ten page fixtures (single-line paragraphs, `\parskip=6pt`, multi-line paragraphs split across pages, a 300pt `\textheight`, a 30pt `\topskip`, a forced `\newpage`, stretchy `\vskip` glue between paragraphs, footnotes raised with `\footnotetext`, and a `[t]` float that reserves its height plus `\textfloatsep` on the page it appears, and `[b]` floats that fit or defer to the next page) assert the same page count and the same per-page alphanumeric text as pdfLaTeX at 345pt measure, 550pt `\vsize`, 12pt `\topskip` and 15pt `\parindent`.
|
||||
|
||||
@@ -370,7 +370,7 @@ Math coverage includes fractions/roots, scripts, `\left...\right` with body-scal
|
||||
|
||||
Paragraph units carry a `ParagraphFont`; `Unit::paragraph_with_face` and `Unit::paragraph_with_style_and_face` select Roman, bold, italic, mono, or sans. The corresponding Computer Modern TFM (`cmr10`, `cmbx10`, `cmti10`, `cmbxti10`, `cmtt10`, `cmss10`, `cmssbx10`, `cmssi10`, `cmcsc10`) supplies advances, kerns, ligatures, and italic correction for layout, the display list selects the matching face, and the PDF writes Computer Modern Type1 outlines for each built-in face (`cmr10`/`cmbx10`/`cmti10`/`cmbxti10`/`cmtt10`/`cmss10`/`cmssbx10`/`cmssi10`/`cmcsc10`, plus `cmmi10` for mathematical italic letters, `cmsy10` for math symbols and `cmex10` for big operators), falling back to Liberation subsets only for characters the Type1 encodings cannot address; those fallback glyphs keep their Unicode text under PDF extraction, so accented and Greek words round-trip; Type1 faces carry a ToUnicode CMap built from the requested characters, so glyphs whose names are ambiguous in the Adobe Glyph List (capital Omega, which would otherwise extract as U+2126) keep their intended code points. `Engine::edit` preserves the face when reflowing an edited paragraph.
|
||||
|
||||
The crate currently has 434 unit tests plus ten route-D integration tests and forty-two oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 967 tests (434 route-D unit, 345 engine binary unit, 10 route-D integration, 42 oracle, 71 v1 integration, 60 server, 4 engine unit, 1 core unit), with none ignored. v1 remains the live server path.
|
||||
The crate currently has 434 unit tests plus ten route-D integration tests and forty-two oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 969 tests (434 route-D unit, 347 engine binary unit, 10 route-D integration, 42 oracle, 71 v1 integration, 60 server, 4 engine unit, 1 core unit), with none ignored. v1 remains the live server path.
|
||||
|
||||
### M0 incremental demo
|
||||
|
||||
|
||||
+110
-3
@@ -1477,6 +1477,10 @@ fn geometry_package_options(line: &str) -> Option<String> {
|
||||
let (options, _) = braced(rest.trim_start())?;
|
||||
return Some(options.to_string());
|
||||
}
|
||||
if let Some(rest) = line.strip_prefix("\\newgeometry") {
|
||||
let (options, _) = braced(rest.trim_start())?;
|
||||
return Some(options.to_string());
|
||||
}
|
||||
let rest = line.strip_prefix("\\usepackage")?;
|
||||
let rest = rest.trim_start().strip_prefix('[')?;
|
||||
let (options, rest) = rest.split_once(']')?;
|
||||
@@ -1528,13 +1532,22 @@ fn apply_geometry_package(geometry: &mut PageGeometry, options: &str) {
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let explicit_width = geometry.line_width;
|
||||
let explicit_height = geometry.textheight;
|
||||
if left.is_some() || right.is_some() || top.is_some() || bottom.is_some() {
|
||||
let left = left.unwrap_or(0);
|
||||
let right = right.unwrap_or(0);
|
||||
let top = top.unwrap_or(0);
|
||||
let bottom = bottom.unwrap_or(0);
|
||||
geometry.line_width = Some(paper_width - left - right);
|
||||
geometry.textheight = Some(paper_height - top - bottom);
|
||||
// A `textwidth`/`textheight` option is authoritative; the arXiv
|
||||
// template's `\newgeometry{textheight=9in,textwidth=6.5in,top=1in}`
|
||||
// must keep its 9in/6.5in block instead of deriving it from margins.
|
||||
if explicit_width.is_none() {
|
||||
geometry.line_width = Some(paper_width - left - right);
|
||||
}
|
||||
if explicit_height.is_none() {
|
||||
geometry.textheight = Some(paper_height - top - bottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4363,8 +4376,73 @@ fn capture_body_definitions(
|
||||
}
|
||||
}
|
||||
|
||||
/// Move `\AtBeginDocument{...}` bodies in front of `\begin{document}`.
|
||||
fn lift_at_begin_document(source: &str) -> String {
|
||||
let mut hooks = String::new();
|
||||
let mut out = String::new();
|
||||
let mut rest = source;
|
||||
while let Some(index) = rest.find("\\AtBeginDocument") {
|
||||
out.push_str(&rest[..index]);
|
||||
let after = &rest[index + "\\AtBeginDocument".len()..];
|
||||
let trimmed = after.trim_start();
|
||||
let leading = after.len() - trimmed.len();
|
||||
let Some((content, used)) = braced_group(trimmed) else {
|
||||
out.push_str(&rest[index..]);
|
||||
rest = "";
|
||||
break;
|
||||
};
|
||||
if !content.trim().is_empty() {
|
||||
hooks.push_str(content.trim());
|
||||
hooks.push('\n');
|
||||
}
|
||||
rest = &after[leading + used..];
|
||||
}
|
||||
out.push_str(rest);
|
||||
if hooks.trim().is_empty() {
|
||||
return out;
|
||||
}
|
||||
if let Some(position) = out.find("\\begin{document}") {
|
||||
let mut lifted = String::with_capacity(out.len() + hooks.len());
|
||||
lifted.push_str(&out[..position]);
|
||||
lifted.push_str(&hooks);
|
||||
lifted.push_str(&out[position..]);
|
||||
lifted
|
||||
} else {
|
||||
hooks + &out
|
||||
}
|
||||
}
|
||||
|
||||
/// Join a multi-line braced argument such as `\newgeometry{ ... }` into one
|
||||
/// line so the line-oriented preamble parser can read it.
|
||||
fn collapse_braced_command(source: &str, command: &str) -> String {
|
||||
let mut out = String::new();
|
||||
let mut rest = source;
|
||||
while let Some(index) = rest.find(command) {
|
||||
out.push_str(&rest[..index + command.len()]);
|
||||
let after = &rest[index + command.len()..];
|
||||
let trimmed = after.trim_start();
|
||||
let leading = after.len() - trimmed.len();
|
||||
if let Some((content, used)) = braced_group(trimmed) {
|
||||
out.push('{');
|
||||
out.push_str(&content.replace('\n', " "));
|
||||
out.push('}');
|
||||
rest = &after[leading + used..];
|
||||
} else {
|
||||
rest = after;
|
||||
break;
|
||||
}
|
||||
}
|
||||
out.push_str(rest);
|
||||
out
|
||||
}
|
||||
|
||||
fn geometry_and_body(source: &str) -> (String, PageGeometry) {
|
||||
let (stripped, mut geometry) = strip_page_geometry(source);
|
||||
// Class files put page setup inside `\AtBeginDocument{...}`; run that
|
||||
// body before `\begin{document}` so its commands are consumed as setup
|
||||
// instead of being typeset as text at the top of page one.
|
||||
let source = lift_at_begin_document(source);
|
||||
let source = collapse_braced_command(&source, "\\newgeometry");
|
||||
let (stripped, mut geometry) = strip_page_geometry(&source);
|
||||
dedupe_macros(&mut geometry.macros);
|
||||
// Removed assignments can leave blank lines at the edges; they are not
|
||||
// paragraphs of their own.
|
||||
@@ -13551,6 +13629,35 @@ A definition.
|
||||
assert_eq!(after.space_shrink, 5 * SCALE);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn at_begin_document_newgeometry_sets_the_text_block() {
|
||||
let source = "\\documentclass{article}\n\\usepackage{geometry}\n\\AtBeginDocument{\n \\newgeometry{\n textheight=9in,\n textwidth=6.5in,\n top=1in,\n headheight=14pt,\n headsep=25pt,\n footskip=30pt\n }\n}\n\\begin{document}\n\nSome words here.\n\n\\end{document}\n";
|
||||
let (body, geometry) = geometry_and_body(source);
|
||||
assert_eq!(geometry.line_width, parse_dimension("6.5in"));
|
||||
assert_eq!(geometry.textheight, parse_dimension("9in"));
|
||||
assert!(!body.contains("newgeometry"));
|
||||
assert!(!body.contains("AtBeginDocument"));
|
||||
let paragraphs = paragraphs(&body).expect("paragraphs");
|
||||
let document = build_document(¶graphs, &geometry);
|
||||
assert_eq!(document.text_width, parse_dimension("6.5in").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn at_begin_document_setup_does_not_leak_into_text() {
|
||||
let source = "\\documentclass{article}\n\\AtBeginDocument{\\newgeometry{textwidth=200pt}}\n\\begin{document}\n\nHello world.\n\n\\end{document}\n";
|
||||
let (body, geometry) = geometry_and_body(source);
|
||||
assert_eq!(geometry.line_width, Some(200 * SCALE));
|
||||
assert!(!body.contains("AtBeginDocument"));
|
||||
assert!(!body.contains("newgeometry"));
|
||||
let warnings = source_warnings(source, &geometry);
|
||||
assert!(
|
||||
!warnings
|
||||
.iter()
|
||||
.any(|warning| warning.contains("newgeometry")),
|
||||
"{warnings:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn display_skips_accept_class_file_spelling() {
|
||||
let source = "\\documentclass{article}\n\\abovedisplayskip 7\\p@ \\@plus 2\\p@ \\@minus 5\\p@\n\\abovedisplayshortskip \\z@ \\@plus 3\\p@\n\\belowdisplayskip \\abovedisplayskip\n\\belowdisplayshortskip 4\\p@ \\@plus 3\\p@ \\@minus 3\\p@\n\\begin{document}\n\nBefore.\n\n\\[ x \\]\n\nAfter.\n\n\\end{document}\n";
|
||||
|
||||
Reference in new issue
Block a user