[OS X TeX] "Runaway argument?" error in figure caption

John B. Thoo jthoo at yccd.edu
Tue Jul 17 15:38:25 CEST 2012

Hi, everyone.  I apologize that this is not a Mac-specific question, but rather a general LaTeX question; however, I don't know whom else to ask.

This code

\begin{figure}
\begin{tikzpicture}
\pgftransformscale{0.75}
%% axes
\draw[help lines,lightgray] (-1,-1) grid (5,5);
\draw[thin] (-1,0) -- (5,0) node[anchor=north]{$x$};
\draw[thin] (0,-1) -- (0,5) node[anchor=west]{$y$};
%% u and (u1,u2)
\draw[thick,-latex] (0,0) -- (3,4);
\draw (1.6,2) node[anchor=west]{$\vec{u} = \left[\begin{array}{c} 3 \\ 4 \end{array}\right]$};
\fill (3,4) circle (0.08) node[anchor=west]{$(3,4)$};
\end{tikzpicture}
\caption{It is useful to picture vectors as arrows, although this may not be a literal representation of vectors.  Here we identify the vector $\vec{u} = \left[\begin{smallmatrix} 3 \\ 4 \end{smallmatrix}\right]$ in $\R{2}$ represented as an arrow with the point $(3,4)$ in the $xy$ plane.}
\label{fig.syslineqns:vectorasarrow}
\end{figure}

produces this error

[5]
! Argument of \@caption has an extra }.
<inserted text>
\par
l.177 ...ith the point $(3,4)$ in the $xy$ plane.}

?
Runaway argument?
\@captype {\def \@currenvir {smallmatrix}\edef \@currenvline {\on at line \ETC.
! Paragraph ended before \@caption was complete.
\par
l.177 ...ith the point $(3,4)$ in the $xy$ plane.}

?

Overfull \hbox (73.62pt too wide) in paragraph at lines 217--249
[]$[]$
[6] [7]

The figure and caption appear to typeset OK, though.  I think the error is because of the  \begin{smalltrix}...\end{smallmatrix},  but I don't know how to fix it.

Any suggestions?  I am using TeX-Live 2009 that I typeset using pdflatex in an xterm window and view using Preview.  My OS is Lion.

Thanks very much.

---John.