Open the tables of contents and bibliography with headings
This commit is contained in:
1 parent
f23a841e79
commit
0dbca4305b
4 files changed
+151
-17
No files matched your search
@@ -469,7 +469,7 @@ from the font's MATH assembly parts. `\\left...\\right` target sizing follows
|
||||
the assignable TeX parameters `\\delimiterfactor` (default 901) and
|
||||
`\\delimitershortfall` (default 5pt), including local and global assignments.
|
||||
|
||||
Route-D text faces follow the NFSS declarations and compose with the surrounding run: `\sffamily\bfseries` selects cmssbx10, `\sffamily\itshape` selects cmssi10, and bold italic sans substitutes cmssbx10 because Computer Modern has no sans bold italic. `\scshape`/`\textsc` select the real cmcsc10 small-caps face, `\slshape`/`\textsl` use cmsl10 (or cmbxsl10 when bold) rather than the italic cmti10, and `\ttfamily\itshape` reaches cmitt10. All twelve text programs (cmr10, cmbx10, cmti10, cmbxti10, cmtt10, cmss10, cmssbx10, cmssi10, cmcsc10, cmsl10, cmbxsl10, cmitt10) are embedded as Type1 outlines. Characters outside a program's encoding fall back per glyph to a Liberation subset, so the ASCII letters of an accented word still use Computer Modern. Because Computer Modern has no bold small caps, a bold small-caps request falls back to cmbx10. Section-wide declarations such as `\bfseries` apply from where they appear to the end of their group, and `\em` toggles emphasis relative to the surrounding face. Paragraph base sizes come from `\fontsize{<size>}{<baselineskip>}` and the article size commands (`\tiny` through `\Huge`), scaling glyph metrics and the default interline glue while the measure, indentation and authored skips stay absolute. The class options `10pt`/`11pt`/`12pt` on `\documentclass[...]` set the default base size (and article `\baselineskip` of 12pt/13.6pt/14.5pt), and `\linespread{factor}` (or `\renewcommand{\baselinestretch}{factor}`) scales that baseline; a size command inside a paragraph overrides the class default and keeps its own glyph size in that run. Inline math inside a styled run keeps its math face while the surrounding text retains its style. The paragraph measure follows `\textwidth`/`\hsize` (or `\setlength{\textwidth}{...}`), and `\setlength` accepts the other supported layout lengths, including a `\parskip` with plus/minus glue. The `geometry` package's `margin`/`hmargin`/`vmargin`/`left`/`right`/`top`/`bottom`/`textwidth`/`textheight` options (or `\geometry{...}`) are applied to the page measure and height; other package code is not executed. Block environments `center`, `flushleft` and `flushright` set the paragraph alignment, and aligned short lines are centring/flushing within the full measure rather than at the natural line width. `\title`, `\author` and `\date` are captured from the preamble, `\today` expands to the current date, and `\maketitle` expands into a centered title block at the article class sizes (using today's date when `\date` is absent and none for `\date{}`). `\section`, `\subsection`, `\subsubsection`, `\paragraph` and `\subparagraph` advance five-level article counters, prefix their titles with the number, and paint bold at `\Large`/`\large`/`\normalsize` (the two deepest levels stay at the base size); starred headings stay unnumbered and an optional `[short]` title is dropped. The `abstract` environment expands into a centered bold heading and a 9pt body, and `\maketitle` joins multiple `\and` authors and turns `\thanks` notes into title footnotes. Section labels resolve `\ref`/`\eqref` to the heading number (standalone `\label` lines attach to the previous heading, unknown references print `??`), `\appendix` restarts sectioning with letter numbers, `\tableofcontents` lists the numbered headings through `\subsubsection` (the default article `tocdepth` of 3, changed by `\setcounter{tocdepth}`), `\setcounter{secnumdepth}` limits which levels are numbered, `\listoffigures`/`\listoftables` reproduce the numbered captions, `verbatim` keeps monospaced source lines, `\verb|...|` renders inline literal text monospaced, `\href` keeps its link text and paints a PDF `/Link` URI annotation over the label, and `\url` becomes typewriter text, and the `abstract` environment expands to its heading and body. In route-D, math uses Computer Modern metrics from the bundled `cmmi10`, `cmsy10`, `cmex10`, `msbm10` and `eufm10` TFMs and embeds their Type1 programs, so italic letters, relation symbols, big operators, `\mathcal` capitals, `\mathbb` capitals and `\mathfrak` Fraktur letters each paint with their own face. Fractions can be written as `\frac` or with TeX's infix forms (`\over`, `\atop`, `\choose`, `\brace`, `\brack`, `\overwithdelims`, `\atopwithdelims`); only `\over`-style fractions draw a bar and fractions never draw parentheses. `\left`/`\right` choose CMEX delimiter sizes from the body extent using TeX's delimiterfactor and shortfall, `\middle` delimiters are sized with their group, and `\big`/`\Big`/`\bigg`/`\Bigg` paint at their selected CMEX size. `align`/`align*` displays share column widths, right-align even columns at their relations, and number each row (with `\tag`/`\notag` per row); `gather`/`gather*` centre each row instead. Inter-atom spacing uses TeX's 3/4/5mu classes (`1mu` is `1/18em`), `\mid` is a relation and `\colon` punctuation, and `\mskip`/`\mkern`/`\mspace`/`\hskip`/`\kern`/`\hspace` scan TeX dimensions, taking the natural width of any `plLine truncated
|
||||
Route-D text faces follow the NFSS declarations and compose with the surrounding run: `\sffamily\bfseries` selects cmssbx10, `\sffamily\itshape` selects cmssi10, and bold italic sans substitutes cmssbx10 because Computer Modern has no sans bold italic. `\scshape`/`\textsc` select the real cmcsc10 small-caps face, `\slshape`/`\textsl` use cmsl10 (or cmbxsl10 when bold) rather than the italic cmti10, and `\ttfamily\itshape` reaches cmitt10. All twelve text programs (cmr10, cmbx10, cmti10, cmbxti10, cmtt10, cmss10, cmssbx10, cmssi10, cmcsc10, cmsl10, cmbxsl10, cmitt10) are embedded as Type1 outlines. Characters outside a program's encoding fall back per glyph to a Liberation subset, so the ASCII letters of an accented word still use Computer Modern. Because Computer Modern has no bold small caps, a bold small-caps request falls back to cmbx10. Section-wide declarations such as `\bfseries` apply from where they appear to the end of their group, and `\em` toggles emphasis relative to the surrounding face. Paragraph base sizes come from `\fontsize{<size>}{<baselineskip>}` and the article size commands (`\tiny` through `\Huge`), scaling glyph metrics and the default interline glue while the measure, indentation and authored skips stay absolute. The class options `10pt`/`11pt`/`12pt` on `\documentclass[...]` set the default base size (and article `\baselineskip` of 12pt/13.6pt/14.5pt), and `\linespread{factor}` (or `\renewcommand{\baselinestretch}{factor}`) scales that baseline; a size command inside a paragraph overrides the class default and keeps its own glyph size in that run. Inline math inside a styled run keeps its math face while the surrounding text retains its style. The paragraph measure follows `\textwidth`/`\hsize` (or `\setlength{\textwidth}{...}`), and `\setlength` accepts the other supported layout lengths, including a `\parskip` with plus/minus glue. The `geometry` package's `margin`/`hmargin`/`vmargin`/`left`/`right`/`top`/`bottom`/`textwidth`/`textheight` options (or `\geometry{...}`) are applied to the page measure and height; other package code is not executed. Block environments `center`, `flushleft` and `flushright` set the paragraph alignment, and aligned short lines are centring/flushing within the full measure rather than at the natural line width. `\title`, `\author` and `\date` are captured from the preamble, `\today` expands to the current date, and `\maketitle` expands into a centered title block at the article class sizes (using today's date when `\date` is absent and none for `\date{}`). `\section`, `\subsection`, `\subsubsection`, `\paragraph` and `\subparagraph` advance five-level article counters, prefix their titles with the number, and paint bold at `\Large`/`\large`/`\normalsize` (the two deepest levels stay at the base size); starred headings stay unnumbered and an optional `[short]` title is dropped. The `abstract` environment expands into a centered bold heading and a 9pt body, and `\maketitle` joins multiple `\and` authors and turns `\thanks` notes into title footnotes. Section labels resolve `\ref`/`\eqref` to the heading number (standalone `\label` lines attach to the previous heading, unknown references print `??`), `\appendix` restarts sectioning with letter numbers, `\tableofcontents` lists the numbered headings through `\subsubsection` (the default article `tocdepth` of 3, changed by `\setcounter{tocdepth}`), `\setcounter{secnumdepth}` limits which levels are numbered, `\listoffigures`/`\listoftables` reproduce the numbered captions, `verbatim` keeps monospaced source lines, `\verb|...|` renders inline literal text monospaced, `\href` keeps its link text and paints a PDF `/Link` URI annotation over the label, and `\url` becomes typewriter text, and the `abstract` environment expands to its heading and body. In route-D, math uses Computer Modern metrics from the bundled `cmmi10`, `cmsy10`, `cmex10`, `msbm10` and `eufm10` TFMs and embeds their Type1 programs, so italic letters, relation symbols, big operators, `\mathcal` capitals, `\mathbb` capitals and `\mathfrak` Fraktur letters each paint with their own face. Fractions can be written as `\frac` or with TeX's infix forms (`\over`, `\atop`, `\choose`, `\brace`, `\brack`, `\overwithdelims`, `\atopwithdelims`); only `\over`-style fractions draw a bar and fractions never draw parentheses. `\left`/`\right` choose CMEX delimiter sizes from the body extent using TeX's delimiterfactor and shortfall, `\middle` delimiters are sized with their group, and `\big`/`\Big`/`\bigg`/`\Bigg` paint at their selected CMEX size. `align`/`align*` displays share column widths, right-align even columns at their relations, and number each row (with `\tag`/`\notag` per row); `gather`/`gather*` centre each row instead. Inter-atom spacing uses TeX's 3/4/5mu classes (`1mu` is `1/18em`), `\mid` is a relation and `\colon` punctuation, and `\mskip`/`\mkern`/`\mspace`/`\hskip`/`\kern`/`\hspace` scan TeX dimensions, taking the natural width of any `plLine truncated
|
||||
|
||||
Inline `$...$` and `\(...\)` math is laid out inside 10pt paragraphs (larger sizes keep the delimiters literal). `\newcommand`/`\renewcommand` definitions are captured from the preamble and expanded textually, including numbered arguments; TeX's `\def` parameter texts and `\let` aliases are executed the same way, and `\newenvironment` definitions wrap their bodies with the declared begin/end material. `\newif` flags select between `\if...\else...\fi` branches, with assignments honoured in the preamble or the body, so class conditionals like `\ifdraft` work.
|
||||
|
||||
|
||||
@@ -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`). 727 workspace tests are green and no oracle
|
||||
PDF opt-in with `?engine=route-d`). 731 workspace tests are green and no oracle
|
||||
fixture is ignored.
|
||||
|
||||
Status after G1 (P0-P2): the paragraph model reproduces TeX's passes,
|
||||
|
||||
+2
-2
@@ -133,7 +133,7 @@ and justification.
|
||||
| M3 | `\halign`, `\omit`, `\span`, `\multispan`, booktabs/longtable | **partial**: source parsing, natural column widths, spans, rule rows, 10pt display-list painting and row-level page splitting; the paged builder splits a tall alignment into page-sized row chunks that keep the table's column widths, so long tables continue across pages; `p{width}` paragraph columns wrap cell text and grow row heights, wrapped rows participate in row-level splitting, explicit per-column `\tabskip` glue is honoured through layout, painting and page chunks, and booktabs rules carry their own weights and spans (`\toprule`/`\bottomrule` 0.8pt, `\midrule`/`\cmidrule` 0.5pt, with `\cmidrule(lr){a-b}` trimming and column ranges), `@{}` / `@{\hspace{...}}` column expressions override the inter-column glue, and row-boundary `\noalign{\vskip ...}` glue is honoured by layout, painting and page chunks; longtable head/foot sections (`\endfirsthead`/`\endhead`/`\endfoot`/`\endlastfoot`) are parsed, continuation chunks repeat the head rows and the foot block paints once at the end, LaTeX `tabular` environments are captured and laid out through the same `\halign` path (rules are stripped from the column spec, `p{...}`/`m{...}`/`b{...}` become wrapping columns, `@{}` expressions are ignored for spacing), `\multicolumn{n}{align}{...}` cells span columns with the requested alignment, `\cline{a-b}` draws a 0.4pt partial rule over a column range, though `\valign`, nested tables and full tabular parity remain open |
|
||||
| M4 | math lists, scripts, fractions, radicals, accents, delimiters | **partial**: token parser, atom boxes with Computer Modern metrics (italic letters from the bundled `cmmi10`, big operators from `cmex10`, symbols such as `\times`/`\leq`/`\infty` from `cmsy10`, with `cmmi10`, `cmsy10` and `cmex10` glyphs embedded as Type1 outlines), `\left...\right` delimiter selection through CMEX size variants using TeX's delimiterfactor and shortfall, accents and a display-list painter; display formulas wider than the measure are split at top-level binary/relation operators into multiple lines (an approximation of TeX's `\split` behaviour; `align`/`align*` displays share column widths and number each row, while `gather`/`gather*` centre every row); CMEX delimiter size variants back `\big`/`\Big`/`\bigg`/`\Bigg`; inter-atom spacing uses TeX's full atom-class table with binary-operator normalisation, with `1mu` = `1/18em` (a thin space is 3mu = 1.67pt at 10pt); `\mid` is a relation while `\colon` is punctuation; `\mskip`, `\mkern`, `\mspace`, `\hskip`, `\kern` and `\hspace` scan TeX dimensions (`mu`, `pt`, `em`, ...) and contribute their natural width, accepting `plus`/`minus` parts even though math boxes are not glue lists; route-D numbers `equation` environments and resolves `\eqref`/`\ref` through their labels; `\tag` overrides the number and `\notag`/`\nonumber` suppress it; math italic letters are embedded as Computer Modern Type1 outlines (`cmmi10`), and math alphabets map `\\mathbf`/`\\mathit`/`\\mathsf`/`\\mathtt` onto the bold, math-italic, sans and mono faces with their TFMs and `\\mathcal` onto the cmsy10 calligraphic capitals; `\mathfrak` maps onto the bundled eufm10 Fraktur letters (embedded as Type1 outlines); infix fractions `\over`, `\atop`, `\choose`, `\brace`, `\brack` and their `withdelims` forms build fractions from the current row, with the bar only for the `\over` forms; `\middle` delimiters are sized with their enclosing `\left`/`\right` group and `\big`/`\Big`/`\bigg`/`\Bigg` paint at their selected CMEX size |
|
||||
| M5 | NFSS/TFM metrics, CM/Latin Modern | **partial**: paragraph-level NFSS declarations and inline run composition over the built-in Roman/Bold/Italic/BoldItalic/Mono/MonoItalic/Sans/SansBold/SansItalic/SmallCaps/Slanted/BoldSlanted faces (CM has no sans bold-italic, so `cmss/bx/it` substitutes `cmss/bx/n`; `\scshape` selects cmcsc10 and a bold small caps request falls back to cmbx10; `\slshape` uses the slanted cmsl10 rather than the italic cmti10 and `\ttfamily\itshape` reaches cmitt10), per-face Computer Modern TFM metrics, and Type1 (PFB) outline embedding for every built-in face plus `cmmi10` math italics, `cmsy10` math symbols and `cmex10` big operators, with a Liberation subset falling back per glyph for characters outside the Type1 encodings, so ASCII on an accented line still uses the Computer Modern face; paragraph base sizes from `\fontsize` and the article size commands scale glyph metrics and the default interline glue while the measure and authored skips stay absolute, a size command in the middle of a paragraph splits a sized run that is shaped and painted at its own type size, and inline math inside a styled run keeps its math boxes while the surrounding text keeps its face; full NFSS family/shape state and Type1 coverage for arbitrary Unicode remain open |
|
||||
| M6 | class/package execution (`article`, `sn-jnl`) | **partial**: `\documentclass[...]` options are read and the article `10pt`/`11pt`/`12pt` base size sets the default paragraph font size and `\baselineskip` (13.6pt/14.5pt), and `\linespread{factor}` (or `\renewcommand{\baselinestretch}{factor}`/`\def\baselinestretch{factor}`) scales that class baseline; the `geometry` package's `margin`/`hmargin`/`vmargin`/`left`/`right`/`top`/`bottom` options (and `\geometry{...}`) adjust the measure and page height; `\title`/`\author`/`\date` are captured, `\today` expands to the UTC calendar date in the title block and the body, and `\maketitle` expands into the centered article title block at the class sizes (with today's date when `\date` is absent and no date for `\date{}`); numbered `\section`/`\subsection`/`\subsubsection`/`\paragraph`/`\subparagraph` headings advance five-level article counters (article's `\setcounter{secnumdepth}` default of 3 numbers through `\subsubsection`, and raising it numbers the two deeper levels) and paint at `\Large`/`\large`/`\normalsize` (the two deepest levels stay bold at the base size), starred headings stay unnumbered, and an optional `[short]` title is dropped; the `abstract` environment expands into a centered bold heading and a 9pt body, `\maketitle` joins `\and` authors and turns `\thanks` notes into title footnotes, and `\label` inside a heading (or on its own line after it) resolves `\ref`/`\eqref` to the section number while unknown references print `??`, and `\appendix` restarts sectioning with letters (`A`, `A.1`), and `\tableofcontents` lists the numbered headings through `\subsubsection` with 12pt per-level indentation (the default article `tocdepth` of 3; `\setcounter{tocdepth}` changes the depth) while `\listoffigures`/`\listoftables` reproduce the numbered figure/table captions; `verbatim` environments keep each source line as a monospaced 9pt paragraph indented by 12pt (leading whitespace is normalised), `\verb|...|` renders inline literal text in the mono face, `\href{url}{text}` keeps its text, and `\url{...}` becomes typewriter text; `\footnote{...}` becomes a numbered 9pt page insertion on the page that mentions it; a `thebibliography` environment is removed from the body, its `\bibitem` entries become numbered `[n]` paragraphs, and `\cite{...}` resolves to `[n]`/`[n, m]` (unknown keys print `[?]`); a `figure` environment becomes a float at its `[t]`/`[b]`/`[h]` placement, its `\caption` numbers as `Figure n:` and resolves `\ref`, and `\includegraphics` embeds the referenced project image (PNG/JPEG/BMP are decoded into a PDF XObject, with a rule placeholder when the file is missing), and a standalone `\includegraphics` paragraph becomes an in-text graphic float, with `width=`/`height=` taking dimensions or fractions of `\textwidth`/`\textheight`, `scale=` a percentage of the natural size, `keepaspectratio` shrinking both dimensions to fit, and `\graphicspath` directories searched with common image extensions when the path has no suffix; a `table` environment becomes a float that carries its captured `tabular` body and a numbered `Table n:` caption whose text sits above the tabular as in LaTeX, while `\caption*` stays unnumbered for either float kind; `\tabcolsep` (or `\setlength{\tabcolsep}`) sets the glue on each side of every tabular column, with LaTeX's 6pt default when unset, and `\renewcommand{\arraystretch}{factor}` (or `\def\arraystretch{factor}`) scales every tabular row height; caption prefixes and the abstract heading can be renamed with `\renewcommand{\figurename}`, `\renewcommand{\tablename}` and `\renewcommand{\abstractname}`; `theorem`/`lemma`/`corollary`/`proposition`/`definition`/`example`/`remark`/`proof` environments get a bold numbered heading (optionally with `[title]`), italic statements for the theorem group, an unnumbered proof, and `\label`/`\ref` targets; `\newtheorem{env}[shared]{Display}`, `\newtheorem{env}{Display}[section]` and `\newtheorem*{env}{Display}` define custom environments with shared counters and section-scoped numbers; `itemize`/`enumerate`/`description` lists nest with depth-aware bullets (`•`, `–`, `*`), lettered/roman sub-labels and 12pt-per-level indentation, and an optional `\item[label]` overrides the generated marker; `\def\name#1{...}` parameter texts and `\let\alias=\other` aliases are executed as textual definitions; `\newenvironment{name}[n]{begin}{end}` definitions expand their begin/end codes around the environment body, with numbered arguments available in both; `\newif\ifname` flags default to false and `\nametrue`/`\namefalse` assignments, whether in the preamble or the body, select between `\ifname ... \else ... \fi` branches; project previews and PDF exports expand `\input{...}`/`\include{...}` from the project's files (the `.tex` suffix may be omitted) while unknown files stay literal text, and inline a project's own `.sty` files for `\usepackage{name}` and `.cls` files for `\documentclass` (rewLine truncated
|
||||
| M6 | class/package execution (`article`, `sn-jnl`) | **partial**: `\documentclass[...]` options are read and the article `10pt`/`11pt`/`12pt` base size sets the default paragraph font size and `\baselineskip` (13.6pt/14.5pt), and `\linespread{factor}` (or `\renewcommand{\baselinestretch}{factor}`/`\def\baselinestretch{factor}`) scales that class baseline; the `geometry` package's `margin`/`hmargin`/`vmargin`/`left`/`right`/`top`/`bottom` options (and `\geometry{...}`) adjust the measure and page height; `\title`/`\author`/`\date` are captured, `\today` expands to the UTC calendar date in the title block and the body, and `\maketitle` expands into the centered article title block at the class sizes (with today's date when `\date` is absent and no date for `\date{}`); numbered `\section`/`\subsection`/`\subsubsection`/`\paragraph`/`\subparagraph` headings advance five-level article counters (article's `\setcounter{secnumdepth}` default of 3 numbers through `\subsubsection`, and raising it numbers the two deeper levels) and paint at `\Large`/`\large`/`\normalsize` (the two deepest levels stay bold at the base size), starred headings stay unnumbered, and an optional `[short]` title is dropped; the `abstract` environment expands into a centered bold heading and a 9pt body, `\maketitle` joins `\and` authors and turns `\thanks` notes into title footnotes, and `\label` inside a heading (or on its own line after it) resolves `\ref`/`\eqref` to the section number while unknown references print `??`, and `\appendix` restarts sectioning with letters (`A`, `A.1`), and `\tableofcontents` lists the numbered headings through `\subsubsection` with 12pt per-level indentation (the default article `tocdepth` of 3; `\setcounter{tocdepth}` changes the depth) while `\listoffigures`/`\listoftables` reproduce the numbered figure/table captions; `verbatim` environments keep each source line as a monospaced 9pt paragraph indented by 12pt (leading whitespace is normalised), `\verb|...|` renders inline literal text in the mono face, `\href{url}{text}` keeps its text, and `\url{...}` becomes typewriter text; `\footnote{...}` becomes a numbered 9pt page insertion on the page that mentions it; a `thebibliography` environment is removed from the body, its `\bibitem` entries become numbered `[n]` paragraphs, and `\cite{...}` resolves to `[n]`/`[n, m]` (unknown keys print `[?]`); a `figure` environment becomes a float at its `[t]`/`[b]`/`[h]` placement, its `\caption` numbers as `Figure n:` and resolves `\ref`, and `\includegraphics` embeds the referenced project image (PNG/JPEG/BMP are decoded into a PDF XObject, with a rule placeholder when the file is missing), and a standalone `\includegraphics` paragraph becomes an in-text graphic float, with `width=`/`height=` taking dimensions or fractions of `\textwidth`/`\textheight`, `scale=` a percentage of the natural size, `keepaspectratio` shrinking both dimensions to fit, and `\graphicspath` directories searched with common image extensions when the path has no suffix; a `table` environment becomes a float that carries its captured `tabular` body and a numbered `Table n:` caption whose text sits above the tabular as in LaTeX, while `\caption*` stays unnumbered for either float kind; `\tabcolsep` (or `\setlength{\tabcolsep}`) sets the glue on each side of every tabular column, with LaTeX's 6pt default when unset, and `\renewcommand{\arraystretch}{factor}` (or `\def\arraystretch{factor}`) scales every tabular row height; caption prefixes and the abstract heading can be renamed with `\renewcommand{\figurename}`, `\renewcommand{\tablename}` and `\renewcommand{\abstractname}`, while the bibliography and table of contents open with `References`/`Contents` headings renamed by `\renewcommand{\refname}` and `\renewcommand{\contentsname}`; `theorem`/`lemma`/`corollary`/`proposition`/`definition`/`example`/`remark`/`proof` environments get a bold numbered heading (optionally with `[title]`), italic statements for the theorem group, an unnumbered proof, and `\label`/`\ref` targets; `\newtheorem{env}[shared]{Display}`, `\newtheorem{env}{Display}[section]` and `\newtheorem*{env}{Display}` define custom environments with shared counters and section-scoped numbers; `itemize`/`enumerate`/`description` lists nest with depth-aware bullets (`•`, `–`, `*`), lettered/roman sub-labels and 12pt-per-level indentation, and an optional `\item[label]` overrides the generated marker; `\def\name#1{...}` parameter texts and `\let\alias=\other` aliases are executed as textual definitions; `\newenvironment{name}[n]{begin}{end}` definitions expand their begin/end codes around the environment body, with numbered arguments available in both; `\newif\ifname` flags default to false and `\nametrue`/`\namefalse` assignments, whether in the preamble or the body, select between `\ifname ... \else ... \fi` branches; project previews and PDF exports expand `\input{...}`/`\include{...}` from the project's files (the `.tex` suffix Line truncated
|
||||
| M7 | `\special`, PDF XObjects, hyperref annotations | PDF structure parity |
|
||||
|
||||
## Current limits
|
||||
@@ -367,7 +367,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. `Engine::edit` preserves the face when reflowing an edited paragraph.
|
||||
|
||||
The crate currently has 410 unit tests plus nine route-D integration tests and thirty-five oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 727 tests (410 route-D unit, 146 engine binary unit, 9 route-D integration, 35 oracle, 71 v1 integration, 51 server, 4 engine unit, 1 core unit), with none ignored. v1 remains the live server path.
|
||||
The crate currently has 410 unit tests plus nine route-D integration tests and thirty-five oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 731 tests (410 route-D unit, 150 engine binary unit, 9 route-D integration, 35 oracle, 71 v1 integration, 51 server, 4 engine unit, 1 core unit), with none ignored. v1 remains the live server path.
|
||||
|
||||
### M0 incremental demo
|
||||
|
||||
|
||||
+147
-13
@@ -149,6 +149,10 @@ struct PageGeometry {
|
||||
table_name: Option<String>,
|
||||
/// `\\abstractname` heading text.
|
||||
abstract_name: Option<String>,
|
||||
/// `\\refname` heading for the bibliography.
|
||||
ref_name: Option<String>,
|
||||
/// `\\contentsname` heading for the table of contents.
|
||||
contents_name: Option<String>,
|
||||
left_skip: Option<i64>,
|
||||
right_skip: Option<i64>,
|
||||
tolerance: Option<i64>,
|
||||
@@ -1020,6 +1024,14 @@ fn strip_page_geometry(source: &str) -> (String, PageGeometry) {
|
||||
geometry.abstract_name = Some(name);
|
||||
continue;
|
||||
}
|
||||
if let Some(name) = renewcommand_text(trimmed, "refname") {
|
||||
geometry.ref_name = Some(name);
|
||||
continue;
|
||||
}
|
||||
if let Some(name) = renewcommand_text(trimmed, "contentsname") {
|
||||
geometry.contents_name = Some(name);
|
||||
continue;
|
||||
}
|
||||
if trimmed.starts_with("\\newcommand")
|
||||
|| trimmed.starts_with("\\renewcommand")
|
||||
|| trimmed.starts_with("\\providecommand")
|
||||
@@ -4458,7 +4470,42 @@ fn number_floats(
|
||||
}
|
||||
|
||||
/// Append `thebibliography` entries as numbered paragraphs.
|
||||
fn append_bibliography(paragraphs: &mut Vec<SourceParagraph>, bibliography: &[(String, String)]) {
|
||||
fn bibliography_heading(text: &str) -> SourceParagraph {
|
||||
SourceParagraph {
|
||||
text: text.to_string(),
|
||||
page_break: false,
|
||||
centered: false,
|
||||
right_aligned: false,
|
||||
font: ParagraphFont::Bold,
|
||||
line_height: 14,
|
||||
math: false,
|
||||
left_skip: 0,
|
||||
space_before: 12 * SCALE,
|
||||
space_stretch: 2 * SCALE,
|
||||
space_shrink: 0,
|
||||
equation_number: None,
|
||||
equation_tag: None,
|
||||
equation_rows: Vec::new(),
|
||||
align_centered: false,
|
||||
heading_level: None,
|
||||
heading_starred: false,
|
||||
heading_number: None,
|
||||
footnotes: Vec::new(),
|
||||
theorem: None,
|
||||
float: None,
|
||||
font_size: None,
|
||||
}
|
||||
}
|
||||
|
||||
fn append_bibliography(
|
||||
paragraphs: &mut Vec<SourceParagraph>,
|
||||
bibliography: &[(String, String)],
|
||||
heading: &str,
|
||||
) {
|
||||
if bibliography.is_empty() {
|
||||
return;
|
||||
}
|
||||
paragraphs.push(bibliography_heading(heading));
|
||||
for (index, (_, entry)) in bibliography.iter().enumerate() {
|
||||
paragraphs.push(SourceParagraph {
|
||||
text: format!("[{}] {entry}", index + 1),
|
||||
@@ -4469,7 +4516,7 @@ fn append_bibliography(paragraphs: &mut Vec<SourceParagraph>, bibliography: &[(S
|
||||
line_height: 12,
|
||||
math: false,
|
||||
left_skip: 0,
|
||||
space_before: if index == 0 { 12 * SCALE } else { 4 * SCALE },
|
||||
space_before: if index == 0 { 4 * SCALE } else { 4 * SCALE },
|
||||
space_stretch: 2 * SCALE,
|
||||
space_shrink: 0,
|
||||
equation_number: None,
|
||||
@@ -4487,7 +4534,7 @@ fn append_bibliography(paragraphs: &mut Vec<SourceParagraph>, bibliography: &[(S
|
||||
}
|
||||
}
|
||||
|
||||
fn expand_toc(paragraphs: &mut Vec<SourceParagraph>, tocdepth: u32) {
|
||||
fn expand_toc(paragraphs: &mut Vec<SourceParagraph>, tocdepth: u32, contents_name: &str) {
|
||||
let entries: Vec<(u8, String)> = paragraphs
|
||||
.iter()
|
||||
.filter(|paragraph| {
|
||||
@@ -4506,8 +4553,15 @@ fn expand_toc(paragraphs: &mut Vec<SourceParagraph>, tocdepth: u32) {
|
||||
return;
|
||||
};
|
||||
let space_before = paragraphs[position].space_before;
|
||||
let mut toc = Vec::with_capacity(entries.len());
|
||||
for (index, (level, text)) in entries.iter().enumerate() {
|
||||
let mut toc = Vec::with_capacity(entries.len() + 1);
|
||||
if entries.is_empty() {
|
||||
paragraphs.remove(position);
|
||||
return;
|
||||
}
|
||||
let mut heading = bibliography_heading(contents_name);
|
||||
heading.space_before = space_before;
|
||||
toc.push(heading);
|
||||
for (level, text) in entries.iter() {
|
||||
toc.push(SourceParagraph {
|
||||
text: text.clone(),
|
||||
page_break: false,
|
||||
@@ -4517,7 +4571,7 @@ fn expand_toc(paragraphs: &mut Vec<SourceParagraph>, tocdepth: u32) {
|
||||
line_height: 12,
|
||||
math: false,
|
||||
left_skip: 12 * (level.saturating_sub(1) as i64),
|
||||
space_before: if index == 0 { space_before } else { 2 * SCALE },
|
||||
space_before: 2 * SCALE,
|
||||
space_stretch: 0,
|
||||
space_shrink: 0,
|
||||
equation_number: None,
|
||||
@@ -4596,7 +4650,11 @@ fn build_document(paragraphs: &[SourceParagraph], geometry: &PageGeometry) -> Do
|
||||
rename_abstract_heading(&mut paragraphs, name);
|
||||
}
|
||||
let section_labels = number_sections(&mut paragraphs, geometry.secnumdepth.unwrap_or(3));
|
||||
expand_toc(&mut paragraphs, geometry.tocdepth.unwrap_or(3));
|
||||
expand_toc(
|
||||
&mut paragraphs,
|
||||
geometry.tocdepth.unwrap_or(3),
|
||||
geometry.contents_name.as_deref().unwrap_or("Contents"),
|
||||
);
|
||||
let mut references = section_labels;
|
||||
references.extend(number_theorems(
|
||||
&mut paragraphs,
|
||||
@@ -4611,7 +4669,11 @@ fn build_document(paragraphs: &[SourceParagraph], geometry: &PageGeometry) -> Do
|
||||
resolve_section_refs(&mut paragraphs, &references);
|
||||
number_footnotes(&mut paragraphs);
|
||||
resolve_citations(&mut paragraphs, &geometry.bibliography);
|
||||
append_bibliography(&mut paragraphs, &geometry.bibliography);
|
||||
append_bibliography(
|
||||
&mut paragraphs,
|
||||
&geometry.bibliography,
|
||||
geometry.ref_name.as_deref().unwrap_or("References"),
|
||||
);
|
||||
let line_width = geometry.line_width.unwrap_or(480 * SCALE);
|
||||
let base_units: Vec<Unit> = paragraphs
|
||||
.iter()
|
||||
@@ -6034,6 +6096,77 @@ A definition.
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn table_of_contents_starts_with_contents_heading() {
|
||||
let source = "\\tableofcontents\n\n\\section{Intro}\n\nText.";
|
||||
let (body, geometry) = geometry_and_body(source);
|
||||
let paragraphs =
|
||||
paragraphs_with_definitions(&body, &geometry.theorem_definitions).expect("blocks");
|
||||
let document = build_document(¶graphs, &geometry);
|
||||
let names: Vec<&str> = document
|
||||
.units
|
||||
.iter()
|
||||
.map(|unit| unit.source.as_str())
|
||||
.collect();
|
||||
assert_eq!(names[0], "Contents");
|
||||
assert_eq!(names[1], "1 Intro");
|
||||
assert_eq!(
|
||||
document
|
||||
.units
|
||||
.iter()
|
||||
.filter(|unit| unit.source == "Contents")
|
||||
.count(),
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn contents_names_follow_renewcommand() {
|
||||
let source = "\\renewcommand{\\contentsname}{Inhalt}\n\n\\tableofcontents\n\n\\section{Intro}\n\nText.";
|
||||
let (body, geometry) = geometry_and_body(source);
|
||||
assert_eq!(geometry.contents_name.as_deref(), Some("Inhalt"));
|
||||
let paragraphs =
|
||||
paragraphs_with_definitions(&body, &geometry.theorem_definitions).expect("blocks");
|
||||
let document = build_document(¶graphs, &geometry);
|
||||
assert_eq!(document.units[0].source, "Inhalt");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bibliography_starts_with_references_heading() {
|
||||
let source = "See \\cite{alpha}.\n\n\\begin{thebibliography}{9}\n\\bibitem{alpha} Alpha entry.\n\\end{thebibliography}";
|
||||
let (body, geometry) = geometry_and_body(source);
|
||||
let paragraphs =
|
||||
paragraphs_with_definitions(&body, &geometry.theorem_definitions).expect("blocks");
|
||||
let document = build_document(¶graphs, &geometry);
|
||||
let names: Vec<&str> = document
|
||||
.units
|
||||
.iter()
|
||||
.map(|unit| unit.source.as_str())
|
||||
.collect();
|
||||
let heading = names.iter().position(|name| *name == "References");
|
||||
let entry = names.iter().position(|name| *name == "[1] Alpha entry.");
|
||||
assert!(heading.is_some(), "{names:?}");
|
||||
assert!(entry.is_some(), "{names:?}");
|
||||
assert!(heading < entry, "{names:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reference_names_follow_renewcommand() {
|
||||
let source = "\\renewcommand{\\refname}{Literatur}\n\nSee \\cite{alpha}.\n\n\\begin{thebibliography}{9}\n\\bibitem{alpha} Alpha entry.\n\\end{thebibliography}";
|
||||
let (body, geometry) = geometry_and_body(source);
|
||||
assert_eq!(geometry.ref_name.as_deref(), Some("Literatur"));
|
||||
let paragraphs =
|
||||
paragraphs_with_definitions(&body, &geometry.theorem_definitions).expect("blocks");
|
||||
let document = build_document(¶graphs, &geometry);
|
||||
assert!(document.units.iter().any(|unit| unit.source == "Literatur"));
|
||||
assert!(
|
||||
!document
|
||||
.units
|
||||
.iter()
|
||||
.any(|unit| unit.source == "References")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bibliography_entries_resolve_citations() {
|
||||
let source = "See \\cite{alpha} and \\cite{alpha,beta}.\n\n\\begin{thebibliography}{9}\n\\bibitem{alpha} Alpha entry.\n\\bibitem{beta} Beta entry.\n\\end{thebibliography}";
|
||||
@@ -6301,7 +6434,7 @@ A definition.
|
||||
assert_eq!(geometry.tocdepth, Some(1));
|
||||
let mut blocks = paragraphs_with_definitions(&body, &[]).expect("paragraphs");
|
||||
number_sections(&mut blocks, 3);
|
||||
expand_toc(&mut blocks, 1);
|
||||
expand_toc(&mut blocks, 1, "Contents");
|
||||
let section = blocks.iter().filter(|block| block.text == "1 A").count();
|
||||
let subsection = blocks.iter().filter(|block| block.text == "1.1 B").count();
|
||||
assert_eq!(section, 2, "heading plus one TOC line");
|
||||
@@ -6331,7 +6464,7 @@ A definition.
|
||||
let source = "\\tableofcontents\n\n\\section{A}\n\n\\paragraph{P}";
|
||||
let mut blocks = paragraphs(source).expect("paragraphs");
|
||||
number_sections(&mut blocks, 3);
|
||||
expand_toc(&mut blocks, 3);
|
||||
expand_toc(&mut blocks, 3, "Contents");
|
||||
let paragraph_entries = blocks
|
||||
.iter()
|
||||
.filter(|block| block.text.trim() == "P")
|
||||
@@ -6378,10 +6511,11 @@ A definition.
|
||||
"{sources:?}"
|
||||
);
|
||||
assert!(!sources.iter().any(|source| source.contains("texrratoc")));
|
||||
assert_eq!(document.units[0].source, "1 Intro");
|
||||
assert_eq!(document.units[1].source, "1.1 Sub");
|
||||
assert_eq!(document.units[0].source, "Contents");
|
||||
assert_eq!(document.units[1].source, "1 Intro");
|
||||
assert_eq!(document.units[2].source, "1.1 Sub");
|
||||
assert_eq!(
|
||||
document.units[1]
|
||||
document.units[2]
|
||||
.paragraph_style
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
|
||||
Reference in new issue
Block a user