2023-10-09 15:42:51 +00:00
|
|
|
{{- $page := .page }}
|
2024-04-03 21:30:51 +00:00
|
|
|
{{- $location := .location }}
|
|
|
|
{{- if eq $location "footer" }}
|
|
|
|
{{- with $page }}
|
|
|
|
{{- $init := "{}" }}
|
|
|
|
{{- if isset .Params "mathjaxinitialize" }}
|
|
|
|
{{- $init = .Params.mathJaxInitialize }}
|
|
|
|
{{- else if isset .Site.Params "mathjaxinitialize" }}
|
|
|
|
{{- $init = .Site.Params.mathJaxInitialize }}
|
|
|
|
{{- end }}
|
2023-10-09 15:42:51 +00:00
|
|
|
<script>
|
|
|
|
function useMathJax( config ){
|
|
|
|
window.MathJax = Object.assign( window.MathJax || {}, {
|
|
|
|
tex: {
|
2024-04-19 21:37:00 +00:00
|
|
|
inlineMath: [['\\(', '\\)'], ['$', '$']], // inline
|
|
|
|
displayMath: [['\\[', '\\]'], ['$$', '$$']], // block
|
2023-10-09 15:42:51 +00:00
|
|
|
},
|
|
|
|
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>
|
2024-04-03 21:30:51 +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>
|
2024-04-03 21:30:51 +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>
|
2024-04-03 21:30:51 +00:00
|
|
|
{{- else }}
|
2023-10-09 15:42:51 +00:00
|
|
|
<script id="MathJax-script" async src="{{"js/mathjax/tex-mml-chtml.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
2024-04-03 21:30:51 +00:00
|
|
|
{{- end }}
|
2023-10-09 15:42:51 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|