aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/math.html38
-rwxr-xr-xplugin/math/math.js13
2 files changed, 44 insertions, 7 deletions
diff --git a/examples/math.html b/examples/math.html
index 49d4952..67fa546 100644
--- a/examples/math.html
+++ b/examples/math.html
@@ -15,7 +15,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="../css/reveal.min.css">
- <link rel="stylesheet" href="../css/theme/default.css" id="theme">
+ <link rel="stylesheet" href="../css/theme/night.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="../lib/css/zenburn.css">
@@ -32,11 +32,12 @@
<div class="slides">
<section>
- <h1>Reveal.js Math Plugin</h1>
+ <h2>reveal.js Math Plugin</h2>
+ <p>A thin wrapper for MathJax</p>
</section>
<section>
- <h2>The Lorenz Equations</h2>
+ <h3>The Lorenz Equations</h3>
\[\begin{aligned}
\dot{x} &amp; = \sigma(y-x) \\
\dot{y} &amp; = \rho x - y - xz \\
@@ -45,13 +46,13 @@
</section>
<section>
- <h2>The Cauchy-Schwarz Inequality</h2>
+ <h3>The Cauchy-Schwarz Inequality</h3>
\[ \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) \]
</section>
<section>
- <h2>A Cross Product Formula</h2>
+ <h3>A Cross Product Formula</h3>
\[\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
\mathbf{i} &amp; \mathbf{j} &amp; \mathbf{k} \\
@@ -61,13 +62,36 @@
</section>
<section>
- <h2>An Identity of Ramanujan</h2>
+ <h3>The probability of getting \(k\) heads when flipping \(n\) coins is</h3>
+
+ \[P(E) = {n \choose k} p^k (1-p)^{ n-k} \]
+ </section>
+
+ <section>
+ <h3>An Identity of Ramanujan</h3>
\[ \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} } } } \]
</section>
+ <section>
+ <h3>A Rogers-Ramanujan Identity</h3>
+
+ \[ 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})}\]
+ </section>
+
+ <section>
+ <h3>Maxwell&#8217;s Equations</h3>
+
+ \[ \begin{aligned}
+ \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 \\
+ \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} &amp; = \vec{\mathbf{0}} \\
+ \nabla \cdot \vec{\mathbf{B}} &amp; = 0 \end{aligned}
+ \]
+ </section>
+
</div>
</div>
@@ -78,6 +102,8 @@
<script>
Reveal.initialize({
+ transition: 'linear',
+
dependencies: [
{ src: '../lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: '../plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
diff --git a/plugin/math/math.js b/plugin/math/math.js
index 30dd38c..8ab74fa 100755
--- a/plugin/math/math.js
+++ b/plugin/math/math.js
@@ -6,10 +6,13 @@
*/
(function(){
+ var config = Reveal.getConfig().math || {};
+ config.mode = config.mode || 'TeX-AMS_HTML-full';
+
var head = document.querySelector( 'head' );
var script = document.createElement( 'script' );
script.type = 'text/javascript';
- script.src = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_SVG-full';
+ script.src = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=' + config.mode;
// Detect when the script has loaded
script.onload = onScriptLoad;
@@ -28,8 +31,16 @@
tex2jax: { inlineMath: [['$','$'],['\\(','\\)']] }
});
+ // Process any math inside of the current slide when navigating,
+ // this is important since it's not possible to typeset
+ // equations within invisible elements (far future or past).
Reveal.addEventListener( 'slidechanged', function( event ) {
+
+ // This will only typeset equations that have not yet been
+ // processed, as well as equations that have change since
+ // last being processed.
MathJax.Hub.Update( event.currentSlide );
+
} );
}