hugo-theme-wondermod/posts/math-typesetting/index.html
2020-07-25 06:37:37 +00:00

11 lines
4.5 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 - PaperMod</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.7649311aafcf409ca7b3dad71aad8904e4f9836e802ade0be6dd34c944c8f714.css integrity="sha256-dkkxGq/PQJyns9rXGq2JBOT5g26AKt4L5t00yUTI9xQ=" 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.3"></head><body class=single><header class=header><nav class=nav><p class=logo><a href=https://adityatelange.github.io/hugo-PaperMod/>PaperMod</a></p><ul class=menu><li><a href=/hugo-PaperMod/archives/>Archives</a></li><li><a href=/hugo-PaperMod/tags/>Tags</a></li><li><a href=/hugo-PaperMod/series/>Series</a></li><li><a href=/hugo-PaperMod/categories/>Categories</a></li></ul></nav></header><main class=main><article class=post-single><header class=post-header><h1 class=post-title>Math Typesetting<div class=entry-isdraft></div></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/>PaperMod</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();document.querySelectorAll('a[href^="#"]').forEach(anchor=>{anchor.addEventListener("click",function(e){e.preventDefault();document.querySelector(this.getAttribute("href")).scrollIntoView({behavior:"smooth"});});});</script></body></html>