-
Notifications
You must be signed in to change notification settings - Fork 25
/
mathjax_script_template
56 lines (54 loc) · 3.14 KB
/
mathjax_script_template
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
if (!document.getElementById('mathjaxscript_pelican_#%@#$@#')) {{
var align = "{align}",
indent = "{indent}",
linebreak = "{linebreak_automatic}";
if ({responsive}) {{
align = (screen.width < {responsive_break}) ? "left" : align;
indent = (screen.width < {responsive_break}) ? "0em" : indent;
linebreak = (screen.width < {responsive_break}) ? 'true' : linebreak;
}}
var mathjaxscript = document.createElement('script');
var location_protocol = ({force_tls}) ? 'https' : document.location.protocol;
if (location_protocol !== 'http' && location_protocol !== 'https') location_protocol = 'https:';
mathjaxscript.id = 'mathjaxscript_pelican_#%@#$@#';
mathjaxscript.type = 'text/javascript';
mathjaxscript.src = location_protocol + {source};
mathjaxscript[(window.opera ? "innerHTML" : "text")] =
"MathJax.Hub.Config({{" +
" config: ['MMLorHTML.js']," +
" TeX: {{ extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'{tex_extensions}], equationNumbers: {{ autoNumber: 'AMS' }}, Macros: {macros} }}," +
" jax: ['input/TeX','input/MathML','output/HTML-CSS']," +
" extensions: ['tex2jax.js','mml2jax.js','MathMenu.js','MathZoom.js']," +
" displayAlign: '"+ align +"'," +
" displayIndent: '"+ indent +"'," +
" showMathMenu: {show_menu}," +
" messageStyle: '{message_style}'," +
" tex2jax: {{ " +
" inlineMath: [ ['\\\\(','\\\\)'] ], " +
" displayMath: [ ['$$','$$'] ]," +
" processEscapes: {process_escapes}," +
" preview: '{latex_preview}'," +
" }}, " +
" 'HTML-CSS': {{ " +
" styles: {{ '.MathJax_Display, .MathJax .mo, .MathJax .mi, .MathJax .mn': {{color: '{color} ! important'}} }}," +
" linebreaks: {{ automatic: "+ linebreak +", width: '90% container' }}," +
" }}, " +
"}}); " +
"if ('{mathjax_font}' !== 'default') {{" +
"MathJax.Hub.Register.StartupHook('HTML-CSS Jax Ready',function () {{" +
"var VARIANT = MathJax.OutputJax['HTML-CSS'].FONTDATA.VARIANT;" +
"VARIANT['normal'].fonts.unshift('MathJax_{mathjax_font}');" +
"VARIANT['bold'].fonts.unshift('MathJax_{mathjax_font}-bold');" +
"VARIANT['italic'].fonts.unshift('MathJax_{mathjax_font}-italic');" +
"VARIANT['-tex-mathit'].fonts.unshift('MathJax_{mathjax_font}-italic');" +
"}});" +
"MathJax.Hub.Register.StartupHook('SVG Jax Ready',function () {{" +
"var VARIANT = MathJax.OutputJax.SVG.FONTDATA.VARIANT;" +
"VARIANT['normal'].fonts.unshift('MathJax_{mathjax_font}');" +
"VARIANT['bold'].fonts.unshift('MathJax_{mathjax_font}-bold');" +
"VARIANT['italic'].fonts.unshift('MathJax_{mathjax_font}-italic');" +
"VARIANT['-tex-mathit'].fonts.unshift('MathJax_{mathjax_font}-italic');" +
"}});" +
"}}";
(document.body || document.getElementsByTagName('head')[0]).appendChild(mathjaxscript);
}}