This commit is contained in:
clente 2023-02-27 19:33:26 +00:00
parent 256b43bef7
commit 3624ee4b9b
17 changed files with 17 additions and 17 deletions

View file

@ -2,7 +2,7 @@
<a href=/hugo-bearcub/blog/>Blog</a>
<a href='mailto:me@example.com?subject=Reply%20to%20"Math%20Typesetting"'>Email</a>
<a href=/blog/index.xml>RSS</a>
<a class=disabled href>pt-BR 🇧🇷</a></nav></header><main><h1>Math Typesetting</h1><p><i><time datetime=2019-03-08 pubdate>2019-03-08</time></i></p><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 tabindex=0 class=chroma><code class=language-bash data-lang=bash><span class=line><span class=ln>1</span><span class=cl><span class=o>{{</span> <span class=k>if</span> or .Params.math .Site.Params.math <span class=o>}}</span>
<a class=disabled role=link aria-disabled=true>pt-BR 🇧🇷</a></nav></header><main><h1>Math Typesetting</h1><p><i><time datetime=2019-03-08 pubdate>2019-03-08</time></i></p><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 tabindex=0 class=chroma><code class=language-bash data-lang=bash><span class=line><span class=ln>1</span><span class=cl><span class=o>{{</span> <span class=k>if</span> or .Params.math .Site.Params.math <span class=o>}}</span>
</span></span><span class=line><span class=ln>2</span><span class=cl><span class=o>{{</span> partial <span class=s2>&#34;math.html&#34;</span> . <span class=o>}}</span>
</span></span><span class=line><span class=ln>3</span><span class=cl><span class=o>{{</span> end <span class=o>}}</span>
</span></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><h3 id=examples>Examples</h3><p>Block math: