# Illegal unit of measure(pt inserted)

I can't find my fault and appreciate any help for curing the error. Here is the code:

\documentclass[a4]{paper}
\usepackage{graphicx,slashed,color,amssymb}
\usepackage{xspace,colortbl,times,pause}
%\documentstyle[preprint,aps]{revtex}
\renewcommand{\baselinestretch}{1.6}
\begin{document}
\title{QFT}
\author{Athos\CZ}
\date{March 11, 2012}
\begin{eqnarray}
[\gamma^\nu,\sigma_{\alpha\beta}]w^{\alpha\beta}g_\alpha^\nu&=&4i\gamma^\mu w_\mu^\nu g_\beta^\mu\nonumber\\
[\gamma^\nu,\sigma_{\alpha\beta}]w^{\nu\beta}&=&4i\gamma^\mu w_\beta^\nu\\
\end{eqnarray}


I want to write two formula, but can do it. However, if I set the two formula apart as:

\begin{eqnarray}
[\gamma^\nu,\sigma_{\alpha\beta}]w^{\alpha\beta}g_\alpha^\nu&=&4i\gamma^\mu w_\mu^\nu g_\beta^\mu\nonumber\\
\end{eqnarray}
\begin{eqnarray}
[\gamma^\nu,\sigma_{\alpha\beta}]w^{\nu\beta}&=&4i\gamma^\mu w_\beta^\nu\\
\end{eqnarray}


there will be no problem. I'm so confused.

-

The analysis by @Stephan is correct: \\ is skipping spaces when looking for the optional argument and it finds the [ on the next line.

However is not correct to use \\{} to prevent this. It would stop \\ from looking for [ but {} introduces a "math atom" (kind of empty subformula) in the math formula and that messes up spacing or can mess up spacing. Example: $+a$ looks quite different from ${}+a$. As in this particular situation the {} is followed by [ the spacing will appear to be ok (as TeX will not add any space for this combination), but the moment the user changes [ to, say, \left[ without removing the {} things suddenly go wrong.

On possible solution is explicitly use an optional argument in this cases: \\[0pt]. An alternative is to use \\ \relax which also stops \\ to parse ahead for [.

As mentioned elsewhere eqnarray is defective in several respects and for serious math you should use the amsmathpackage and avoid this environment altogether. We would have taken it out of LaTeX2e if possible (it is really only in there for backward compatibility)

-
I would prefer using \\\relax over \\[0pt], because \relax is the right and easy-to-recognize "seperator". With [0pt], you might later wonder: "Why did I put here a zero vertical space?" –  yo' Mar 23 '12 at 12:47
@tohecz was thinking about this, but it is actually not an official document level command so I finally settled for the optional argument in my answer. LaTeX is really missing an official "stop-parsing" command, but you are right \relax might be good enough to play that role. –  Frank Mittelbach Mar 23 '12 at 13:24
In my opinion, \relax is THE "stop-parsing" command ;) –  yo' Mar 23 '12 at 14:05
@FrankMittelbach No eqnarray in LaTeX3 :-) –  Joseph Wright Mar 23 '12 at 15:50
@JosephWright - not yet. But if you want to have some input compatibility mode for 2e documents you are having a problem. So I wouldn't think this is fully gone eventually. –  Frank Mittelbach Mar 23 '12 at 20:33

As written in the top-voted answer to the question "\eqnarray vs \align"

Although eqnarray may seem to work "well enough", Avoid eqnarray! Avoid eqnarray! Avoid eqnarray!

Use align and the rest of the ams environments. See texdoc amsldoc (PDF) or the short math guide for LaTeX for documentation on how to use them.

Your example compiles if you simply use the amsmath package and substitute align for eqnarray:

\begin{align*}
[\gamma^\nu,\sigma_{\alpha\beta}]w^{\alpha\beta}g_\alpha^\nu&=4i\gamma^\mu w_\mu^\nu g_\beta^\mu\nonumber\\
[\gamma^\nu,\sigma_{\alpha\beta}]w^{\nu\beta}&=4i\gamma^\mu w_\beta^\nu\\
\end{align*}


(Notice that you only need one & to mark the alignment point.)

-

Your Problem is the \\ which is greedily looking for a [ holding its optional argument.

Try \\\relax (untested).

Edit: Thanks to @Frank for pointing out that {} is not the right thing to say.

-
As you can see at @FrankMittelbach 's answer, this is not a good thing to do. –  yo' Mar 23 '12 at 12:47
Uh well, no damage to be expected in front of [, is there ;-) –  Stephan Lehmke Mar 23 '12 at 15:09
In that case not, but we should make our solutions as general as possible. If there's such problem as that the tweak changes the LaTeX's behaviour, it should be at least commented in the answer. –  yo' Mar 23 '12 at 15:15
With the default meaning of [ as an "open" math atom this is in fact correct as "ord" followed by "open" has no space added in the hardwirded table in TeX (see TeXbook page 170). However, one day LuaTeX might make this table adjustable then you might see strange behavior even in this case. But you do not even need to look into using a TeX variant: just think about the user who changes his mind and changes [ to \left[ later on. Suddenly there is a difference even with TeX. –  Frank Mittelbach Mar 23 '12 at 20:25
Thanks for the explanation. –  Stephan Lehmke Mar 24 '12 at 5:23

I suggest you load the mathtools package. Loading the mathtools package will automatically fix the (well-documented but undesirable) property of the eqnarray and align environments to misinterpret a [ (left square bracket) that leads off an equation as the start of an instruction on how much extra vertical whitespace to leave below the preceding equation. Put differently, if you load the mathtools package, you don't have to remember to insert a [0pt] after \\ should the next equation lead off with [.

I have two additional comments on your MWE. First, I'd like to suggest you load the mathptmx package instead of the times package. If you load the times package, you'll get a document with Times New Roman as the text-mode font and Computer Modern as the math-mode font. The \mathptmx package, in contrast, loads Times-style text and and math fonts.

Second, don't set \renewcommand{\baselinestretch}{1.6}, because doing so will mess up the look of footnotes (which are usually set single-spaced) as well as the spacing around display-math material. Instead, include the instructions

\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.6}


Finally, do heed the advice already given in the other answers regarding the use the eqnarray environment: don't use eqnarray, use align instead.

With all of these suggestions implemented, your MWE might look like this:

\documentclass[a4]{article}
\usepackage{graphicx,slashed,color,xspace,colortbl,pause}
\usepackage{mathptmx,mathtools}
\usepackage{setspace}
\setstretch{1.6}
\begin{document}
\begin{align}
[\gamma^\nu,\sigma_{\alpha\beta}]  w^{\alpha\beta} g_\alpha^\nu
&= 4i\gamma^\mu w_\mu^\nu g_\beta^\mu\nonumber\\  % Observe: no need to insert [0pt]
[\gamma^\nu,\sigma_{\alpha\beta}] w^{\nu\beta}
&= 4i\gamma^\mu w_\beta^\nu
\end{align}
\end{document}


-