##// END OF EJS Templates
Added a math jinja macro containing the scripts to load mathjax.
damianavila -
Show More
@@ -0,0 +1,31 b''
1 {%- macro mathjax() -%}
2 <!-- MathJax configuration -->
3 <script type="text/x-mathjax-config">
4 MathJax.Hub.Config({
5 tex2jax: {
6 inlineMath: [ ['$','$'], ["\\(","\\)"] ],
7 displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
8 },
9 displayAlign: 'left', // Change this to 'center' to center equations.
10 "HTML-CSS": {
11 styles: {'.MathJax_Display': {"margin": 0}}
12 }
13 });
14 </script>
15 <!-- End of mathjax configuration -->
16
17 <script>
18 // We wait for the onload function to load MathJax after the page is completely loaded.
19 // MathJax is loaded 1 unit of time after the page is ready.
20 // This hack prevent problems when you load multiple js files.
21
22 window.onload = function () {
23 setTimeout(function () {
24 var script = document.createElement("script");
25 script.type = "text/javascript";
26 script.src = "https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML";
27 document.getElementsByTagName("head")[0].appendChild(script);
28 },1)
29 }
30 </script>
31 {%- endmacro %} No newline at end of file
@@ -1,4 +1,5 b''
1 {%- extends 'basic.tpl' -%}
1 {%- extends 'basic.tpl' -%}
2 {% from 'math.tpl' import mathjax %}
2
3
3
4
4 {%- block header -%}
5 {%- block header -%}
@@ -36,26 +37,9 b' pre {'
36 <!-- Custom stylesheet, it must be in the same directory as the html file -->
37 <!-- Custom stylesheet, it must be in the same directory as the html file -->
37 <link rel="stylesheet" href="custom.css">
38 <link rel="stylesheet" href="custom.css">
38
39
39 <script src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" type="text/javascript"></script>
40 <!-- Loading mathjax macro -->
40 <script type="text/javascript">
41 mathjax()
41 init_mathjax = function() {
42
42 if (window.MathJax) {
43 // MathJax loaded
44 MathJax.Hub.Config({
45 tex2jax: {
46 inlineMath: [ ['$','$'], ["\\(","\\)"] ],
47 displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
48 },
49 displayAlign: 'left', // Change this to 'center' to center equations.
50 "HTML-CSS": {
51 styles: {'.MathJax_Display': {"margin": 0}}
52 }
53 });
54 MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
55 }
56 }
57 init_mathjax();
58 </script>
59 </head>
43 </head>
60 {%- endblock header -%}
44 {%- endblock header -%}
61
45
@@ -1,4 +1,5 b''
1 {%- extends 'reveal_internals/slides.tpl' -%}
1 {%- extends 'reveal_internals/slides.tpl' -%}
2 {% from 'math.tpl' import mathjax %}
2
3
3
4
4 {% block header %}
5 {% block header %}
@@ -139,35 +140,8 b' dependencies: ['
139 });
140 });
140 </script>
141 </script>
141
142
142 <!-- MathJax configuration -->
143 <!-- Loading mathjax macro -->
143 <script type="text/x-mathjax-config">
144 mathjax()
144 MathJax.Hub.Config({
145 tex2jax: {
146 inlineMath: [ ['$','$'], ["\\(","\\)"] ],
147 displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
148 },
149 displayAlign: 'left', // Change this to 'center' to center equations.
150 "HTML-CSS": {
151 styles: {'.MathJax_Display': {"margin": 0}}
152 }
153 });
154 </script>
155 <!-- End of mathjax configuration -->
156
157 <script>
158 // We wait for the onload function to load MathJax after the page is completely loaded.
159 // MathJax is loaded 1 unit of time after the page is ready.
160 // This hack prevent problems when you load multiple js files.
161
162 window.onload = function () {
163 setTimeout(function () {
164 var script = document.createElement("script");
165 script.type = "text/javascript";
166 script.src = "https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML";
167 document.getElementsByTagName("head")[0].appendChild(script);
168 },1)
169 }
170 </script>
171
145
172 <script>
146 <script>
173 Reveal.addEventListener( 'slidechanged', function( event ) {
147 Reveal.addEventListener( 'slidechanged', function( event ) {
General Comments 0
You need to be logged in to leave comments. Login now