Add KaTeX support (#164)

* Add render-latex-using-katex.md to Demonstarate how to use the katex

* Update math.html add katex scripts and css
This commit is contained in:
d-dandrew
2019-04-02 07:14:19 +08:00
committed by Luiz F. A. de Prá
parent 3483f16f21
commit 81666ed54b
2 changed files with 50 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
+++
date = "2019-03-20"
title = "Render LaTeX using KaTeX"
description = "Katex support demo"
katex = "true"
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
$$