Expand description
GridCraft equations. LaTeX source is laid out by RaTeX (ratex-parser, ratex-layout; MIT)
into a MathList: plain glyph, rule and path data that the UI and the PDF writer paint
without calling RaTeX again.
RaTeX is young (0.1.x), so it only ever runs inside this crate’s entry points (layout,
to_omml, check). Each one caps its input (4 KB, nesting 32) and runs under
catch_unwind, so a stray panic becomes a MathError. See the RaTeX gate in
docs/decisions.md and tests/gate.rs.
Units are em: one em is the equation’s font size. Coordinates run right and down from the
top-left of the list’s box; the baseline is at y = height.
Structs§
- Glyph
- One character.
- Math
Error - Why an equation could not be laid out.
- Math
List - A laid-out equation.
- Path
- A vector outline (stretchy braces, arrows, radicals), relative to
(x, y). - Rule
- A filled rectangle (fraction bars, radical vinculums, table rules, box borders).
Enums§
Constants§
- GALLERY
- The equation gallery (Insert › Equation): GridCraft’s own examples, as (name, LaTeX).
- MAX_
DEPTH - Deepest nesting of
{…},\left…\rightand\begin…\endaccepted. - MAX_EM
- Largest coordinate or size accepted in a layout, in em.
\rule{1e308em}{1em}lays out; this stops it from reaching a painter. - MAX_
ITEMS - Most items one equation may produce.
- MAX_
SOURCE_ BYTES - Longest source accepted, in bytes.
Statics§
- SOURCE_
TOO_ LONG - The error for a source over
MAX_SOURCE_BYTES. It is one shared value so that a cache can answer for such a source by its length alone, without reading it.
Functions§
- check
- Whether
latexparses, without laying it out (cheap enough to run on every keystroke). - layout
- Lays
latexout. Errors carry the offending span when RaTeX reports one. - to_omml
latexas an<m:oMath>element (prefixmfor the OMML namespace andafor DrawingML, declared by the caller), with runs atsize_ptpoints in theinkcolour (none: the paragraph’s own).