2019-04-01 23:14:19 +00:00
|
|
|
+++
|
|
|
|
date = "2019-03-20"
|
|
|
|
title = "Render LaTeX using KaTeX"
|
|
|
|
description = "Katex support demo"
|
2019-09-19 13:08:54 +00:00
|
|
|
katex = true
|
2019-04-01 23:14:19 +00:00
|
|
|
series = ["Theme", "Hugo"]
|
|
|
|
+++
|
|
|
|
|
|
|
|
Enable katex by adding `katex = "true"` to the [front matter](https://gohugo.io/content-management/front-matter/)
|
|
|
|
|
|
|
|
```toml
|
|
|
|
+++
|
|
|
|
katex = "true"
|
|
|
|
+++
|
|
|
|
```
|
|
|
|
|
|
|
|
It's almost a dropin alternative to the mathjax solution,you should just choose one of them.
|
|
|
|
|
|
|
|
Inline math looks like this
|
|
|
|
|
|
|
|
```tex
|
|
|
|
This is text with inline math $\sum_{n=1}^{\infty} 2^{-n} = 1$
|
|
|
|
```
|
|
|
|
|
|
|
|
This is text with inline math $\sum_{n=1}^{\infty} 2^{-n} = 1$
|
|
|
|
and with math blocks:
|
|
|
|
|
|
|
|
```tex
|
|
|
|
$$
|
|
|
|
\sum_{n=1}^{\infty} 2^{-n} = 1
|
|
|
|
$$
|
|
|
|
```
|
|
|
|
|
|
|
|
$$
|
|
|
|
\sum_{n=1}^{\infty} 2^{-n} = 1
|
|
|
|
$$
|