From 0299aa32d307c5584e6a281f02bed54b0affefe5 Mon Sep 17 00:00:00 2001 From: slashformotion Date: Wed, 28 Jul 2021 11:02:23 +0200 Subject: [PATCH] Fix #7: katex now work as expected --- README.md | 8 ++++---- exampleSite/content/post/more-maths.md | 4 ++-- exampleSite/content/post/tufte-features.md | 20 ++++++++++---------- layouts/partials/math.html | 2 +- static/js/main.js | 22 ++++++++++------------ 5 files changed, 27 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 03c2783..46046c7 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ This is a fork of the original [hugo-tufte](https://github.com/shawnohare/hugo-t [katex](https://katex.org/) renders LaTeX written inside of markdown files. LaTeX can be written more or less as normal. Some examples: -- This `\\( \frac{1}{2} \\)` will be rendered inline. +- This `$ \frac{1}{2} $` will be rendered inline. - A simple displayed equation: `$$f(x, y) := e^{x^2 - y^2}.$$` There currently seems to be some weirdness with other environments, @@ -33,12 +33,12 @@ Let $G$ be a finite group with exponent $2$. Then every element is an involution, hence for any $x$, $y$ in $G$ we have:

-\begin{align*} +\begin{aligned} e &= (xy)^2 \\ &=xyxy \implies \\ y^{-1} &= xyx \implies \\ y^{-1}x^{-1} &= xy, -\end{align*} +\end{aligned*}

establishing that $G$ is abelian. @@ -104,7 +104,7 @@ support all the features present in the ```html {{< epigraph pre="Author Writer, " cite="Math is Fun" >}} This is an example of an epigraph with some math - \\( \mathbb N \subseteq \mathbb R \\) + $ \mathbb N \subseteq \mathbb R $ to start the beginning of a section. {{< /epigraph >}} ``` diff --git a/exampleSite/content/post/more-maths.md b/exampleSite/content/post/more-maths.md index 0872600..a8b6c38 100644 --- a/exampleSite/content/post/more-maths.md +++ b/exampleSite/content/post/more-maths.md @@ -4,12 +4,12 @@ meta = false author = "AUTHOR NAME" date = "2021-07-20T13:56:01-08:00" type = "post" -title = "More math \\(\\xi_{(even-in-the-title-!)}\\)" +title = "More math $\\xi_{(even-in-the-title-!)}$" subtitle = "Wow this really works ! " toc = true categories = ["katex", "latex", "tufte-css"] +++ -A compilation of \\(\LaTeX\\) formulas... +A compilation of $\LaTeX$ formulas... ## Matrix diff --git a/exampleSite/content/post/tufte-features.md b/exampleSite/content/post/tufte-features.md index 0df7678..3eeb235 100644 --- a/exampleSite/content/post/tufte-features.md +++ b/exampleSite/content/post/tufte-features.md @@ -12,13 +12,13 @@ categories = ["katex", "latex", "tufte-css"] +++ This is a quick demonstration post. It serves as an example of the features -of this theme. One of them is \\( \LaTeX \\) via [Katex](https://katex.org/). +of this theme. One of them is $ \LaTeX $ via [Katex](https://katex.org/). {{< section "begin" >}} ## A Bit About Mathematics {{< epigraph pre="Shawn O'Hare, " cite="Math is Fun" >}} This is an example of an epigraph with some math -\\( \mathbb N \subseteq \mathbb R \\) +$ \mathbb N \subseteq \mathbb R $ to start the beginning of a section. {{< /epigraph >}} @@ -27,20 +27,20 @@ to start the beginning of a section. ### Inline Some inline math: {{< marginnote "mn-example" >}}This is a margin note.{{< /marginnote >}} -\\(e^{i \pi} = -1\\) - and \\(\sqrt{-1} = i \\) -and \\( a_2 = 3 \\). +$e^{i \pi} = -1$ + and $\sqrt{-1} = i $ +and $ a_2 = 3 $. ### Display -And display math using escaped brackets `\\[`: +And display math using this symbol `$$`: {{< sidenote "sn-example" >}}This is a sidenote!{{< /sidenote >}} -\\[ +$$ -- \cdot_H -- \colon B(G,H) \times B(H, K) \to B(G, K), \quad ([X], [Y]) \mapsto [X \times_H Y]. -\\] +$$ ### Environments -Currently, certain \\(\LaTeX\\) environments need to be escaped so that +Currently, certain $\LaTeX$ environments need to be escaped so that the markdown processor does not override Katex. Currently, display environments should be enclosed in `

` tags and blank lines. For instance: @@ -77,7 +77,7 @@ $$ ### Blockquotes Some blockquotes. But first, we try to manually cite via -This is between cite tags and has math: \\(e^x \\) +This is between cite tags and has math: $e^x $ {{< blockquote cite="www.shawnohare.com" footer="Shawn O'Hare" >}} This is a blockquote with two paragraphs, that employs the diff --git a/layouts/partials/math.html b/layouts/partials/math.html index caee35d..dff31cd 100644 --- a/layouts/partials/math.html +++ b/layouts/partials/math.html @@ -1,4 +1,4 @@ - + diff --git a/static/js/main.js b/static/js/main.js index 4b7a7af..6f19105 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1,14 +1,12 @@ - \ No newline at end of file + { left: "$$", right: "$$", display: true }, + { left: "\\[", right: "\\]", display: true }, + { left: "$", right: "$", display: false }, + { left: "\\(", right: "\\)", display: false } + ], + displayMode: true + } +); \ No newline at end of file