Skip to content

Instantly share code, notes, and snippets.

@MBAustin
Created February 1, 2020 03:31
Show Gist options
  • Select an option

  • Save MBAustin/78c932161e121b1d335e2c1a2c0efbb3 to your computer and use it in GitHub Desktop.

Select an option

Save MBAustin/78c932161e121b1d335e2c1a2c0efbb3 to your computer and use it in GitHub Desktop.
{%- macro mathjax(url='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS_HTML') -%}
<!-- Load mathjax -->
<script src="{{url}}"></script>
<!-- MathJax configuration -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
processEscapes: true,
processEnvironments: true
},
// Center justify equations in code and markdown cells. Elsewhere
// we use CSS to left justify single line equations in code cells.
displayAlign: 'center',
"HTML-CSS": {
styles: {'.MathJax_Display': {"margin": 0}},
linebreaks: { automatic: true }
}
});
MathJax.Hub.Queue(function () {
var typesetCompleteDiv = document.createElement("DIV");
//typesetCompleteDiv.setAttribute("type", "hidden");
typesetCompleteDiv.setAttribute("class", "typeset-complete");
document.getElementsByTagName('body')[0].appendChild(typesetCompleteDiv);
});
</script>
<!-- End of mathjax configuration -->
{%- endmacro %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment