I want to add a column vector inside a figure's caption, but it just doesn't work. However, I could write math inside captions, normally.
\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage{amsmath}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[scale=1.5]
\draw [step=0.5, thin, gray!40] (-1.4,-1.4) grid (1.4,1.4);
\end{tikzpicture}
\caption{I want to add a column vector in here}
%\caption{the vector $\left(\begin{smallmatrix}k \\ m\end{smallmatrix}\right)$}
\end{figure}
\end{document}
I have commented the line which gives me the error.
$\binom{k}{m}$command? – Sigur May 23 '18 at 13:29Argument of \@caption has an extra }.after I used what you have suggested\caption{the vector $\left(\begin{smallmatrix}\binom{k}{m}\end{smallmatrix}\right)$}– Taha Magdy May 23 '18 at 13:37$\binom{k}{m}$. You don't need the matrix. – Sigur May 23 '18 at 13:40{some where else, for instance one mistypes{ ... )instead of{ ... }. – Bernard May 23 '18 at 13:42\genfrac(on which\binomis based) as\caption{the vector $\protect\genfrac[]{0pt}{}{k}{m}$}. The\protectis essential. This of course won't work with three-dimensional vectors. But as pointed out in the second answer to the duplicate question, I believe using the optional parameter is the best solution. Seeing a vector in the list of figures isn't particularly useful. And if you are not going to print a list of figures at all, using\caption[]{...}(i.e. with an empty optional argument) is even simpler. – campa May 23 '18 at 13:54