Mathjax equation doesn't render with jekyll

In general mathjax and jekyll work together just fine, but I have this one equation that doesn’t want to render and I suspect it has to do with jekyll. The following minimal html file (opened in the browser, without involving jekyll) renders the equation correctly:

<html><body>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>

\begin{equation}
(A)'_{i,j} = A_{j,i}
\end{equation}

But the following minimal index.md file, in an otherwise empty directory, served with jekyll s, doesn’t render the same equation and only shows the latex source code instead:

---
---

<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>

\begin{equation}
(A)'_{i,j} = A_{j,i}
\end{equation}

Can anyone reproduce this issue? If so, any ideas how to resolve this? I think it has to do with the parentheses or the apostrophe, because the equation A_{i,j} = A_{j,i} is rendered correctly.

1 Like

Enclose all the mathematics markup between {::nomarkdown} and {:/}. This will prevent kramdown from enclosing the content between <p> and </p> tags, which seems to be causing the problem.

{::nomarkdown}  
\begin{equation}
(A)'_{i,j} = A_{j,i}
\end{equation}
{:/}  

Hope it helps :slight_smile: