Equation support in Markdown

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.

<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" 
    document.addEventListener("DOMContentLoaded", function() {
        renderMathInElement(document.body, {
            delimiters: [
                {left: "$$", right: "$$", display: true},
                {left: "$", right: "$", display: false}

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