forked from mirrors/hugo-tufte
Fix #7: katex now work as expected
This commit is contained in:
parent
63de5c8780
commit
0299aa32d3
5 changed files with 27 additions and 29 deletions
|
@ -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
|
[katex](https://katex.org/) renders LaTeX written inside of markdown files. LaTeX can be
|
||||||
written more or less as normal. Some examples:
|
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}.$$`
|
- A simple displayed equation: `$$f(x, y) := e^{x^2 - y^2}.$$`
|
||||||
|
|
||||||
There currently seems to be some weirdness with other environments,
|
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:
|
an involution, hence for any $x$, $y$ in $G$ we have:
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
\begin{align*}
|
\begin{aligned}
|
||||||
e &= (xy)^2 \\
|
e &= (xy)^2 \\
|
||||||
&=xyxy \implies \\
|
&=xyxy \implies \\
|
||||||
y^{-1} &= xyx \implies \\
|
y^{-1} &= xyx \implies \\
|
||||||
y^{-1}x^{-1} &= xy,
|
y^{-1}x^{-1} &= xy,
|
||||||
\end{align*}
|
\end{aligned*}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
establishing that $G$ is abelian.
|
establishing that $G$ is abelian.
|
||||||
|
@ -104,7 +104,7 @@ support all the features present in the
|
||||||
```html
|
```html
|
||||||
{{< epigraph pre="Author Writer, " cite="Math is Fun" >}}
|
{{< epigraph pre="Author Writer, " cite="Math is Fun" >}}
|
||||||
This is an example of an epigraph with some math
|
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.
|
to start the beginning of a section.
|
||||||
{{< /epigraph >}}
|
{{< /epigraph >}}
|
||||||
```
|
```
|
||||||
|
|
|
@ -4,12 +4,12 @@ meta = false
|
||||||
author = "AUTHOR NAME"
|
author = "AUTHOR NAME"
|
||||||
date = "2021-07-20T13:56:01-08:00"
|
date = "2021-07-20T13:56:01-08:00"
|
||||||
type = "post"
|
type = "post"
|
||||||
title = "More math \\(\\xi_{(even-in-the-title-!)}\\)"
|
title = "More math $\\xi_{(even-in-the-title-!)}$"
|
||||||
subtitle = "Wow this really works ! "
|
subtitle = "Wow this really works ! "
|
||||||
toc = true
|
toc = true
|
||||||
categories = ["katex", "latex", "tufte-css"]
|
categories = ["katex", "latex", "tufte-css"]
|
||||||
+++
|
+++
|
||||||
A compilation of \\(\LaTeX\\) formulas...
|
A compilation of $\LaTeX$ formulas...
|
||||||
<!--more-->
|
<!--more-->
|
||||||
|
|
||||||
## Matrix
|
## Matrix
|
||||||
|
|
|
@ -12,13 +12,13 @@ categories = ["katex", "latex", "tufte-css"]
|
||||||
+++
|
+++
|
||||||
|
|
||||||
This is a quick demonstration post. It serves as an example of the features
|
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" >}}
|
{{< section "begin" >}}
|
||||||
## A Bit About Mathematics
|
## A Bit About Mathematics
|
||||||
|
|
||||||
{{< epigraph pre="Shawn O'Hare, " cite="Math is Fun" >}}
|
{{< epigraph pre="Shawn O'Hare, " cite="Math is Fun" >}}
|
||||||
This is an example of an epigraph with some math
|
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.
|
to start the beginning of a section.
|
||||||
{{< /epigraph >}}
|
{{< /epigraph >}}
|
||||||
|
|
||||||
|
@ -27,20 +27,20 @@ to start the beginning of a section.
|
||||||
### Inline
|
### Inline
|
||||||
Some inline math:
|
Some inline math:
|
||||||
{{< marginnote "mn-example" >}}This is a margin note.{{< /marginnote >}}
|
{{< marginnote "mn-example" >}}This is a margin note.{{< /marginnote >}}
|
||||||
\\(e^{i \pi} = -1\\)
|
$e^{i \pi} = -1$
|
||||||
and \\(\sqrt{-1} = i \\)
|
and $\sqrt{-1} = i $
|
||||||
and \\( a_2 = 3 \\).
|
and $ a_2 = 3 $.
|
||||||
|
|
||||||
### Display
|
### Display
|
||||||
And display math using escaped brackets `\\[`:
|
And display math using this symbol `$$`:
|
||||||
{{< sidenote "sn-example" >}}This is a sidenote!{{< /sidenote >}}
|
{{< 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].
|
-- \cdot_H -- \colon B(G,H) \times B(H, K) \to B(G, K), \quad ([X], [Y]) \mapsto [X \times_H Y].
|
||||||
\\]
|
$$
|
||||||
|
|
||||||
### Environments
|
### 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
|
the markdown processor does not override Katex. Currently, display
|
||||||
environments should be enclosed in `<p>` tags and blank lines.
|
environments should be enclosed in `<p>` tags and blank lines.
|
||||||
For instance:
|
For instance:
|
||||||
|
@ -77,7 +77,7 @@ $$
|
||||||
|
|
||||||
### Blockquotes
|
### Blockquotes
|
||||||
Some blockquotes. But first, we try to manually cite via
|
Some blockquotes. But first, we try to manually cite via
|
||||||
<cite>This is between cite tags and has math: \\(e^x \\)</cite>
|
<cite>This is between cite tags and has math: $e^x $</cite>
|
||||||
|
|
||||||
{{< blockquote cite="www.shawnohare.com" footer="Shawn O'Hare" >}}
|
{{< blockquote cite="www.shawnohare.com" footer="Shawn O'Hare" >}}
|
||||||
This is a blockquote with two paragraphs, that employs the
|
This is a blockquote with two paragraphs, that employs the
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css">
|
||||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js"></script>
|
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js"></script>
|
||||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" onload="renderMathInElement(document.body);"></script>
|
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js"></script>
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
<script>
|
|
||||||
renderMathInElement(
|
renderMathInElement(
|
||||||
document.body,
|
document.body,
|
||||||
{
|
{
|
||||||
delimiters: [
|
delimiters: [
|
||||||
{ left: "$$", right: "$$", display: true },
|
{ left: "$$", right: "$$", display: true },
|
||||||
{ left: "\\[", right: "\\]", display: true },
|
{ left: "\\[", right: "\\]", display: true },
|
||||||
{left: "$", right: "$", display: true},
|
{ left: "$", right: "$", display: false },
|
||||||
{left: "\\(", right: "\\)", display: true}
|
{ left: "\\(", right: "\\)", display: false }
|
||||||
],
|
],
|
||||||
displayMode: true
|
displayMode: true
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
</script>
|
|
Loading…
Reference in a new issue