##
HelloThere

This is a TiddlyWiki plugin for mathematical typesetting based on KaTeX from Khan Academy.

It is completely self-contained, and doesn't need an Internet connection in order to work. It works both in the browser and under Node.js.

# Installation

To add the plugin to your own TiddlyWiki5, just drag this link to the browser window:

$:/plugins/tiddlywiki/katex

# Using KaTeX

The usual way to include LaTeX is to use `$$`, as shown in the examples below.

The underlying KaTeX widget is provided under the name `<$latex>` and is also available under the alias `<$katex>`. It's better to use the generic `<$latex>` name unless you are running multiple LaTeX plugins and wish to specifically target KaTeX.

# Examples

These examples are taken from http://khan.github.io/KaTeX/

## Example 1

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

f(x)=∫​−∞​∞​​​f​^​​(ξ)e​2 π i ξ x​​d ξ

## Example 2

    $$\displaystyle \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} } } }$$

​(√​ϕ√​5​​​​​​−ϕ)e​​5​​2​​π​​​​1​​=1+​1+​1+​1+​1+⋯​​e​−8 π​​​​​​e​−6 π​​​​​​e​−4 π​​​​​​e​−2 π​​​​

## Example 3

    $$\displaystyle \left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)$$

(​k=1​∑​n​​a​k​​b​k​​)​2​​≤(​k=1​∑​n​​a​k​2​​)(​k=1​∑​n​​b​k​2​​)

## Example 4

    $$\displaystyle 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.$$

1+​(1−q)​​q​2​​​​+​(1−q)(1−q​2​​)​​q​6​​​​+⋯=​j=0​∏​∞​​​(1−q​5 j+2​​)(1−q​5 j+3​​)​​1​​,f o r ∣q∣<1.

## Widget Example

For more flexibility the KaTeX widget can also be used via the full widget syntax:

    <$latex text="\displaystyle f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi"></$latex>

f(x)=∫​−∞​∞​​​f​^​​(ξ)e​2 π i ξ x​​d ξ

# Error Handling

An warning message is displayed if KaTeX detects a problem with the LaTeX syntax. For example:

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

ParseError: KaTeX parse error: Expected group after '^' at position 36: \int_{-\infty}^̲\infinity\hat