返回 reveal.js
math.html
根目录 / examples / math.html
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8" />
5
6 <title>reveal.js - Math Plugin</title>
7
8 <meta
9 name="viewport"
10 content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
11 />
12
13 <link rel="stylesheet" href="../dist/reveal.css" />
14 <link rel="stylesheet" href="../dist/theme/night.css" id="theme" />
15 </head>
16
17 <body>
18 <div class="reveal">
19 <!-- prettier-ignore -->
20 <div class="slides">
21
22 <section>
23 <h2>reveal.js Math Plugin</h2>
24 <p>Render math with KaTeX, MathJax 2, MathJax 3 or MathJax 4</p>
25 </section>
26
27 <section>
28 <h3>The Lorenz Equations</h3>
29
30 <!-- prettier-ignore -->
31 \[\begin{aligned}
32 \dot{x} &amp; = \sigma(y-x) \\
33 \dot{y} &amp; = \rho x - y - xz \\
34 \dot{z} &amp; = -\beta z + xy
35 \end{aligned} \]
36 </section>
37
38 <section>
39 <h3>The Cauchy-Schwarz Inequality</h3>
40
41 <script type="math/tex; mode=display">
42 \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)
43 </script>
44 </section>
45
46 <section>
47 <h3>A Cross Product Formula</h3>
48
49 \[\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
50 \mathbf{i} &amp; \mathbf{j} &amp; \mathbf{k} \\
51 \frac{\partial X}{\partial u} &amp; \frac{\partial Y}{\partial u} &amp; 0 \\
52 \frac{\partial X}{\partial v} &amp; \frac{\partial Y}{\partial v} &amp; 0
53 \end{vmatrix} \]
54 </section>
55
56 <section>
57 <h3>The probability of getting \(k\) heads when flipping \(n\) coins is</h3>
58
59 \[P(E) = {n \choose k} p^k (1-p)^{ n-k} \]
60 </section>
61
62 <section>
63 <h3>An Identity of Ramanujan</h3>
64
65 \[ \frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} =
66 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}}
67 {1+\frac{e^{-8\pi}} {1+\ldots} } } } \]
68 </section>
69
70 <section>
71 <h3>A Rogers-Ramanujan Identity</h3>
72
73 \[ 1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots =
74 \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}\]
75 </section>
76
77 <section>
78 <h3>Maxwell&#8217;s Equations</h3>
79
80 \[ \begin{aligned}
81 \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} &amp; = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} &amp; = 4 \pi \rho \\
82 \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} &amp; = \vec{\mathbf{0}} \\
83 \nabla \cdot \vec{\mathbf{B}} &amp; = 0 \end{aligned}
84 \]
85 </section>
86
87 <section>
88 <h3>TeX Macros</h3>
89
90 Here is a common vector space:
91 \[L^2(\R) = \set{u : \R \to \R}{\int_\R |u|^2 &lt; +\infty}\]
92 used in functional analysis.
93 </section>
94
95 <section>
96 <section>
97 <h3>The Lorenz Equations</h3>
98
99 <div class="fragment">
100 \[\begin{aligned}
101 \dot{x} &amp; = \sigma(y-x) \\
102 \dot{y} &amp; = \rho x - y - xz \\
103 \dot{z} &amp; = -\beta z + xy
104 \end{aligned} \]
105 </div>
106 </section>
107
108 <section>
109 <h3>The Cauchy-Schwarz Inequality</h3>
110
111 <div class="fragment">
112 \[ \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) \]
113 </div>
114 </section>
115
116 <section>
117 <h3>A Cross Product Formula</h3>
118
119 <div class="fragment">
120 \[\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
121 \mathbf{i} &amp; \mathbf{j} &amp; \mathbf{k} \\
122 \frac{\partial X}{\partial u} &amp; \frac{\partial Y}{\partial u} &amp; 0 \\
123 \frac{\partial X}{\partial v} &amp; \frac{\partial Y}{\partial v} &amp; 0
124 \end{vmatrix} \]
125 </div>
126 </section>
127
128 <section>
129 <h3>The probability of getting \(k\) heads when flipping \(n\) coins is</h3>
130
131 <div class="fragment">
132 \[P(E) = {n \choose k} p^k (1-p)^{ n-k} \]
133 </div>
134 </section>
135
136 <section>
137 <h3>An Identity of Ramanujan</h3>
138
139 <div class="fragment">
140 \[ \frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} =
141 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}}
142 {1+\frac{e^{-8\pi}} {1+\ldots} } } } \]
143 </div>
144 </section>
145
146 <section>
147 <h3>A Rogers-Ramanujan Identity</h3>
148
149 <div class="fragment">
150 \[ 1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots =
151 \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}\]
152 </div>
153 </section>
154
155 <section>
156 <h3>Maxwell&#8217;s Equations</h3>
157
158 <div class="fragment">
159 \[ \begin{aligned}
160 \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} &amp; = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} &amp; = 4 \pi \rho \\
161 \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} &amp; = \vec{\mathbf{0}} \\
162 \nabla \cdot \vec{\mathbf{B}} &amp; = 0 \end{aligned}
163 \]
164 </div>
165 </section>
166
167 <section>
168 <h3>TeX Macros</h3>
169
170 Here is a common vector space:
171 \[L^2(\R) = \set{u : \R \to \R}{\int_\R |u|^2 &lt; +\infty}\]
172 used in functional analysis.
173 </section>
174
175 </section>
176
177 </div>
178 </div>
179
180 <script src="../dist/reveal.js"></script>
181 <script src="../dist/plugin/math.js"></script>
182 <script>
183 Reveal.initialize({
184 history: true,
185 transition: 'linear',
186
187 // MathJax2 configuration (commented out)
188 /*
189 mathjax2: {
190 config: 'TeX-AMS_HTML-full',
191 TeX: {
192 Macros: {
193 R: '\\mathbb{R}',
194 set: ['\\left\\{#1 \\; ; \\; #2\\right\\}', 2],
195 },
196 },
197 },
198 */
199
200 // MathJax4 configuration
201 mathjax4: {
202 tex: {
203 inlineMath: [['$', '$'], ['\\(', '\\)']],
204 displayMath: [['$$', '$$'], ['\\[', '\\]']],
205 macros: {
206 R: '\\mathbb{R}',
207 set: ['\\left\\{#1 \\; ; \\; #2\\right\\}', 2]
208 }
209 },
210 options: {
211 skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
212 },
213 output: {
214 font: 'mathjax-stix2',
215 displayOverflow: 'linebreak',
216 linebreaks: { // options for when overflow is linebreak
217 inline: true, // true for browser-based breaking of inline equations
218 width: '100%', // a fixed size or a percentage of the container width
219 lineleading: .2, // the default lineleading in em units
220 LinebreakVisitor: null // The LinebreakVisitor to use
221 }
222 }
223 },
224
225 // There are four typesetters available
226 // RevealMath.MathJax2 (default)
227 // RevealMath.MathJax3
228 // RevealMath.MathJax4
229 // RevealMath.KaTeX
230 //
231 // This example uses MathJax4 with macros support
232 // More info at https://revealjs.com/math/
233 plugins: [ RevealMath.MathJax4 ]
234 });
235 </script>
236 </body>
237 </html>
238
238 lines HTML