Simple Way to Use Mathjax with Jekyll
I know it’s not straightforward to insert beautiful math formulas with Jekyll. I referred to the post , however, a couple of unexpected problems just came out, making the math writing not that comfortable. Anyhow, I finanlly figured out how to do it!
Add the following codes in your head
tag
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
skipTags: [
'script', 'noscript','style','textarea','pre']
}
}
);
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for(i=0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
}
);
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS MML_HTMLorMML">
</script>
Add the following code in style.css
code.has-jax {font: inherit; font-size: 100%; background: inherit; border: inherit;}
Usage
`\[display math\]`
`\(inline math \)`