Fix MathJax cannot newline in Hugo
Contents
Issue
After posting my first article, I found that seems MathJax “cannot” parse the
newline symbol (\\
) properly.
Usually, we do latex like
|
|
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:
|
|
or maybe aligned
would be more suitable?
|
|
Anyway, somehow, we need to add a \begin
and \end
to handle such issue. And
this patch works both in Hugo and Hexo.
Author KevinZonda
LastMod 2022-04-01 (001ff58)