Equations in normal LaTeX to MathJax formatting
You do not need the \[
and \]
for MathJax to recognize this. You have not given your MathJax configuration, but as long as processEnvironments
is true
in the tex2jax
section of your configuration, then it should pick up the \begin
directly. See the tex2jax section of the configuration documentation.
One idea is to have a conditional test; if the conditional is true (mathjax document), then nothing is done; if it is false (pdflatex document), then \[
and \]
are \let
to \relax
:
\documentclass{article}
\usepackage{amsmath}
\newif\ifmathjax
\ifmathjax\relax
\else
\let\[\relax\let\]\relax
\fi
\mathjaxfalse% for pdflatex
%\mathjaxtrue% for mathjax
\begin{document}
\[
\begin{align*}
x &= \sqrt{4^2-1^2} \\
&= \sqrt{15}.
\end{align*}
\]
\end{document}
Of course, this implies that in your document you can't simply write
\[ expression \]
you'll need \begin{equation*}
expression \end{equation*}
.
Did you read the mathjax
documentation. align*
should work just fine. But it is not supported by mathjax
by default. If I call it as
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>
then things like align*
works just fine.