2
$\begingroup$

Does anyone know how compatible Mathjax is with Latex?

I'm having problems using $\backslash\backslash$ to delimit rows in the eqnarray environment using text such as:

$\backslash$ begin{eqnarray} a & = & b + c $\backslash\backslash$ & = & d + e + f + g + h^2 + i^2 + j \label{eq:faultyeqnarray} $\backslash$end{eqnarray}

and instead of the equations coming out with their equals aligned, they're instead all on one line:

\begin{eqnarray} a & = & b + c \ & = & d + e + f + g + h^2 + i^2 + j \label{eq:faultyeqnarray} \end{eqnarray}

It seems that $\backslash\backslash$ forces a new line in latex, whereas Mathjax does something else.

$\endgroup$
  • $\begingroup$ Try doubling the `: write \\\`. $\endgroup$ – Mariano Suárez-Álvarez Jul 18 '11 at 1:16
  • $\begingroup$ Try working with the align environment instead. I know it works fine within display mode, perhaps without it as well. $\endgroup$ – Asaf Karagila Jul 18 '11 at 5:00
  • 3
    $\begingroup$ @Mariano: Try enclosing the backslashes in double backticks: ``\\\\`` gives \\\\! :-) $\endgroup$ – Hendrik Vogt Jul 18 '11 at 6:36
11
$\begingroup$

The problem is not with MathJax but with the backend software. It interprets a backslash as an escape character, for formatting purposes (e.g. *beep* is displayed as beep, so if you really want *beep* you have to type \*beep\*), so two backslashes get turned into one before MathJax ever gets a chance to see them. Fortunately there are simple workarounds.

As Mariano's apparently mangled comment suggests, you can add extra backslashes. \\ shows up as \, so type \\\\ to get \\.

Or you can enter math mode using dollar signs to keep backslashes intact.

$$
\begin{eqnarray}
a & = & b + c \\
  & = & d + e + f + g + h^2 + i^2 + j
\end{eqnarray}
$$

$$ \begin{eqnarray} a & = & b + c \\ & = & d + e + f + g + h^2 + i^2 + j \end{eqnarray} $$

The reason this works is that the part of the backend that eats backslashes doesn't understand \begin{}...\end{}, but does know enough to not touch things between dollar signs.

$\endgroup$
  • $\begingroup$ How do you use \eqref{ } using your methods? $\endgroup$ – John McVirgo Jul 19 '11 at 21:42
  • 1
    $\begingroup$ @John: I haven't had any success in getting MathJax to display equation numbers. I think it's not supported. $\endgroup$ – Rahul Jul 20 '11 at 5:50
  • 2
    $\begingroup$ I just append a \qquad (1) or something like it if need be... $\endgroup$ – J. M. is a poor mathematician Jul 20 '11 at 11:50
5
$\begingroup$

No, Mathjax isn't supposed to be 100% compatible with Latex and only implements those functions that are likely to be of use. The main thing to note is that AMS extensions can be added, which is the case for the maths and physics parts of Stack Exchange. A list of what is supported is given here:

http://www.mathjax.org/docs/1.1/tex.html

Edit: According to the principal developer of Mathjax, Davide P. Cervone, the new release 1.1a in autumn will support additional features from the AMS extensions such as tags and equation numbering etc.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .