7

Following code

... \begin{align}
\begin{array}
1 & 2 & 3\\
1 & 2 & 3
\end{array}
\end{align}...

results in numerous errors:

 - Argument of \array has an extra }   (line 0)
 - Missing $ inserted \end{align}
 - Missing \endgroup inserted \end{align} 
 - Extra }, or forgotten $ \end{align} 
 - \begin{align} on input line 101 ended by \end{array}. \end{align} 
 - Misplaced alignment tab character & \end{align}   (2x, same line) 
 - Misplaced \omit \end{align} 
 - Misplaced \cr \end{align}
 - Misplaced alignment tab character & \end{align} (2x)
 - Misplaced \cr \end{align} 
 - Extra }, or forgotten $ \end{align} (2x)
 - Missing number, treated as zero \end{align}
 - Illegal unit of measure (pt inserted) \end{align}
 - Missing number, treated as zero (3x, line 0)
 - Missing $ inserted \end{align} 
 - Display math should end with $$ (line 0)
 - Missing $ inserted \end{align}
 - Missing \endgroup inserted \end{align}
 - Extra }, or forgotten $ \end{align} 
 - Missing $ inserted \end{align} 
 - Too many }'s \end{align} 
 - \begin{document} ended by \end{array}. (line 0) 
 - Misplaced \noalign \end{align} (2x)
 -  Too many }'s \end{align}
 - \begin{document} ended by \end{align}. \end{align} 
 - Display math should end with $$ (line 0)

Of course code without this compiles just fine.

All errors are at line 109 (\end{align}), except those at line 0.

Matrix environment (examples) also compiles with errors, but fewer. These are:

 - Paragraph ended before \array was complete I've inserted a
   begin-math/end-math symbol since I think

 - Missing \right. inserted I've inserted something that you may have
   forgotten.

 - Missing \endgroup inserted

I'm using TexStudio on Ubuntu. I also tried with Geany but it throws the same errors.

1
  • 3
    Welcome to TeX.sx. Glad somebody answered your question. In general it is better if you provide a complete minimal working example that people con compile (so including \documentclass, \begin{document}, \end{document} and so on). Happy TeXing.
    – user10274
    Jul 28, 2012 at 22:01

1 Answer 1

10

You need to specify the array format; for example:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
\begin{array}{ccc}
1 & 2 & 3\\
1 & 2 & 3
\end{array}
\end{align}

\end{document}

enter image description here

Some new information has been given in the comments; the problem comes from using the arrayjob and amsmath packages simultaneously, as this example shows:

\documentclass{article}
\usepackage{arrayjob}
\usepackage{amsmath}

\begin{document}

\begin{align}
\begin{array}{ccc}
1 & 2 & 3 \\
1 & 2 & 3
\end{array}
\end{align}

\end{document}

Processing the above document triggers the error

! Argument of \array has an extra }.
<inserted text> 
                \par 
l.12 \end{align}

The conflict comes from the macro name \array used by arrayjob which conflicts with macros in amsmath; the arrayjobx package (which is an improved version of arrayjob) solves this issue using the macro \arrayx instead. Thus, in order to prevent the conflict between the packages arrayjob and amsmath, use arrayjobx instead of arrayjob:

\documentclass{article}
\usepackage{arrayjobx}
\usepackage{amsmath}

\begin{document}

\begin{align}
\begin{array}{ccc}
1 & 2 & 3\\
1 & 2 & 3
\end{array}
\end{align}

\end{document}

I am aware that there's no point in using array inside align as I did in my answer; if the only intent is to get a displayed (numbered) expression, the equation environment would be a better choice; if no display number is needed, then \[...\] is enough. I kept the original align just in the hope that the OP's actual expression deserves its use.

8
  • Sorry, forget to copy that. It works in new file, but not in mine. Maybe some package conflict? Jul 28, 2012 at 22:07
  • @onetoomany then please reduce your file (by commenting out chunks, for example) until you get a minimal version allowing us to reproduce the problem and edit your question with this minimal version. Jul 28, 2012 at 22:10
  • Again, I made an idiot out of myself. It was a conflict with an arrayjob package. Jul 28, 2012 at 22:17
  • 1
    @onetoomany again, edit your question and add a complete minimal document illustrating the problem. Jul 28, 2012 at 22:18
  • 2
    +1 although I wonder if it is appropriate to wrap an array in an align environment... It seems like it, unless there is more to the actual example, that one should just use \[...\] or else the equation environment
    – cmhughes
    Jul 28, 2012 at 23:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .