advanced library
Engine-level access to val_latex: the lexer, the macro expander, the parser class and the symbol tables.
Most code only needs package:val_latex/val_latex.dart. This library is
for tooling (editors, linters, custom front ends) and may change more
often.
Classes
- AccentInfo
- An accent command.
- ClosePath
- Closes the current contour.
- CubicTo
- Cubic Bézier (CFF outlines).
- FontAxis
-
A design axis of a variable font (
fvar): weight (wght), width (wdth), optical size (opsz)…, in the font's own user units. - FunctionMacro
- A macro implemented in Dart. It may read further tokens through the MacroExpander and returns the tokens to expand to (possibly none).
- GlyphBounds
- An axis-aligned rectangle in font units, y up.
- GlyphConstruction
- How a glyph grows: ready-made larger variants, then an assembly.
- GlyphMetrics
- Size information for one glyph, in em.
- GlyphPart
- A piece of an extensible glyph assembly.
- GlyphPath
- A glyph outline.
- GlyphVariant
- One size variant of a glyph.
- LatexParser
- Parses LaTeX math into a MathNode tree.
- LetMacro
-
A control sequence made equal to a non-macro token with
\let, e.g.\let\foo\frac. Expanding it yields token, marked unexpandable. - Lexer
- Splits TeX source into Tokens.
- LineTo
- Straight line.
- MacroArgument
- A macro argument read by MacroExpander.
- MacroDefinition
- The meaning of a macro.
- MacroExpander
- Reads tokens from a Lexer and expands macros.
- MacroTable
- Macro definitions with TeX group scoping.
- MathConstants
-
The OpenType
MATHtable constants, in font units. - MathFont
-
A math font: an OpenType font with a
MATHtable, measured in em. - MathKern
- Math kerning for one corner of a glyph: kern values between heights.
- MathKernInfo
- The four math kern corners of a glyph.
- MoveTo
- Starts a new contour.
- NamedInstance
-
A named instance of a variable font (
fvar): "Bold", "Condensed Light"… and its axis values. - OpenTypeFont
- An OpenType (or TrueType) font, parsed in pure Dart.
- PathCommand
- A command of a glyph outline. Coordinates are in font units, y up.
- QuadTo
- Quadratic Bézier (TrueType outlines).
- SiOptions
-
siunitx's settings (
\sisetup{…}, a command's[…]) and declarations (\DeclareSIUnit,\DeclareSIPrefix,\DeclareSIQualifier,\DeclareSIPower). - StretchInfo
- How a glyph stretches, in em.
- StretchPart
- A size variant or assembly part in em.
- SymbolInfo
- What a math-mode symbol command means.
- Token
- One lexical token.
- TokenMacro
-
A macro whose expansion is a list of tokens with
#1…#9parameters.
Enums
- MathKernCorner
- A corner of a glyph for math kerning.
- Mode
-
Parsing mode, which some macros (
\TextOrMath,\dots) depend on. - PerMode
-
How
\peris written. - TokenKind
- What kind of Token this is.
Constants
-
braces
→ const Map<
String, (String, bool)> - Horizontal braces: command → (character, over).
-
combiningAccents
→ const Map<
String, String> - Combining marks the lexer keeps with their base, mapped to the spacing accent used when a mark sits on a math letter. Other combining marks (Arabic harakat, Indic signs) stay part of the text.
-
coreAccents
→ const Map<
String, AccentInfo> - The accent commands of LaTeX, AMS and KaTeX.
-
coreMathSymbols
→ const Map<
String, SymbolInfo> - The symbol commands of LaTeX, AMS and KaTeX.
-
coreTextSymbols
→ const Map<
String, String> - The text symbols of LaTeX and KaTeX.
-
dvipsColors
→ const Map<
String, int> -
xcolor's
dvipsnames: the 68 colours of the dvips driver, which graphics'drivers.dtxdefines in cmyk, converted to rgb as xcolor converts (1 − min(1, c + k)). Their names are case-sensitive, as in LaTeX, and win over the CSS colour spelt with the same letters:Greenis dvips' #00FF00,greenCSS's #008000 (as in MathJax, whose capitalised names are the dvips colours). -
extensibleArrowChars
→ const Map<
String, String> - The arrow each extensible arrow command stretches.
-
extensibleArrows
→ const Set<
String> -
Extensible arrow commands (
\xrightarrowfamily). -
limitsByDefault
→ const Set<
String> - Large-operator symbol commands whose limits go above and below in display style. Operators not listed (integrals) put them beside.
-
literalAtoms
→ const Map<
String, AtomType> - Atom classes of literal characters in math mode. Characters not listed fall back to atomForCharacter's rules.
-
literalReplacements
→ const Map<
String, String> -
Math-mode replacements for literal characters:
-is typeset as a minus sign,*as an asterisk operator. -
namedColors
→ const Map<
String, int> - Named colours: the CSS Color Module Level 4 names, a superset of xcolor's base names.
-
namedOperators
→ const Map<
String, bool> -
Named operators (
\sin,\lim) and whether they take limits above and below in display style. -
packageSymbols
→ const Map<
String, SymbolInfo> - Symbols of LaTeX packages that neither the core table nor unicode-math names: stmaryrd, wasysym, esint and the LaTeX kernel, each mapped to the Unicode character for its glyph. Symbols whose glyph has no clear Unicode counterpart are left out.
-
packageTextSymbols
→ const Map<
String, String> - textcomp (TS1) symbols that LaTeX's Unicode encoding does not name, where the glyph has a clear Unicode counterpart. Old-style figures are the plain digits.
-
tuTextSymbols
→ const Map<
String, String> -
LaTeX's text symbols (
\textpm,\guillemetleft,\textnumero…). -
unicodeMathAccents
→ const Map<
String, (String, bool, bool)> - unicode-math's accents: (combining character, wide, below).
-
unicodeMathSymbols
→ const Map<
String, SymbolInfo> -
unicode-math's symbol commands (
\lbag,\fint,\sslash…). -
unicodeMathUpright
→ const Map<
String, String> -
unicode-math's upright letters (
\mupalpha), set as\mathrmof the letter: the plain code point is italic in math.
Properties
-
accents
→ Map<
String, AccentInfo> -
Accent commands: coreAccents and unicode-math's.
final
-
mathSymbols
→ Map<
String, SymbolInfo> -
Math-mode symbol commands: coreMathSymbols, then unicode-math's
names (unicodeMathSymbols) and other packages' (packageSymbols)
for names the core does not have.
final
-
textSymbols
→ Map<
String, String> -
Text-mode symbol commands and the text they produce.
Text-mode symbol commands: coreTextSymbols, LaTeX's Unicode text
encoding (tuTextSymbols) and textcomp's other symbols
(packageTextSymbols).
final
Functions
-
angleToTex(
String input, {SiOptions options = const SiOptions()}) → String -
\ang{12;30;15}→12°30′15″;\ang{12.5}→12.5°. -
atomForCharacter(
String char) → AtomType - The atom class for a literal character typed in math mode.
-
ceToTex(
String input) → String -
Converts the argument of
\ceto TeX. -
complexQuantityToTex(
String number, String unit, {SiOptions options = const SiOptions()}) → String - A complex quantity: brackets around both parts before the unit.
-
complexToTex(
String input, {SiOptions options = const SiOptions()}) → String -
\complexnum{1+2i},\complexnum{1:30}(polar). -
delimiterText(
String text) → String? -
The Unicode delimiter for
text(a command or a character), or null if it is not a delimiter..means "no delimiter". -
durationToTex(
String input, {SiOptions options = const SiOptions()}) → String -
\duration{1;2;3}→1 h 2 min 3 s. -
fixedMacros(
Map< String, MacroDefinition> map) → Map<String, MacroDefinition> -
Marks
mapas never changing again (see MacroTable); returns it. -
hyphenationPoints(
String word) → List< int> -
Where
word(ASCII letters) may be hyphenated: the number of letters before each break, ascending. -
isDelimiter(
String text) → bool -
Whether
text(a command or a character) may follow\left,\right,\middleor\big. -
listToTex(
String items, {String? unit, SiOptions? options}) → String -
A list:
1, 2 and 3. -
numToTex(
String input, {SiOptions options = const SiOptions()}) → String -
A number: siunitx's
\num. Digit groups of three with thin spaces (from five digits), exponents as\times 10^{n}, uncertainties in brackets after the value (1.23(4)), as the options say. -
parseColor(
String text, {LatexColor? defined(String name)?}) → LatexColor? -
Parses a colour written as a name,
#rgb,#rrggbb,#rrggbbaa, barerrggbbhex (KaTeX accepts this) or an xcolor expression: a mix (red!30is 30 % red and 70 % white,red!30!blue30 % red and 70 % blue, and so on along the chain) or a complement (-red).definedgives the colours a formula defined (\definecolor), which win over the built-in names. Returns null iftextis not a colour. -
parseDimension(
String text) → Dimension? -
Parses a TeX dimension such as
-1.5emor3 mu. -
parseModelColor(
String model, String value, {LatexColor? defined(String name)?}) → LatexColor? -
Parses an xcolor model specification:
\color[rgb]{0.1,0.2,0.3}. Supported models:rgb(0–1),RGB(0–255),HTML(hex),gray(0–1),cmyk(0–1, converted as xcolor converts),named(a colour name,definedgiving a formula's own). Of a list of models (rgb/cmykwith1,0,0/0,1,1,0) the first is used. Returns null if the value is invalid. -
productToTex(
String items, {String? unit, SiOptions? options}) → String -
A product:
\numproduct{1 x 2 x 3},\qtyproduct{1 x 2}{\metre}. -
puToTex(
String input) → String -
Converts the argument of
\pu(a physical quantity) to TeX:123 kJ/mol→123\,\mathrm{kJ}/\mathrm{mol},1.2e3 m/s→1.2\cdot 10^{3}\,\mathrm{m}/\mathrm{s}. -
quantityToTex(
String number, String unit, {SiOptions options = const SiOptions()}) → String -
A number with a unit (
\qty,\SI). -
rangeToTex(
String a, String b, {String? unit, SiOptions? options}) → String -
A range:
1 to 10(siunitx's default phrase). -
unitToTex(
String input, {SiOptions options = const SiOptions()}) → String -
Units: siunitx unit macros (
\kilo\metre\per\second\squared) or literal text (km/s,kg.m/s^2).
Exceptions / Errors
- FontFormatException
- Thrown when font data is malformed.