pub struct MathInfo {
pub rows_span: Range<usize>,
pub row: usize,
pub glyph: Option<usize>,
pub tex: String,
pub display: bool,
pub src: usize,
}Expand description
One formula as a frontend sees it: where its picture goes, and the TeX to
typeset for it. Two shapes, told apart by glyph:
- An inline atom —
$E = mc^2$in a line of prose — is oneRole::Mathglyph onrowat indexglyph, standing for the whole formula. A frontend that paints pictures in a line typesets the TeX at the run’s font size and draws the picture in the glyph’s place, as wide as the picture is and with the text baseline through it at its height — a run delegate on Apple, an inline element on the web. The glyph is a caret stop at the formula’s start; the stop after it is the next glyph’s. - A display block — a paragraph holding nothing but
$$…$$— is the placeholder row (∑ tex, every glyph at the formula’s start) plus the blank fillersrows_spanreserves under it, exactly aMediaInfo’s shape. A frontend skips those rows and paints the picture there, centred on the measure.
Either way the frontend supplies the width: core lays out in glyphs and
cannot know how wide a typeset formula is, which is why an inline atom is
one glyph and not a run of them. Only in a column-wrapped build does
that matter to the wrap: a terminal never asks for atoms (see
Surface::inline_pictures), and the web re-fits a row the picture
overflows.
A plain surface paints the glyphs as they are — ∑ for an atom, the
labelled row for a block — and needs none of this. Derived from
VRow::math by [math_spans], so it survives the row reuse of
BlockCache and build_spliced.
Fields§
§rows_span: Range<usize>The VisualMap::rows rows this formula occupies: row..row + 1 for
an atom, the placeholder row and its fillers for a block.
row: usizeThe row the atom glyph, or the block’s placeholder label, is on.
glyph: Option<usize>The atom’s index into that row’s glyphs, or None for a block.
tex: StringThe TeX between the delimiters, verbatim.
display: boolDisplay style rather than text style — see MathMark::display.
src: usizeThe formula’s source start: where a click on its picture lands the caret, and the same offset every placeholder glyph carries.