-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
example5.html
124 lines (95 loc) · 7.37 KB
/
example5.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!DOCTYPE html><html><head><meta charset="utf-8"/><title>A second demo of MathJax with StrapDown.js</title></head><body><xmp>
<ul class="pager">
<li class="previous"><a href="example4.html">← Previous example</a></li>
<li><a href="index.html">Index</a></li>
<li class="next"><a href="example6.html">Next example →</a></li>
</ul>
# A third example with [MathJax](http://www.mathjax.org/) activated
> This *StrapDown*-flavored HTML page comes with MathJax enabled, simply because **we asked the script to do so**.
The last line of this page source (you can read it with "Ctrl+u" in Firefox) imports the script ``strapdown.min.js`` with this URL : ``"strapdown.min.js?src=example5&mathjax=y&theme=united&beacon=y"``.
This way, some options are available:
1. ``mathjax=y`` if you want to load MathJax, with ``$ ... $`` being the default syntax for inline maths and ``$$ ... $$`` for display,
2. ``theme=united`` or ``theme=cyborg`` if you want to load a specific theme (without having to specify it as the ``theme`` attribute of the main ``xmp`` tag containing your Markdown code),
3. ``beacon=y`` if you want to include an invisible [GA Beacon](http://perso.crans.org/besson/beacon.en.html) image in your page,
4. ``pedantic=y`` if you want to force the use of the ["pedantic" option](https://github.com/chjj/marked#pedantic) for [marked](https://github.com/chjj/marked), the Markdown parser used by StrapDown.js (note: you probably don't want that, [pedantic=false is usually better](https://github.com/chuckhoupt/strapdown/commit/1a090729fb717059be0689aa65025de6de67b3cd)). Default is pedantic=false.
5. ``nonavbarfixed=y`` if you prefer the [top navigation bar](https://bootswatch.com/united/#navbar) to not be fixed, but scroll as the rest of the page (*new!*). See [example #8](example8.html),
6. ``keepicon=y`` if you prefer StrapDown.js to keep the favicon included in your HTML document (*new!*). See [example #9](example9.html).
7. ``nonavbar=y`` if you prefer to not have any [top navigation bar](https://bootswatch.com/united/#navbar) (*new!*). See [example #10](example10.html),
***
> These examples are the same as [the previous example](example4.html) directly imported from [the samples from the mathjax.org website](http://www.mathjax.org/demos/tex-samples/).
> The following equations are included in the HTML source code as pure LaTeX code.
***
### The [Lorenz Equations](https://en.wikipedia.org/wiki/Lorenz_system#Overview)
### $$\left\\\{\begin{aligned} \dot{x} & = \sigma(y-x) \\\\ \dot{y} & = \rho x - y - xz \\\\ \dot{z} & = -\beta z + xy \end{aligned}\right. $$
> The previous equation corresponds to the following code, inserted *verbatim* in the Markdown part of this page (*ie.* after the opening ``xmp`` tag and before its closing):
```latex
$$\left\\\{\begin{aligned}
\dot{x} & = \sigma(y-x) \\\\
\dot{y} & = \rho x - y - xz \\\\
\dot{z} & = -\beta z + xy
\end{aligned}\right. $$
```
### The [Cauchy-Schwarz Inequality](https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality#Rn) (in $\mathbb{R}^n$)
### $$ \left( \sum\_{k=1}^n a\_k b\_k \right)^2 \leq \left( \sum\_{k=1}^n a\_k^2 \right) \left( \sum\_{k=1}^n b\_k^2 \right) $$
> The previous equation corresponds to the following code, inserted *verbatim* in the Markdown part of this page:
```latex
$$ \left( \sum\_{k=1}^n a\_k b\_k \right)^2 \leq \left( \sum\_{k=1}^n a\_k^2 \right) \left( \sum\_{k=1}^n b\_k^2 \right) $$
```
### A [Cross Product](https://en.wikipedia.org/wiki/Cross_product#Coordinate_notation) Formula
### $$\mathbf{V}\_1 \times \mathbf{V}\_2 = \begin{vmatrix} \mathbf{i} & \mathbf{j} & \mathbf{k} \\\\ \frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\\\ \frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0 \end{vmatrix} $$
> The previous equation corresponds to the following code, inserted *verbatim* in the Markdown part of this page:
```latex
$$\mathbf{V}\_1 \times \mathbf{V}\_2 = \begin{vmatrix}
\mathbf{i} & \mathbf{j} & \mathbf{k} \\\\
\frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\\\
\frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0
\end{vmatrix} $$
```
### The probability of [getting $k$ heads when flipping $n$ coins](https://en.wikipedia.org/wiki/Bernoulli_process#Binomial_distribution) is
### $$P(E) = {n \choose k} p^k (1-p)^{n-k} $$
> The previous equation corresponds to the following code, inserted *verbatim* in the Markdown part of this page:
```latex
$$P(E) = {n \choose k} p^k (1-p)^{n-k} $$
```
### An Identity of Ramanujan (obviously)
### $$ \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+\ldots} } } } $$
> The previous equation corresponds to the following code, inserted *verbatim* in the Markdown part of this page:
```latex
$$ \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+\ldots} } } } $$
```
### A [Rogers-Ramanujan Identity](https://en.wikipedia.org/wiki/Rogers%E2%80%93Ramanujan_identities)
### $$ 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 $|q|<1$}. $$
> The previous equation corresponds to the following code, inserted *verbatim* in the Markdown part of this page:
```latex
$$ 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 $|q|<1$}. $$
```
### [Maxwell's Equations](https://en.wikipedia.org/wiki/Maxwell%27s_equations)
### $$ \left\\\{\begin{aligned} \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\\\ \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\\\ \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\\\ \nabla \cdot \vec{\mathbf{B}} & = 0 \end{aligned}\right. $$
> The previous equation corresponds to the following code, inserted *verbatim* in the Markdown part of this page:
```latex
$$ \left\\\{\begin{aligned}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\\\
\nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\\\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\\\
\nabla \cdot \vec{\mathbf{B}} & = 0 \end{aligned}\right.
$$
```
As you can see, math environment (like ``aligned``) are supported by MathJax, even with the default configuration and no external plugins.
****
### Inline equations are also supported.
Finally, while **display equations** look good for a page of samples, the ability to mix math and text in a paragraph is also important.
This expression $\sqrt{3x-1}+(1+x)^2$ is an example of an **inline equation** (inserted with the code ``$\sqrt{3x-1}+(1+x)^2$``).
As you see, MathJax equations can be used this way as well, without unduly disturbing the spacing between lines.
### End of the examples
That's all for today!
---
<ul class="pager">
<li class="previous"><a href="example4.html">← Previous example</a></li>
<li><a href="index.html">Index</a></li>
<li class="next"><a href="example6.html">Next example →</a></li>
</ul>
</xmp><script type="text/javascript" src="strapdown.min.js?mathjax=y&src=example5&theme=united"></script></body></html>