80 lines
2.5 KiB
HTML
80 lines
2.5 KiB
HTML
## mako
|
|
## File: templates/mathjax_include.html
|
|
##
|
|
## Note that this file is only used by LMS.
|
|
## MathJax configuration for Studio lives in
|
|
## cms/js/require-config.js.
|
|
|
|
|
|
<%page args="disable_fast_preview=True"/>
|
|
|
|
%if disable_fast_preview:
|
|
<script type="text/javascript">
|
|
// Fast Preview was introduced in 2.5. However, it
|
|
// causes undesirable flashing/font size changes when
|
|
// MathJax is used for interactive preview (equation editor).
|
|
// Setting processSectionDelay to 0 (see below) fully eliminates
|
|
// fast preview, but to reduce confusion, we are also setting
|
|
// the option as displayed in the context menu to false.
|
|
// When upgrading to 2.6, check if this variable name changed.
|
|
window.MathJax = {
|
|
menuSettings: {CHTMLpreview: false}
|
|
};
|
|
</script>
|
|
%endif
|
|
|
|
%if mathjax_mode is not Undefined and mathjax_mode == 'wiki':
|
|
<script type="text/x-mathjax-config">
|
|
MathJax.Hub.Config({
|
|
tex2jax: {inlineMath: [ ['$','$'], ["\\(","\\)"]],
|
|
displayMath: [ ['$$','$$'], ["\\[","\\]"]]}
|
|
});
|
|
</script>
|
|
%else:
|
|
<script type="text/x-mathjax-config">
|
|
MathJax.Hub.Config({
|
|
tex2jax: {
|
|
inlineMath: [
|
|
["\\(","\\)"],
|
|
['[mathjaxinline]','[/mathjaxinline]']
|
|
],
|
|
displayMath: [
|
|
["\\[","\\]"],
|
|
['[mathjax]','[/mathjax]']
|
|
]
|
|
}
|
|
});
|
|
</script>
|
|
%endif
|
|
<script type="text/x-mathjax-config">
|
|
|
|
%if disable_fast_preview:
|
|
// In order to eliminate all flashing during interactive
|
|
// preview, it is necessary to set processSectionDelay to 0
|
|
// (remove delay between input and output phases). This
|
|
// effectively disables fast preview, regardless of
|
|
// the fast preview setting as shown in the context menu.
|
|
MathJax.Hub.processSectionDelay = 0;
|
|
%endif
|
|
|
|
MathJax.Hub.signal.Interest(function(message) {
|
|
if(message[0] === "End Math") {
|
|
set_mathjax_display_div_settings();
|
|
}
|
|
});
|
|
function set_mathjax_display_div_settings() {
|
|
$('.MathJax_Display').each(function( index ) {
|
|
this.setAttribute('tabindex', '0');
|
|
this.setAttribute('aria-live', 'off');
|
|
this.removeAttribute('role');
|
|
this.removeAttribute('aria-readonly');
|
|
});
|
|
}
|
|
</script>
|
|
|
|
|
|
<!-- This must appear after all mathjax-config blocks, so it is after the imports from the other templates.
|
|
It can't be run through static.url because MathJax uses crazy url introspection to do lazy loading of
|
|
MathJax extension libraries -->
|
|
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full"></script>
|