Issue

After posting my first article, I found that seems MathJax “cannot” parse the newline symbol (\\) properly.

Usually, we do latex like

1
2
f(x)=ax+b\\
g(x)=kx+d

However, it does not work.

Solution

After checking the source code generated by Hugo, I found that seems all \\ would be replaced by \. I believe it was done by a kind of converting process.

So the solution is quite easy: replace all \\ to \\\\.

After such a patch, most formulas will work. However, the equations I have shown above do not. This needs us to add a new begin like:

1
2
3
4
\begin{array}{c}
f(x)=ax+b\\\\
g(x)=kx+d
\end{array}

or maybe aligned would be more suitable?

1
2
3
4
\begin{aligned}
f(x)=ax+b\\\\
g(x)=kx+d
\end{aligned}

Anyway, somehow, we need to add a \begin and \end to handle such issue. And this patch works both in Hugo and Hexo.