Add KaTeX support
Added KaTeX support with accompanying samples
This commit is contained in:
parent
77a8fc4a30
commit
04617ddabb
49
exampleSite/content/post/2017-03-05-math-sample.md
Normal file
49
exampleSite/content/post/2017-03-05-math-sample.md
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
---
|
||||||
|
title: Math Sample
|
||||||
|
subtitle: Using KaTeX
|
||||||
|
date: 2017-03-05
|
||||||
|
tags: ["example", "math"]
|
||||||
|
---
|
||||||
|
|
||||||
|
KaTeX can be used to generate complex math formulas server-side.
|
||||||
|
|
||||||
|
$$
|
||||||
|
\phi = \frac{(1+\sqrt{5})}{2} = 1.6180339887\cdots
|
||||||
|
$$
|
||||||
|
|
||||||
|
Additional details can be found on [GitHub](https://github.com/Khan/KaTeX) or on the [Wiki](http://tiddlywiki.com/plugins/tiddlywiki/katex/).
|
||||||
|
<!--more-->
|
||||||
|
|
||||||
|
### Example 1
|
||||||
|
|
||||||
|
If the text between $$ contains newlines it will rendered in display mode:
|
||||||
|
```
|
||||||
|
$$
|
||||||
|
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
||||||
|
$$
|
||||||
|
```
|
||||||
|
$$
|
||||||
|
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
||||||
|
$$
|
||||||
|
|
||||||
|
|
||||||
|
### Example 2
|
||||||
|
```
|
||||||
|
$$
|
||||||
|
\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\cdots} } } }
|
||||||
|
$$
|
||||||
|
```
|
||||||
|
$$
|
||||||
|
\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\cdots} } } }
|
||||||
|
$$
|
||||||
|
|
||||||
|
|
||||||
|
### Example 3
|
||||||
|
```
|
||||||
|
$$
|
||||||
|
1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots = \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}, \quad\quad \text{for }\lvert q\rvert<1.
|
||||||
|
$$
|
||||||
|
```
|
||||||
|
$$
|
||||||
|
1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots = \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}, \quad\quad \text{for }\lvert q\rvert<1.
|
||||||
|
$$
|
@ -186,7 +186,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<!-- Please don't remove this, keep my open source work credited :) -->
|
<!-- Please don't remove this, keep my open source work credited :) -->
|
||||||
<p class="credits theme-by text-muted">
|
<p class="credits theme-by text-muted">
|
||||||
<a href="http://gohugo.io">Hugo v{{ .Hugo.Version }}</a> powered • Theme by <a href="http://deanattali.com/beautiful-jekyll/">beautiful-jekyll</a> adapted to <a href="https://github.com/halogenica/beautifulhugo">Beautiful Hugo</a>
|
<a href="http://gohugo.io">Hugo v{{ .Hugo.Version }}</a> powered • Theme by <a href="http://deanattali.com/beautiful-jekyll/">Beautiful Jekyll</a> adapted to <a href="https://github.com/halogenica/beautifulhugo">Beautiful Hugo</a>
|
||||||
{{ with .Site.Params.commit }} • [<a href="{{.}}{{ getenv "GIT_COMMIT_SHA" }}">{{ getenv "GIT_COMMIT_SHA_SHORT" }}</a>]{{ end }}
|
{{ with .Site.Params.commit }} • [<a href="{{.}}{{ getenv "GIT_COMMIT_SHA" }}">{{ getenv "GIT_COMMIT_SHA_SHORT" }}</a>]{{ end }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@ -194,12 +194,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.js" integrity="sha384-/y1Nn9+QQAipbNQWU65krzJralCnuOasHncUFXGkdwntGeSvQicrYkiUBwsgUqc1" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/contrib/auto-render.min.js" integrity="sha384-dq1/gEHSxPZQ7DdrM82ID4YVol9BYyU7GbWlIwnwyPzotpoc57wDw/guX8EaYGPx" crossorigin="anonymous"></script>
|
||||||
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
|
||||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
||||||
<script src="{{ .Site.BaseURL }}/js/main.js"></script>
|
<script src="{{ .Site.BaseURL }}/js/main.js"></script>
|
||||||
<script src="{{ .Site.BaseURL }}/js/highlight.min.js"></script>
|
<script src="{{ .Site.BaseURL }}/js/highlight.min.js"></script>
|
||||||
<script>
|
<script> hljs.initHighlightingOnLoad(); </script>
|
||||||
hljs.initHighlightingOnLoad();
|
<script> renderMathInElement(document.body); </script>
|
||||||
</script>
|
|
||||||
|
|
||||||
{{ template "_internal/google_analytics.html" . }}
|
{{ template "_internal/google_analytics.html" . }}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
<link rel="alternate" href="{{ "/index.xml" | absURL }}" type="application/rss+xml" title="{{ .Site.Title }}">
|
<link rel="alternate" href="{{ "/index.xml" | absURL }}" type="application/rss+xml" title="{{ .Site.Title }}">
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" integrity="sha384-wITovz90syo1dJWVh32uuETPVEtGigN07tkttEqPv+uR2SE/mbQcG7ATL28aI9H0" crossorigin="anonymous">
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||||
<link rel="stylesheet" href="{{ .Site.BaseURL }}/css/main.css" />
|
<link rel="stylesheet" href="{{ .Site.BaseURL }}/css/main.css" />
|
||||||
|
Loading…
Reference in New Issue
Block a user