2

The following LaTeX code looks pretty straightforward to me:

\begin{eqnarray*}
& \lambda_l \mathbf{l}\cdot\mathbf{r} & = & \lambda_r \mathbf{l}\cdot\mathbf{r} \nonumber \\
\therefore & \mathbf{l}\cdot\mathbf{r} & = & 0 \nonumber
\end{eqnarray*}

but it results in the error:

! Missing $ inserted.
<inserted text> 
                $
l.78 ..._l \mathbf{l}\cdot\mathbf{r} & = & \lambda
                                                  _r \mathbf{l}\cdot\mathbf{...

If I remove enough ampersands, I get a clean execution, but then I lose the alignment I am trying to get.

Is there a problem with the implicit first empty item on the first line, or is it caused by something else?

  • There can be at most two & per line. On the other hand, eqnarray is not the right tool for the job. – egreg Apr 11 '17 at 14:38
  • @egreg Well, that clears things up. I am looking at my LaTeX manual right now where eqnarray is discussed and I notice for the first time that all the examples have only two ampersands. But I can't see anywhere where it is explicitly stated that this is the limit. Could you tell me where this is documented? Thanks! – bob.sacamento Apr 11 '17 at 14:42
  • You shouldn't be using eqnarray to begin with: it's broken; see eqnarray vs align – egreg Apr 11 '17 at 14:44
  • 1
    @egreg -- as much as i don't like eqnarray, i never thought of it as "broken" to the extent that it would produce such a misleading error message. now i agree -- it's definitely broken! – barbara beeton Apr 11 '17 at 17:49
8

The eqnarray environment allows at most two & per row.

On the other hand it is broken and should not be used, see eqnarray vs align

Here are two realizations with amsmath environments. My favorite is the latter.

\documentclass{article}
\usepackage{amsmath,mathtools}
\usepackage{amssymb}

\usepackage{lipsum} % just for the example

\begin{document}

\lipsum*[3]
\begin{alignat*}{2}
&            &\quad \lambda_l \mathbf{l}\cdot\mathbf{r}  & = \lambda_r \mathbf{l}\cdot\mathbf{r}\\
& \therefore &\quad \mathbf{l}\cdot\mathbf{r}            & = 0
\end{alignat*}
\lipsum*[4]
\begin{align*}
\lambda_l \mathbf{l}\cdot\mathbf{r}  & = \lambda_r \mathbf{l}\cdot\mathbf{r}\\
\shortintertext{therefore}
\mathbf{l}\cdot\mathbf{r}            & = 0
\end{align*}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.