Mathjax Matrix Rendering Issues with WordPress Markdown Plugin
Problem
When the WordPress Markdown plugin and the Mathjax plugin are activated simultaneously, the Markdown plugin replaces \\
to \
and it causes a number of issues when the Mathjax plugin renders LaTeX. For example, a matrix may look like the following
where the intended rendering is as follows
Solution
When writing a LaTeX expression, one may use \\\\
to compensate the string replacement done by the Markdown plugin. For example, one may write an expression to represent a matrix as follows
U = \begin{bmatrix}
x_1 & 1 \\\\
x_2 & 1
\end{bmatrix}
Note that \\\\
is used to denote a new row of the matrix instead of \\
.
Alternatively, one may alter the PHP implementation of Markdown to disable the string replacement within LaTeX blocks $$ ... $$
. I decided not to do this because there may be unforeseen side-effects due to this change.