Math equations with KaTeX
is “the fastest math typesetting library for the web.”
Usage
To enable KaTeX in Papicu, add katex:
true
to a post or page’s front matter. Then, inside your Markdown content, add the desired expression between $$
, like: $$ expression $$
.
Examples
Here’s an example of a KaTeX expression displayed inline: .
You can also give the formula more space to breath by leaving the expression (sidenote: In case you are curious, is a definition of the Gompertz hazard function.) alone on a paragraph. KaTeX will automatically center it:
code
snippet
Here's an example of a KaTeX expression displayed inline: $$h(x) = B e^{C x}$$.
[...] KaTeX will automatically center it:
$$h(x) = B e^{C x}$$
Here’s a more elaborate example, taking advantage of KaTeX’s environments:
code
snippet
$$
\begin{equation*}
\begin{split}
a &=b+c \\
&=e+f
\end{split}
\end{equation*}
$$
Overflow shouldn’t be an issue
What happens with our layout in case of a long KaTeX expression?
Let’s test it out:
code
snippet
$$ \text{a very very very very very very very very very very very very very very very long expression} $$
As you can see, Papicu limits the visible width of any KaTeX expression. And, if necessary, it automatically adds horizontal scrolling and a nice little tip.
Supported TeX functions
Check out KaTeX docs for the TeX functions they support. The list is available either sorted alphabetically or grouped by topic.
March 2022