LayoutOptions: {
    backgroundColorMap: ((name: string) => string | undefined);
    colorMap: ((name: string) => string | undefined);
    defaultMode: "inline-math" | "math" | "text";
    letterShapeStyle:
        | "auto"
        | "tex"
        | "iso"
        | "french"
        | "upright";
    macros: MacroDictionary;
    minFontScale: number;
    registers: Registers;
}

Type declaration

  • backgroundColorMap: ((name: string) => string | undefined)
      • (name): string | undefined
      • Parameters

        • name: string

        Returns string | undefined

  • colorMap: ((name: string) => string | undefined)

    Map a color name as used in commands such as \textcolor{}{} or \colorbox{}{} to a CSS color value.

    Use this option to override the standard mapping of colors such as "yellow" or "red".

    If the name is not one you expected, return undefined and the default color mapping will be applied.

    If a backgroundColorMap() function is not provided, the colorMap() function will be used instead.

    If colorMap() is not provided, default color mappings are applied.

    The following color names have been optimized for a legible foreground and background values, and are recommended:

    • red, orange, yellow, lime, green, teal, blue, indigo, purple, magenta, black, dark-grey, grey, light-grey, white
      • (name): string | undefined
      • Parameters

        • name: string

        Returns string | undefined

  • defaultMode: "inline-math" | "math" | "text"

    The mode of the element when it is empty:

    • "math": equivalent to \displaystyle (display math mode)
    • "inline-math": equivalent to \inlinestyle (inline math mode)
    • "text": text mode
  • letterShapeStyle:
        | "auto"
        | "tex"
        | "iso"
        | "french"
        | "upright"

    Control the letter shape style:

    letterShapeStyle xyz ABC αβɣ ΓΔΘ
    iso it it it it
    tex it it it up
    french it up up up
    upright up up up up

    (it) = italic (up) = upright

    The default letter shape style is auto, which indicates that french should be used if the locale is "french", and tex otherwise.

    (Historical Note)

    Where do the "french" rules come from? The TeX standard font, Computer Modern, is based on Monotype 155M, itself based on the Porson greek font which was one of the most widely used Greek fonts in english-speaking countries. This font had upright capitals, but slanted lowercase. In France, the traditional font for greek was Didot, which has both upright capitals and lowercase.

  • macros: MacroDictionary

    A dictionary of LaTeX macros to be used to interpret and render the content.

    For example, to add a new macro to the default macro dictionary:

    mf.macros = {
    ...mf.macros,
    smallfrac: '^{#1}\\!\\!/\\!_{#2}',
    };

    Note that ...mf.macros is used to keep the existing macros and add to them. Otherwise, all the macros are replaced with the new definition.

    The code above will support the following notation:

    \smallfrac{5}{16}
    
  • minFontScale: number

    Set the minimum relative font size for nested superscripts and fractions. The value should be a number between 0 and 1. The size is in releative em units relative to the font size of the math-field element. Specifying a value of 0 allows the math-field to use its default sizing logic.

    Default: 0

  • registers: Registers

    LaTeX global registers override.