/* 0.85.2 */ /** * The mode that indicates how a portion of content is interpreted * */ export type ParseMode = 'math' | 'text' | 'latex'; /** * Error code passed to the [[`ErrorListener`]] function. * * See [[`MathfieldOptions`]], [[`convertLatexToMarkup`]] * * | | | | ------------------ | --- | | `unknown-command` | There is no definition available for this LaTeX command, e.g. `\zin` | | `unknown-environment` | There is no definition available for this environment, e.g. `\begin{foo}` | | `invalid-command` | This command is not valid in the current context (e.g. text command in math mode) | | `unbalanced-braces` | There are too many or too few `{` or `}` | | `unbalanced-environment` | An environment was open but never closed (`\begin{array}`) or the `\end` command does not match the `\begin` command (`\begin{array*}\end{array}`) | | `unbalanced-mode-shift` | A `$`, `$$`, `\(` or `\[` was not balanced | | `missing-argument` | A required argument is missing, e.g. `\frac{2}` | | `too-many-infix-commands` | A group can include only one infix command (i.e. `\choose`, `\atop`). In general it's best to avoid infix commands. | | `unexpected-command-in-string`| A command expected a string argument, but there was a command instead | | `missing-unit` | An argument requiring a dimension was missing an unit. | | `unexpected-delimiter` | An invalid symbol or command was used as a delimiter. | | `unexpected-token` | An unexpected character was encountered. | | `unexpected-end-of-string` | The end of the string was reached, but some required arguments were missing. | | `improper-alphabetic-constant` | The alphabetic constant prefix `` ` `` was not followed by a letter or single character command. | */ export type ParserErrorCode = 'unknown-command' | 'invalid-command' | 'unbalanced-braces' | 'unknown-environment' | 'unbalanced-environment' | 'unbalanced-mode-shift' | 'missing-argument' | 'too-many-infix-commands' | 'unexpected-command-in-string' | 'missing-unit' | 'unexpected-delimiter' | 'unexpected-token' | 'unexpected-end-of-string' | 'improper-alphabetic-constant'; export type LatexSyntaxError = { code: T; arg?: string; latex?: string; before?: string; after?: string; }; export type ErrorListener = (err: LatexSyntaxError) => void; /** * Variants indicate a stylistic alternate for some characters. * * Typically, those are controlled with explicit commands, such as `\mathbb{}` or * `\mathfrak{}`. This type is used with the [[`applyStyle`]] method to change * the styling of a range of selected characters. * * In mathematical notation these variants are used not only for visual * presentation, but they may have semantic significance. * * For example, the set โ„‚ should not be confused with the physical unit ๐–ข (Coulomb). * * When rendered, these variants can map to some built-in fonts. * LaTeX supports a limited set of characters. However, MathLive will * map characters not supported by LaTeX fonts(double-stuck variant for digits * for example) to a Unicode character (see [Mathematical Alphanumeric Symbols on Wikipedia](https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols) ). * * `normal` is a synthetic variant that maps either to `main` (roman) or * `math` (italic) depending on the symbol and the `letterShapeStyle`. * * The `math` variant has italic characters as well as slightly different * letter shape and spacing (a bit more space after the "f" for example), so * it's not completely equivalent to a `main` variant with `italic` variant style * applied. * * **See Also** * * [[`Style`]] */ export type Variant = 'ams' | 'double-struck' | 'calligraphic' | 'script' | 'fraktur' | 'sans-serif' | 'monospace' | 'normal' | 'main' | 'math'; /** * Some variants support stylistic variations. * * Note that these stylistic variations support a limited set of characters, * typically just uppercase and lowercase letters, and digits 0-9 in some cases. * | variant | `up` | `bold` | `italic` | `bolditalic` | | ------------------ | --- | --- | --- | --- | | `normal` | ABCabc012 | ๐€๐๐‚๐š๐›๐œ๐ŸŽ๐Ÿ๐Ÿ | ๐ด๐ต๐ถ๐‘Ž๐‘๐‘ | ๐‘จ๐‘ฉ๐‘ช๐’‚๐’ƒ๐’„ | | `double-struck` | ๐”ธ๐”นโ„‚๐•’๐•“๐•”๐Ÿ˜๐Ÿ™๐Ÿš | n/a | n/a | n/a | | `calligraphic` | ๐’œโ„ฌ๐’ž๐’ถ๐’ท๐’ธ | ๐“๐“‘๐“’๐“ช๐“ซ๐“ฌ | n/a | n/a | | `fraktur` | ๐”„๐”…โ„ญ๐”ž๐”Ÿ๐”  | ๐•ฌ๐•ญ๐•ฎ๐–†๐–‡๐–ˆ | n/a | n/a | | `sans-serif` | ๐– ๐–ก๐–ข๐–บ๐–ป๐–ผ๐Ÿข๐Ÿฃ๐Ÿค | ๐—”๐—•๐—–๐—ฎ๐—ฏ๐—ฐ๐Ÿฌ๐Ÿญ๐Ÿฎ | ๐˜ˆ๐˜‰๐˜Š๐˜ข๐˜ฃ๐˜ค | ๐˜ผ๐˜ฝ๐˜พ๐™–๐™—๐™˜ | | `monospace` | ๐™ฐ๐™ฑ๐™ฒ๐šŠ๐š‹๐šŒ | n/a | n/a | n/a | */ export type VariantStyle = 'up' | 'bold' | 'italic' | 'bolditalic' | ''; export type FontShape = 'auto' | 'n' | 'it' | 'sl' | 'sc' | ''; export type FontSeries = 'auto' | 'm' | 'b' | 'l' | ''; export type FontSize = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; /** * Use a `Style` object literal to modify the visual appearance of a * mathfield or a portion of a mathfield. * * You can control the color ("ink") and background color ("paper"), * the font variant, weight (`FontSeries`), size and more. * * **See Also** * * [`applyStyle`](http://cortexjs.io/docs/mathlive/?q=applyStyle) * * [Interacting with a Mathfield](/mathlive/guides/interacting/) */ export interface Style { color?: string; backgroundColor?: string; variant?: Variant; variantStyle?: VariantStyle; fontFamily?: string; fontShape?: FontShape; fontSeries?: FontSeries; fontSize?: FontSize | 'auto'; letterShapeStyle?: 'tex' | 'french' | 'iso' | 'upright' | 'auto'; } /** * **See Also** * * [[`MacroDictionary`]] * * [Macros](/mathlive/guides/macros/) * */ export type MacroDefinition = { /** Definition of the macro as a LaTeX expression */ def: string; args?: number; expand?: boolean; captureSelection?: boolean; }; export type MacroPackageDefinition = { package: Record; expand?: boolean; captureSelection?: boolean; }; /** * Glue represents flexible spacing, that is a dimension that * can grow (by the `grow` property) or shrink (by the `shrink` property). */ export type Glue = { glue: Dimension; shrink?: Dimension; grow?: Dimension; }; /** * */ export type DimensionUnit = 'pt' | 'mm' | 'cm' | 'ex' | 'px' | 'em' | 'bp' | 'dd' | 'pc' | 'in' | 'mu' | 'fil' | 'fill' | 'filll'; /** * A dimension is used to specify the size of things * */ export type Dimension = { dimension: number; unit?: DimensionUnit; }; export type RegisterValue = Dimension | Glue | number | string; /** * TeX registers represent 'variables' and 'constants'. * * Changing the values of some registers can modify the layout * of math expressions. * * The following registers might be of interest: * * - `thinmuskip` * - `medmuskip` * - `thickmuskip` * - `nulldelimiterspace` * - `delimitershortfall` * - `jot` */ export type Registers = Record; /** * A dictionary of LaTeX macros to be used to interpret and render the content. * * For example: ```javascript mf.setOptions({ macros: { smallfrac: '^{#1}\\!\\!/\\!_{#2}', }, }); ``` The code above will support the following notation: ```latex \smallfrac{5}{16} ``` * **See Also** * * [Macros Example](/mathlive/guides/macros/) */ export type MacroDictionary = Record | MacroPackageDefinition>;