hugo-theme-wondermod/post/math-typesetting/index.html

11 lines
4.1 KiB
HTML
Raw Normal View History

<!doctype html><html lang=en><head><meta charset=utf-8><meta http-equiv=x-ua-compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no"><title>Math Typesetting - Hugo Themes</title><meta name=description content="Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries."><meta name=author content="Hugo Authors"><link href=https://adityatelange.github.io/hugo-PaperMod/css/stylesheet.min.4b3148ebe1961588ca3b3dc2fabfa171fd112a5ac7edacf75029a4e8f51c5b58.css integrity="sha256-SzFI6+GWFYjKOz3C+r+hcf0RKlrH7az3UCmk6PUcW1g=" rel=stylesheet><link href=https://adityatelange.github.io/hugo-PaperMod/custom.css rel=stylesheet><link rel=apple-touch-icon href=https://adityatelange.github.io/hugo-PaperMod/apple-touch-icon.png><link rel=icon href=https://adityatelange.github.io/hugo-PaperMod/favicon.ico><meta name=generator content="Hugo 0.74.2"></head><body class=single><header class=header><nav class=nav><p class=logo><a href=https://adityatelange.github.io/hugo-PaperMod/>Hugo Themes</a></p><ul class=menu><li><a href=/hugo-PaperMod/about/>About</a></li></ul></nav></header><main class=main><article class=post-single><header class=post-header><h1 class=post-title>Math Typesetting</h1><div class=post-meta>Hugo Authors · March 8, 2019</div></header><div class=post-content><p>Mathematical notation in a Hugo project can be enabled by using third party JavaScript libraries.</p><p>In this example we will be using <a href=https://katex.org/>KaTeX</a></p><ul><li>Create a partial under <code>/layouts/partials/math.html</code></li><li>Within this partial reference the <a href=https://katex.org/docs/autorender.html>Auto-render Extension</a> or host these scripts locally.</li><li>Include the partial in your templates like so:</li></ul><div class=highlight><pre style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=color:#f92672>{{</span> <span style=color:#66d9ef>if</span> or .Params.math .Site.Params.math <span style=color:#f92672>}}</span>
<span style=color:#f92672>{{</span> partial <span style=color:#e6db74>&#34;math.html&#34;</span> . <span style=color:#f92672>}}</span>
<span style=color:#f92672>{{</span> end <span style=color:#f92672>}}</span>
</code></pre></div><ul><li>To enable KaTex globally set the parameter <code>math</code> to <code>true</code> in a project&rsquo;s configuration</li><li>To enable KaTex on a per page basis include the parameter <code>math: true</code> in content files</li></ul><p><strong>Note:</strong> Use the online reference of <a href=https://katex.org/docs/supported.html>Supported TeX Functions</a></p><link rel=stylesheet href=https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css integrity=sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq crossorigin=anonymous><script defer src=https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js integrity=sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz crossorigin=anonymous></script><script defer src=https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js integrity=sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI crossorigin=anonymous onload=renderMathInElement(document.body);></script><h3 id=examples>Examples</h3><p>Inline math: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\)</p><p>Block math:
$$
\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
$$</p></div></article></main><footer class=footer><span>&copy; 2020 <a href=https://adityatelange.github.io/hugo-PaperMod/>Hugo Themes</a></span>
<span>&#183;</span>
<span>Powered by <a href=https://gohugo.io/ rel=noopener target=_blank>Hugo</a></span>
<span>&#183;</span>
<span>Theme <a href=https://github.com/adityatelange/hugo-PaperMod rel=noopener target=_blank>PaperMod</a></span></footer><script src=https://adityatelange.github.io/hugo-PaperMod/js/highlight.min.min.1724e28c9e1aab0429e6941c5413732d007f823433926603784b64f455b53a35.js integrity="sha256-FyTijJ4aqwQp5pQcVBNzLQB/gjQzkmYDeEtk9FW1OjU="></script><script>hljs.initHighlightingOnLoad();</script></body></html>