Inline KaTeX

Platen uses special notation for rendering mathematical and scientific formulas in your content by writing KaTeX markup as the alt text for an image link.

By default, when your KaTeX markup is rendered with an image link, it’s rendered as a <span> element without any additional styling.

To write longer KaTeX formulas with more control, use the katex codeblock instead.

Syntax #

Inline Syntaxes #

Basic Inline Syntax #

![katex:formula](source)
![katex:formula][<ReferenceID>]

[<ReferenceID>]: source

Examples #

1. KaTeX In a Paragraph #

Markdown Input
The Special Relativity Equation is defined as ![katex:E=mc^{2}](), where
![katex:E]() is energy, ![katex:m]() is mass, and ![katex:c]() is the speed
of light.

In plain words, energy equals mass times the speed of light squared.
HTML Output
<p>The Special Relativity Equation is defined as <span >\(E=mc^{2}\)</span>, where
<span >\(E\)</span> is energy, <span >\(m\)</span> is mass, and <span >\(c\)</span> is the speed
of light.</p>
<p>In plain words, energy equals mass times the speed of light squared.</p>
Rendered Output

The Special Relativity Equation is defined as \(E=mc^{2}\), where \(E\) is energy, \(m\) is mass, and \(c\) is the speed of light.

In plain words, energy equals mass times the speed of light squared.

Inputs #

This section describes how the normal markdown input for images works with the button render hook.

Images use this syntax for their inputs:

![alt_text](source)

alt_text (as formula) #

Specifies the KaTeX formula to render inline.

This value must start with the prefix katex:, math:, or chem:. For example, with the image link ![math:x=y^{2}](), text’s value would be x=y^{2}. The math and chem prefixes are included for readability and convenience. All three prefixes work the same way.

Platen inserts the formula in a <span> element with the formula wrapped in parentheses preceded by a backslash. The wrapping parentheses tell the KaTeX libraries to render the text inside them.

You can use any valid KaTeX functions and Platen will render them. If you use the \ce{...} expression for chemistry equations in a codeblock or give a codeblock the chem language ID, Platen loads the mhchem library for you.

Required: true
Type: KaTeX

source #

This value is ignored by Platen.

Edit this page