KaTeX can be used to generate complex math formulas. It supports in-line math using the \\( ... \\) delimiters, like this: \( E = mc^2 \). By default, it does not support in-line delimiters $...$ because those occur too commonly in typical webpages. It supports displayed math using the $$ or \\[...\\] delimiters, like this:

Formula 1: $$ \phi = \frac{(1+\sqrt{5})}{2} = 1.6180339887\cdots $$

Formula 2: (same formula, different delimiter) \[ \phi = \frac{(1+\sqrt{5})}{2} = 1.6180339887\cdots \]

Additional details can be found on GitHub or on the Wiki.

Example 1

If the text between $$ contains newlines it will rendered in display mode:

$ f $ $ ( $ x ) = \ i n t _ { - \ i n f t y } ^ \ i n f t y \ h a t f ( \ x i ) \ , e ^ { 2 \ p i i \ x i x } \ , d \ x i

$$ f(x) = \int_{-\infty}^\infty\hat f(\xi),e^{2 \pi i \xi x},d\xi $$

Example 2

$ \ $ $ f $ r a c { 1 } { \ B i g l ( \ s q r t { \ p h i \ s q r t { 5 } } - \ p h i \ B i g r ) e ^ { \ f r a c 2 5 \ p i } } = 1 + \ f r a c { e ^ { - 2 \ p i } } { 1 + \ f r a c { e ^ { - 4 \ p i } } { 1 + \ f r a c { e ^ { - 6 \ p i } } { 1 + \ f r a c { e ^ { - 8 \ p i } } { 1 + \ c d o t s } } } }

$$ \frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\cdots} } } } $$

Example 3

$ 1 $ $ $ + \ f r a c { q ^ 2 } { ( 1 - q ) } + \ f r a c { q ^ 6 } { ( 1 - q ) ( 1 - q ^ 2 ) } + \ c d o t s = \ p r o d _ { j = 0 } ^ { \ i n f t y } \ f r a c { 1 } { ( 1 - q ^ { 5 j + 2 } ) ( 1 - q ^ { 5 j + 3 } ) } , \ q u a d \ q u a d \ t e x t { f o r } \ l v e r t q \ r v e r t < 1 .

$$ 1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots = \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}, \quad\quad \text{for }\lvert q\rvert<1. $$

Example 4

Remember, certain characters are rendered by markdown, so you may need to workaround those issues. You can find the complete list of KaTeX supported functions here: https://khan.github.io/KaTeX/docs/supported.html

For example, the ' character can be replaced with ^\prime:

$$ G^\prime = G - u $$

The " character can be replaced with ^{\prime\prime}:

$$ G^{\prime\prime} = G^\prime - v $$