[Tex/LaTex] LatexIt not rendering properly

equationserrors

I've been trying to figure out how latexit works, however, when I enter this simple piece of code, I get a long message of different errors as "LaTeX Error Bad environment delimiter", "You can't use `\eqno' in math mode", "Missing \endgroup inserted." … etc.

Here is the code:

\begin{equation} \label{xx}
x^2 - 5 x + 6 = 0
\end{equation}

What am I doing wrong?

Best Answer

Latexit will have a preamble and a postamble of its own which you can access through its preferences (Edit > Preferences)

enter image description here

The standard preamble contains a \begin{displaymath} and the postamble \end{displaymath}:

enter image description here

Hence if you add \begin{equation} and \end{equation} in your code, you will get an error:

! LaTeX Error: \begin{document} ended by \end{displaymath}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.11 \end{displaymath}

! Extra \endgroup.
<recently read> \endgroup 

l.11 \end{displaymath}

Remove \begin{equation} and \end{equation}, you get the result:

enter image description here

PS: Since the equations are exported as images from latexit and inserted elsewhere, I feel that it is not a good idea to use equation number (which is inserted by equation environment) and a label. It is better if they are included in the main document. However, for your own reasons if you want them, replace \begin{displaymath} with \begin{equation} in the preamble and \end{displaymath} with \end{equation} in the postamble of latexit.

Related Question