2023-10-09 15:42:51 +00:00
|
|
|
{{- $page := .page }}
|
|
|
|
{{- with $page }}
|
2023-10-26 09:27:53 +00:00
|
|
|
{{- $init := "{}" }}
|
2023-10-09 15:42:51 +00:00
|
|
|
{{- if isset .Params "mathjaxinitialize" }}
|
2023-10-26 09:27:53 +00:00
|
|
|
{{- $init = .Params.mathJaxInitialize }}
|
2023-10-09 15:42:51 +00:00
|
|
|
{{- else if isset .Site.Params "mathjaxinitialize" }}
|
2023-10-26 09:27:53 +00:00
|
|
|
{{- $init = .Site.Params.mathJaxInitialize }}
|
2023-10-09 15:42:51 +00:00
|
|
|
{{- end }}
|
|
|
|
<script>
|
|
|
|
function useMathJax( config ){
|
|
|
|
if( !Object.assign ){
|
|
|
|
// We don't support MathJax for IE11 anyways, so bail out early
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
window.MathJax = Object.assign( window.MathJax || {}, {
|
|
|
|
loader: {
|
|
|
|
load: ['[tex]/mhchem']
|
|
|
|
},
|
|
|
|
startup: {
|
|
|
|
elements: [
|
|
|
|
'.math'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
tex: {
|
|
|
|
inlineMath: [
|
|
|
|
['$', '$'], // allow for single dollars as we set startup.elements
|
|
|
|
['\\(', '\\)']
|
|
|
|
]
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
enableMenu: false // avoid translation hassle for context menu
|
|
|
|
}
|
|
|
|
}, config );
|
|
|
|
}
|
2023-10-26 09:27:53 +00:00
|
|
|
useMathJax( JSON.parse({{ $init }}) );
|
2023-10-09 15:42:51 +00:00
|
|
|
</script>
|
2023-11-16 19:55:32 +00:00
|
|
|
{{- if and (isset .Params "custommathjaxurl") .Params.customMathJaxURL }}
|
2023-10-09 15:42:51 +00:00
|
|
|
<script id="MathJax-script" async src="{{ .Params.customMathJaxURL }}"></script>
|
2023-11-16 19:55:32 +00:00
|
|
|
{{- else if and (isset .Site.Params "custommathjaxurl") .Site.Params.customMathJaxURL }}
|
2023-10-09 15:42:51 +00:00
|
|
|
<script id="MathJax-script" async src="{{ .Site.Params.customMathJaxURL }}"></script>
|
|
|
|
{{- else }}
|
|
|
|
<script id="MathJax-script" async src="{{"js/mathjax/tex-mml-chtml.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|