diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 1bd0698..ef07e39 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -22,6 +22,7 @@ disqusShortname = "yourdiscussshortname" # For more date formats see https://gohugo.io/functions/format/ dateFormat = "Jan 2, 2006" codePenUser = "someUser" + katex = true [menu] [[menu.nav]] diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index b24cc8e..f424523 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -22,6 +22,7 @@ params: # For more date formats see https://gohugo.io/functions/format/ dateFormat: Jan 2, 2006 codePenUser: someUser + katex: true menu: nav: diff --git a/exampleSite/content/post/katex-math-typesetting/index.md b/exampleSite/content/post/katex-math-typesetting/index.md new file mode 100644 index 0000000..d4a368e --- /dev/null +++ b/exampleSite/content/post/katex-math-typesetting/index.md @@ -0,0 +1,29 @@ +--- +title: "Katex Math Typesetting" +date: 2019-03-28 +tags: [katex, math, typesetting, hugo] +--- + +Enable Katex in the config file by setting the `katex` param to `true`. This will import the necessary Katex CSS/JS. + +**Note:** Use the online reference of [supported TeX functions](https://katex.org/docs/supported.html). + +Some math: + +``` +$$ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887… $$ +``` + +$$ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887… $$ + +More math: + +``` +$$ +\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } +$$ +``` + +$$ +\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } +$$ diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 262b68e..f01fa3e 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -14,6 +14,7 @@ {{ partial "script.html" . }} + {{ partial "katex.html" . }} {{ partial "google-analytics-async.html" . }} diff --git a/layouts/partials/katex.html b/layouts/partials/katex.html new file mode 100644 index 0000000..7410749 --- /dev/null +++ b/layouts/partials/katex.html @@ -0,0 +1,5 @@ +{{ if eq $.Site.Params.katex true }} + + + +{{ end }} \ No newline at end of file