69 lines
3.1 KiB
HTML
69 lines
3.1 KiB
HTML
<!DOCTYPE html><html><head><meta charset="utf-8"/><title>A simple demo of MathJax with ASCIIMath with StrapDown.js</title></head><body><xmp theme="united">
|
|
<ul class="pager">
|
|
<li class="previous"><a href="example2.html">← Previous example</a></li>
|
|
<li><a href="index.html">Index</a></li>
|
|
<li class="next"><a href="example4.html">Next example →</a></li>
|
|
</ul>
|
|
|
|
## This short example supports [MathJax](http://www.mathjax.org/) using [ASCIIMath](http://asciimath.org/) syntax.
|
|
|
|
<p style="font-size:x-large;">
|
|
Inline equations, as for instance the classic `\Delta = b^2-4ac` and
|
|
`x_(1,2) = (-b pm sqrt Delta)(2a)`, or display equations as this one :
|
|
$$ J\_\alpha(x) = \sum\limits\_{m=0}^\infty \frac{(-1)^m}{m! \, \Gamma(m + \alpha + 1)}{\left({\frac{x}{2}}\right)}^{2 m + \alpha} $$
|
|
</p>
|
|
|
|
Also using dollar sign as delimiter:
|
|
$\Delta^2 - 4ac$
|
|
$x_(1,2) = (-b pm sqrt Delta)(2a)$, or display equations as this one :
|
|
$$ J\_\alpha(x) = \sum\limits\_{m=0}^\infty \frac{(-1)^m}{m! \, \Gamma(m + \alpha + 1)}{\left({\frac{x}{2}}\right)}^{2 m + \alpha} $$
|
|
|
|
## From a classic math book
|
|
But a less classic exercise about [Hölder functions](https://en.wikipedia.org/wiki/H%C3%B6lder_condition)
|
|
(more precisely, *Exercice 7*, Chapter 4.5, page 267, of the [Gourdon, "*Les maths en tête : Analyse*", $2^\text{nd}$ edition](http://www.amazon.fr/gp/product/2729837590) book).
|
|
|
|
<p style="font-size:x-large;">
|
|
$$ 4 \sum\_{n=1}^{+\infty} \rho\_n^2 \sin^2 nh = \frac{1}{2\pi} \int\_{-\pi}^{\pi}\lvert f(x+h) - f(x-h)\rvert^2 dx. $$
|
|
</p>
|
|
|
|
## How-to ?
|
|
The previous equation is simply included in the Markdown code part as basic some $\LaTeX2e{}$ code :
|
|
|
|
> ```latex
|
|
$$ 4 \sum\_{n=1}^{+\infty} \rho\_n^2 \sin^2 nh = \frac{1}{2\pi} \int\_{-\pi}^{\pi}|f(x+h) - f(x-h)|^2 dx. $$
|
|
```
|
|
|
|
***
|
|
|
|
## Yes, it is as simple as adding *one line at the bottom*
|
|
You just have to load [MathJax](http://www.mathjax.org/) (as described [here](http://docs.mathjax.org/en/latest/configuration.html))
|
|
from the bottom of a *StrapDown*-flavored page, for instance from the default *CDN* :
|
|
|
|
> ```html
|
|
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=AM_CHTML"></script>
|
|
```
|
|
|
|
You can consult [a second example](example4.html) to see some more advanced examples of LaTeX equations rendered with MathJax.
|
|
|
|
***
|
|
|
|
## See also
|
|
+ [This page](http://perso.crans.org/besson/math.html) shows how to use MathJax on a [Sphinx](http://sphinx-doc.org/) project.
|
|
+ [This script (strapdown2pdf)](strapdown2pdf.html) to print to PDF a *StrapDown*-powered web page. It comes with a limited support of LaTeX (still not perfect).
|
|
|
|
---
|
|
|
|
<ul class="pager">
|
|
<li class="previous"><a href="example10.html">← Previous example</a></li>
|
|
<li><a href="index.html">Index</a></li>
|
|
<li class="next disabled"><a href="#">→ Next example</a></li>
|
|
</ul>
|
|
|
|
</xmp>
|
|
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=AM_CHTML&locale=fr"></script>
|
|
<script type="text/javascript" src="strapdown.min.js"></script>
|
|
<script type="text/javascript">
|
|
window.MathJax = { loader: { load: ['input/asciimath'] }, asciimath: { delimiters: [['$','$'], ['`','`']] } });
|
|
</script>
|
|
</body></html>
|