diff options
author | WayJam So <imsuwj@gmail.com> | 2020-05-03 15:29:11 +0300 |
---|---|---|
committer | WayJam So <imsuwj@gmail.com> | 2020-05-03 15:29:11 +0300 |
commit | 4684fca2c8817b1baf2c2be7ff3993b2080a62a1 (patch) | |
tree | 67cc7ea378b02e21b0504ac8e4dcaa7a40b68ac7 /exampleSite/content/posts/math-typesetting.mmark |
Initial
Diffstat (limited to 'exampleSite/content/posts/math-typesetting.mmark')
-rwxr-xr-x | exampleSite/content/posts/math-typesetting.mmark | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/exampleSite/content/posts/math-typesetting.mmark b/exampleSite/content/posts/math-typesetting.mmark new file mode 100755 index 0000000..471a858 --- /dev/null +++ b/exampleSite/content/posts/math-typesetting.mmark @@ -0,0 +1,38 @@ +--- +author: Hugo Authors +title: Math Typesetting +date: 2019-12-12 +description: A brief guide to setup KaTeX +markup: mmark +type: "post" +--- + +Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries. + +In this example we will be using [KaTeX](https://katex.org/) + +- Create a partial under `/layouts/partials/math.html` +- Within this partial reference the [Auto-render Extension](https://katex.org/docs/autorender.html) or host these scripts locally. +- Include the partial in your templates like so: + +``` +{{ if or .Params.math .Site.Params.math }} +{{ partial "math.html" . }} +{{ end }} +``` +- To enable KaTex globally set the parameter `math` to `true` in a project's configuration +- To enable KaTex on a per page basis include the parameter `math: true` in content files. + +**Note:** Use the online reference of [Supported TeX Functions](https://katex.org/docs/supported.html) + + +### Examples + +Inline math: $$ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887… $$ + +Block math: + +$$ + \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } +$$ + |