From 7ba9f09fee0f6eae9adff3d2d4047dd208c88ca6 Mon Sep 17 00:00:00 2001 From: nanxiaobei Date: Thu, 18 May 2023 02:57:01 +0800 Subject: [PATCH] add math support --- README.md | 4 +++- exampleSite/content/post/math-typesetting.md | 7 +------ layouts/partials/head.html | 8 ++++++++ layouts/partials/math.html | 19 +++++++++++++++++++ 4 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 layouts/partials/math.html diff --git a/README.md b/README.md index 97abced..169717e 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
-

Paper 6.10

+

Paper 6.11

Demo → [hugo-paper.vercel.app](https://hugo-paper.vercel.app/) @@ -71,12 +71,14 @@ disqusShortname = 'YOUR_DISQUS_SHORTNAME' # use disqus comments monoDarkIcon = true # show monochrome dark mode icon gravatarCdn = 'GRAVATAR_CDN_LINK' # e.g. 'https://cdn.v2ex.com/gravatar/' graphCommentId = "YOUR_GRAPH_COMMENT_ID" # use graph comment (disqus alternative) + math = true # enable KaTex math typesetting globally ``` Available options to front matter: ```toml comments = false # disable comments for a specific page +math = true # enable KaTex math typesetting for a specific page ``` ## License diff --git a/exampleSite/content/post/math-typesetting.md b/exampleSite/content/post/math-typesetting.md index 0ecfae1..a71637e 100644 --- a/exampleSite/content/post/math-typesetting.md +++ b/exampleSite/content/post/math-typesetting.md @@ -28,13 +28,7 @@ In this example we will be using [KaTeX](https://katex.org/) **Note:** Use the online reference of [Supported TeX Functions](https://katex.org/docs/supported.html) {{< math.inline >}} -{{ if or .Page.Params.math .Site.Params.math }} - - - - -{{ end }} {{}} ### Examples @@ -44,6 +38,7 @@ In this example we will be using [KaTeX](https://katex.org/)

Inline math: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\)

+ {{}} Block math: diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 5f0e3d6..445f778 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -57,6 +57,14 @@ {{ range $.Scratch.Get "social_list" }} {{ end }} + + + {{ if or .Params.math .Site.Params.math }} + + {{ partial "math.html" . }} + + {{ end }} + diff --git a/layouts/partials/math.html b/layouts/partials/math.html new file mode 100644 index 0000000..5515842 --- /dev/null +++ b/layouts/partials/math.html @@ -0,0 +1,19 @@ + + +