Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I wrote the following equation array.

\begin{eqnarray}
  w_{0}     & < & 1 \\

  w^{m}_{i}     & = & \left \{
      \begin{matrix}
    w_{0}           & i = 0 \\
    \frac{1-w_{0}}{2L}  & i > 0
      \end{matrix} \right. \\

  w^{c}_{ij}    & = & \left \{
      \begin{matrix}
    0           & i \neq 0 \\ 
    \frac{1-w_{0}}{2L}  & i = 0 
      \end{matrix} \right. \\

  \zeta     & = & \sqrt{\frac{L}{1-w_{0}}}
\end{eqnarray}

This produces the following Error messages when compiled with pdflatex. I triple checked the alignment characters. Please Help me!

! Missing $ inserted.
<inserted text> 
                $
l.286 

? 
! Missing } inserted.
<inserted text> 
                }
l.286 

? 
! Missing } inserted.
<inserted text> 
                }
l.286 

? 
! Missing \cr inserted.
<inserted text> 
                \cr 
l.286 

? 
! Missing { inserted.
<inserted text> 
                {
l.286 

? 
! Missing $ inserted.
<inserted text> 
                $
l.286 

? 
! Missing $$ inserted.
<to be read again> 
                   \par 
l.286 

? 
! Missing $ inserted.
<inserted text> 
                $
l.287   w^
          {m}_{i}       & = & \left \{
? 
! Misplaced alignment tab character &.
l.287   w^{m}_{i}       &
                     = & \left \{
? 
! Misplaced alignment tab character &.
l.287   w^{m}_{i}       & = &
                         \left \{
? 
! Misplaced alignment tab character &.
\reserved@a ->&
                & &
l.292 

? 
! Misplaced alignment tab character &.
\reserved@a ->& &
                  &
l.292 

? 
! Misplaced alignment tab character &.
\reserved@a ->& & &

l.292 

? 
! Misplaced \cr.
\@@eqncr ...l \@eqnswtrue \global \@eqcnt \z@ \cr 

l.292 

? 
! Misplaced \noalign.
\@xeqncr [#1]->\ifnum 0=`{\fi }\@@eqncr \noalign 
                                                 {\penalty \@eqpen \vskip \j...
l.292 

? 
! Missing $ inserted.
<inserted text> 
                $
l.292 

? 
! Missing } inserted.
<inserted text> 
                }
l.292 

? 
! Extra }, or forgotten \endgroup.
\@xeqncr ... \@eqpen \vskip \jot \vskip #1\relax }

l.292 

? 
! Missing $ inserted.
<inserted text> 
                $
l.293   w^
          {c}_{ij}      & = & \left \{
? 
! Misplaced alignment tab character &.
l.293   w^{c}_{ij}      &
                      = & \left \{
? 
! Misplaced alignment tab character &.
l.293   w^{c}_{ij}      & = &
                          \left \{
? 
! Misplaced alignment tab character &.
\reserved@a ->&
                & &
l.298 

? 
! Misplaced alignment tab character &.
\reserved@a ->& &
                  &
l.298 

? 
! Misplaced alignment tab character &.
\reserved@a ->& & &

l.298 

? 
! Misplaced \cr.
\@@eqncr ...l \@eqnswtrue \global \@eqcnt \z@ \cr 

l.298 

? 
! Misplaced \noalign.
\@xeqncr [#1]->\ifnum 0=`{\fi }\@@eqncr \noalign 
                                                 {\penalty \@eqpen \vskip \j...
l.298 

? 
! Missing $ inserted.
<inserted text> 
                $
l.298 

? 
! Missing } inserted.
<inserted text> 
                }
l.298 

? 
! Extra }, or forgotten \endgroup.
\@xeqncr ... \@eqpen \vskip \jot \vskip #1\relax }

l.298 

? 
! Missing $ inserted.
<inserted text> 
                $
l.299   \zeta
                & = & \sqrt{\frac{L}{1-w_{0}}}
? 
! Misplaced alignment tab character &.
l.299   \zeta   &
                 = & \sqrt{\frac{L}{1-w_{0}}}
? 
! Misplaced alignment tab character &.
l.299   \zeta   & = &
                     \sqrt{\frac{L}{1-w_{0}}}
? 
! Misplaced alignment tab character &.
\reserved@a ->&
                & &
l.300 \end{eqnarray}

? 
! Misplaced alignment tab character &.
\reserved@a ->& &
                  &
l.300 \end{eqnarray}

? 
! Misplaced alignment tab character &.
\reserved@a ->& & &

l.300 \end{eqnarray}

? 
! Misplaced \cr.
\@@eqncr ...l \@eqnswtrue \global \@eqcnt \z@ \cr 

l.300 \end{eqnarray}

? 
! Extra }, or forgotten $.
\H@endeqnarray ->\@@eqncr \egroup 
                                  \global \advance \c@equation \m@ne $$\@ign...
l.300 \end{eqnarray}

? 
! Missing $ inserted.
<inserted text> 
                $
l.300 \end{eqnarray}
share|improve this question
1  
Welcome to TeX.SX! I think you should have a look to eqnarray vs align. –  Claudio Fiandrino May 9 at 12:46

1 Answer 1

up vote 4 down vote accepted
  1. Never ever use blank lines in a math display environment
  2. Never ever use eqnarray: eqnarray vs align

Example

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
w_{0}      & <  1 \\
w^{m}_{i}  & =
  \begin{cases}
  w_{0}              & i = 0 \\
  \frac{1-w_{0}}{2L} & i > 0
  \end{cases} \\
w^{c}_{ij} & = 
  \begin{cases}
  0                  & i \neq 0 \\ 
  \frac{1-w_{0}}{2L} & i = 0 
  \end{cases} \\
  \zeta   & = \sqrt{\frac{L}{1-w_{0}}}
\end{align}

\end{document}

enter image description here

A possible refinement with mathtools (that automatically loads amsmath)

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{align}
w_{0}      & <  1 \\
w^{m}_{i}  & =
  \begin{dcases}
  w_{0}              & i = 0 \\
  \frac{1-w_{0}}{2L} & i > 0
  \end{dcases} \\
w^{c}_{ij} & = 
  \begin{dcases}
  0                  & i \neq 0 \\ 
  \frac{1-w_{0}}{2L} & i = 0 
  \end{dcases} \\
  \zeta   & = \sqrt{\frac{L}{1-w_{0}}}
\end{align}
\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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