This commit is contained in:
clente 2023-10-27 22:31:23 +00:00
parent 2396ff0997
commit bfb737c1f5
32 changed files with 138 additions and 48 deletions

View file

@ -5,8 +5,7 @@
<a class=disabled role=link aria-disabled=true>pt-BR 🇧🇷</a></nav></header><main id=main-content><h1>Math Typesetting</h1><p class=byline><time datetime=2019-03-08 pubdate>2019-03-08</time>
· Hugo Authors</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:
</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:
$$
\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
$$</p></content><p></p><p><a href='mailto:me@example.com?subject=Reply%20to%20"Math%20Typesetting"'>Reply to this post by email ↪</a></p></main><footer><small>John Doe (CC BY 4.0) | Made with <a href=https://github.com/clente/hugo-bearcub>Bear Cub</a></small></footer></body></html>