KaTeX support
Add support for displaying LaTeX equations with KaTeX.
partials
Copy math.html
from themes\hugo-coder\layouts\partials\posts
to layouts\partials\posts
folder.
Copy single.html
from themes\default\layouts\posts
to layouts\posts
.
Insert following line from Hugo Coder to single.html
{{ partial "posts/math.html" . }}
before {{ end }}
.
create post
Create a new post with CLI
D:\blank>hugo new content posts\katex-support.md
Content "D:\\blank\\content\\posts\\katex-support.md" created
Edit the post and add math = true
in front matter of a post in order to get KaTeX support for displaying LaTeX equations.
write latex equations
D:\blank>"C:\Program Files\Notepad++\notepad++.exe" content\posts\katex-support.md
This is an equation $y = ax^2 + bx + c$ with inline mode. And the following
$$\tag{1} y = \frac{\alpha x^2 + \beta x^2 + \gamma}{\sqrt{1 - \sin e^x}} $$
is with display mode.
Inline mode $y = ax^2 + bx + c$
Displaymode
$$\tag{1}
y = \frac{\alpha x^2 + \beta x^2 + \gamma}{\sqrt{1 - \sin e^x}}
$$
Tags: