Skip to content

MathConfiguration

Type of the configuration object used to configure the math processor.

This is the resolved configuration the math handler is constructed with.

Shared properties

These apply regardless of the selected backend.

delims? { … }types/handlers/Math.ts:183-295

Which math-delimiter shapes SvelTeX should recognise and forward to the math backend. Toggles per-shape detection of $…$, $$…$$, \(…\), \[…\], and the dollar-delimited inline-vs-display disambiguation; anything you switch off here is left as ordinary markdown text. See the child fields below for the individual delimiter shapes.

Delimiters that can be enabled or disabled whose content will always be treated as display math.

If this is set to false, content inside $...$, $$...$$, $$$...$$$, etc. will not be processed by the math processor, and won't be escaped either, meaning that the markdown processor will process it however it sees fit.

Default

ts
`true` if and only if the math backend isn't `'none'`.

Setting this to false renders inline.singleDollar and doubleDollarSignsDisplay useless.

doubleDollarSignsDisplay?"always" | "newline" | "fenced" | undefinedtypes/handlers/Math.ts:289-293

Controls when dollar-delimited math should be treated as display math.

  • 'always': Always display $$...$$ as display math.
  • 'newline': Display $$...$$ as display math iff it's on its own line(s) (i.e., if it matches /^\s*\$\$.*?\$\$\s*$/msu).
  • 'fenced': Display $$...$$ as display math iff the opening and closing delimiters each have an entire line for themselves.

Default 'fenced'

Example

Consider the following markdown:

md
text $$ a $$ text

$$ b $$

$$
c
$$

The following table shows how the isDisplayMath setting would affect the rendering of the math blocks:

'always''newline''fenced'
adisplayinlineinline
bdisplaydisplayinline
cdisplaydisplaydisplay

Delimiters that can be enabled or disabled whose content will always be treated as inline math.

mathjax backend

Options available when the backend is mathjax.

