“[” Square bracket Curiosities in an array environment [duplicate]

I am aware of the fact all of the following examples are in fact not the right way of doing whatever they do. But, I came across these examples by playing around with the code that WinEdt produces for inserting a cases environment.

\documentclass{amsart}
\begin{document}
\begin{eqnarray}
\tau_G(g) = \left\{
\begin{array}{ll}
a & b \\
[G & l
\end{array}
\right.
\end{eqnarray}
\end{document}


This one fails with the error, "Runaway Argument, missing { inserted".

However, the following does work:

\documentclass{amsart}
\begin{document}
\begin{eqnarray}
\tau_G(g) = \left\{
\begin{array}{ll}
[a & b \\
%[G & l
\end{array}
\right.
\end{eqnarray}
\end{document}


I am unable to parse this error. When playing with some linear combination of these examples, I got the following error:

ERROR: File ended while scanning use of \@argarraycr.


Can someone shed some light on this, please?

-

marked as duplicate by Matthew Leingang, kan, ArTourter, Kurt, David CarlisleMay 15 '13 at 13:36

\\ takes an optional argument, so the [ following \\ is taken to be the start of the optional argument. Just put the [ inside braces.

\documentclass{amsart}
\begin{document}
\begin{eqnarray}
\tau_G(g) = \left\{
\begin{array}{ll}
a & b \\
{[}G & l
\end{array}
\right.
\end{eqnarray}
\end{document}

-