Math
Th' math shortcode renders complex math an' chemical formulae us'n Hugo’s built-in KaTeX.
Usage
Ye can also use pure Marrrkdown fer writ'n simple math expressions.
Passthrough rules finds yer formulae by their delimiters an' requires th' Passthrough configurat'n. It has limited features as it does not provide any o' th' below parameters besides rrrambl'n. Nevertheless, it be widely avail'ble 'n other Marrrkdown parsers like GitHub an' therefore be th' recommended rules fer generat'n portable Marrrkdown.
Th' codefence, shortcode an' partial rules take yer formula without delimiters.
Parameters
| Name | Default | Notes |
|---|---|---|
| align | center |
Th' horizontal alignment. Allowed values be left, center or right. |
| <option> | <empty> | Any option o' Hugo’s transform.ToMath funct'n fer this formula. It overwrites th' option o' th' same name o' yer configurat'n.displayMode defaults t' true, display'n th' formula as a block. Set it t' false t' display th' formula inline. Wit' Passthrough rules, it be decided by th' delimiters around yer formula.Not avail'ble fer th' codefence rules, which always displays th' formula as a block. |
| <content> | <empty> | Yer formula without delimiters. |
Sett'ns
Output o' th' Formulae
Opt'n Front Matter By default, formulae be written as MathML, which every current browser displays without any stylesheet or font o' th' theme. Th' display quality depends on th' browser an' th' math fonts installed on yer reader’s system.
If ye want yer formulae t' look th' same 'n every browser, set math.toMath.output t' htmlAndMathml. Th' theme then links th' KaTeX stylesheet an' fonts t' every plank contain'n math. Th' MathML be kept fer screen readers. Th' value html omits it.
Provid'n Opt'ns fer KaTeX
Opt'n Front Matter Besides output, ye can set every option o' Hugo’s transform.ToMath funct'n 'n math.toMath, fer example yer own macros. displayMode be ignored here, as it be decided fer each formula by its delimiters or th' parameters o' its call.
Each option o' yer page’s front matter overwrites th' option o' th' same name o' yer configurat'n options.
Cap'n Hugo lowercases th' names o' a map 'n yer configurat'n an' front matter, so a macro \Field would be known as \field. Give yer macros as a list o' name an' definit'n pairs instead.
A formula that KaTeX can not render be written as its source an' reported as a warning 'n yer build.
Force Load'n o' th' KaTeX Stylesheet
Opt'n Front Matter If yer output needs th' KaTeX stylesheet, it will be linked t' yer plank if th' plank contains a math shortcode, Marrrkdown codefence, Passthrough rules or th' partial be called from yer templates.
If ye write KaTeX’s HTML by other means, ye can force link'n th' stylesheet by sett'n math.force t' true. If a formula was rendered, th' option has no effect.
Sett'n math t' true does th' same but can’t be combined wit' other math.* options.
Passthrough Configurat'n
Passthrough rules lets ye write math without enclos'n it 'n a shortcode or Marrrkdown codefence. Th' theme finds yer formulae by th' delimiters o' Hugo’s Passthrough configurat'n, so it be required fer this rules.
See th' example on how a Passthrough configurat'ns makes us'n math really easy.
Examples
Block Math
Wit' th' above Passthrough configurat'n, block math be generated if ye use two consecutive $$ as a delimiter around yer formulae.
Inline Math
Wit' th' above Passthrough configurat'n, inline math be generated if ye use a single $ as a delimiter around yer formulae. Wit' th' shortcode an' partial, set displayMode t' false.
Block Math wit' Right Alignment
Wit' Passthrough rules, only th' rrrambl'n parameter be avail'ble.
Chemical Formulae
KaTeX can also render chemical formulae.