css? ({ type?: "hybrid" | "none" | undefined; } & (HybridCssConfiguration | Ntypes/handlers/Math.ts:106-119

MathJax needs CSS to work properly. By default, Sveltex takes care of this itself. This property allows you to configure this behavior.

font? MathjaxFont | undefinedtypes/handlers/Math.ts:155

Warning You'll have to delete the previous MathJax CSS file generated by SvelTeX if you change this property, otherwise the changes won't take effect.

Pick a font to use for MathJax.

  • 'newcm': "Based on New Computer Modern (now the default font)".
  • 'asana': "A version of the Asana-Math font".
  • 'bonum': "A version of the Gyre Bonum font".
  • 'dejavu': "A version of the Gyre DejaVu font".
  • 'fira': "A version of the Fira and Fira-Math fonts".
  • 'modern': "A version of Latin-Modern".
  • 'pagella': "A version of the Gyre Pagella font".
  • 'schola': "A version of the Gyre Schola font".
  • 'stix2': "A version of the STIX2 font".
  • 'termes': "A version of the Gyre Termes font".
  • 'tex': "The original MathJax TeX font".

Default 'newcm'

mathjax? MathjaxConfiguration | undefinedtypes/handlers/Math.ts:100

Configuration options for MathJax.

outputFormat? "svg" | "chtml" | undefinedtypes/handlers/Math.ts:95

Default 'chtml'

transformers? Transformerstypes/handlers/Math.ts:305-307

Transformers to apply to

  • the TeX code before passing it to the math backend for processing, or to
  • the output produced by the math backend.
post?Transformer<Options & WithOriginal> | Transformer<Options & WithOriginal…types/handlers/Handler.ts:58-62

Transformations to apply to the output produced by the backend.

Each transformation may be a function (str: string, opts: Options) => string, or a 2-tuple [string | RegExp, string]. The transformers are called in the order they are listed on the output of the previous transformation (or on the original content if it's the first transformation). Each transformation transformation is applied as follows, depending on its type:

  • 2-tuple: transformed = content.replaceAll(...transformation)
  • Function: transformed = transformation(content, opts)
pre?Transformer<Options> | Transformer<Options>[] | null | undefinedtypes/handlers/Handler.ts:44

Transformations to apply to the content before passing it to the backend for processing.

Each transformation may be a function (str: string, opts: Options) => string, or a 2-tuple [string | RegExp, string]. The transformers are called in the order they are listed on the output of the previous transformation (or on the original content if it's the first transformation). Each transformation transformation is applied as follows, depending on its type:

  • 2-tuple: transformed = content.replaceAll(...transformation)
  • Function: transformed = transformation(content, opts)

katex backend

Options available when the backend is katex.

css? ({ type?: "cdn" | "hybrid" | "none" | undefined; } & (HybridCssConfigura…types/handlers/Math.ts:60-75

KaTeX needs CSS to work properly. By default, Sveltex takes care of this itself. This property allows you to configure this behavior.

katex? Omit<KatexOptions, "displayMode"> | undefinedtypes/handlers/Math.ts:55

transformers? Transformerstypes/handlers/Math.ts:305-307

Transformers to apply to

  • the TeX code before passing it to the math backend for processing, or to
  • the output produced by the math backend.
post?Transformer<Options & WithOriginal> | Transformer<Options & WithOriginal…types/handlers/Handler.ts:58-62

Transformations to apply to the output produced by the backend.

Each transformation may be a function (str: string, opts: Options) => string, or a 2-tuple [string | RegExp, string]. The transformers are called in the order they are listed on the output of the previous transformation (or on the original content if it's the first transformation). Each transformation transformation is applied as follows, depending on its type:

  • 2-tuple: transformed = content.replaceAll(...transformation)
  • Function: transformed = transformation(content, opts)
pre?Transformer<Options> | Transformer<Options>[] | null | undefinedtypes/handlers/Handler.ts:44

Transformations to apply to the content before passing it to the backend for processing.

Each transformation may be a function (str: string, opts: Options) => string, or a 2-tuple [string | RegExp, string]. The transformers are called in the order they are listed on the output of the previous transformation (or on the original content if it's the first transformation). Each transformation transformation is applied as follows, depending on its type:

  • 2-tuple: transformed = content.replaceAll(...transformation)
  • Function: transformed = transformation(content, opts)

custom backend

Options available when the backend is custom.

process (tex: string, options: { inline?: boolean | undefined; options?: (WithDetypes/handlers/Math.ts:49

transformers? Transformerstypes/handlers/Math.ts:305-307

Transformers to apply to

  • the TeX code before passing it to the math backend for processing, or to
  • the output produced by the math backend.
post?Transformer<Options & WithOriginal> | Transformer<Options & WithOriginal…types/handlers/Handler.ts:58-62

Transformations to apply to the output produced by the backend.

Each transformation may be a function (str: string, opts: Options) => string, or a 2-tuple [string | RegExp, string]. The transformers are called in the order they are listed on the output of the previous transformation (or on the original content if it's the first transformation). Each transformation transformation is applied as follows, depending on its type:

  • 2-tuple: transformed = content.replaceAll(...transformation)
  • Function: transformed = transformation(content, opts)
pre?Transformer<Options> | Transformer<Options>[] | null | undefinedtypes/handlers/Handler.ts:44

Transformations to apply to the content before passing it to the backend for processing.

Each transformation may be a function (str: string, opts: Options) => string, or a 2-tuple [string | RegExp, string]. The transformers are called in the order they are listed on the output of the previous transformation (or on the original content if it's the first transformation). Each transformation transformation is applied as follows, depending on its type:

  • 2-tuple: transformed = content.replaceAll(...transformation)
  • Function: transformed = transformation(content, opts)

none backend

Options available when the backend is none.

transformers? Transformerstypes/handlers/Math.ts:305-307

Transformers to apply to

  • the TeX code before passing it to the math backend for processing, or to
  • the output produced by the math backend.
post?Transformer<Omit<{ inline?: boolean | undefined; options?: (WithDelims &types/handlers/Handler.ts:58-62

Transformations to apply to the output produced by the backend.

Each transformation may be a function (str: string, opts: Options) => string, or a 2-tuple [string | RegExp, string]. The transformers are called in the order they are listed on the output of the previous transformation (or on the original content if it's the first transformation). Each transformation transformation is applied as follows, depending on its type:

  • 2-tuple: transformed = content.replaceAll(...transformation)
  • Function: transformed = transformation(content, opts)
pre?Transformer<Omit<{ inline?: boolean | undefined; options?: (WithDelims &types/handlers/Handler.ts:44

Transformations to apply to the content before passing it to the backend for processing.

Each transformation may be a function (str: string, opts: Options) => string, or a 2-tuple [string | RegExp, string]. The transformers are called in the order they are listed on the output of the previous transformation (or on the original content if it's the first transformation). Each transformation transformation is applied as follows, depending on its type:

  • 2-tuple: transformed = content.replaceAll(...transformation)
  • Function: transformed = transformation(content, opts)