Any advice on how to get equations using MathJax/Latex to work on my posts?
You’ll need to add something like MathJax support by editing your theme. Here’s a pretty good article with example of how you can do this.
I put something like these before a post and it works, but not works when added in /layouts/partials/head.html
? How can I do it by editing my theme? Please help.
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.3/dist/katex.min.css">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.3/dist/katex.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.3/dist/contrib/auto-render.min.js"
onload="renderMathInElement(document.body);"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body, {
delimiters: [
{left: "$$", right: "$$", display: true},
{left: "$", right: "$", display: false}
]
});
});
</script>
</head>
There’s a plug-in that lets you add anything to the head section, confusingly named Meta tags. Remove the first and last line from your example (<head>
and </head>
) and paste the result into the textarea the plug-in provides.
1 Like