# In amsart, how I can get caption spacing in tables to be like that in figures?

In the document class amsart, I get different vertical spacing around the caption in tables and figures. For instance, compare the difference:

\documentclass{amsart}
\begin{document}

\begin{figure}
\begin{center}
\begin{tabular}{c}
Figure
\end{tabular}
\caption{Caption}
\end{center}
\end{figure}

\begin{table}
\begin{center}
\begin{tabular}{c}
Table
\end{tabular}
\caption{Caption}
\end{center}
\end{table}
\end{document}


Is this a bug? More to the point, is there some way of getting the figure spacing in tables? If I change the document class to article, then the spacings become the same.

-

Im amsart captions are usually positioned above a table and below a figure. It's very common in typesetting. That means, position the \caption command before you begin the tabular environment. Then there will be the appropriate space between the caption and the table. Or do you want to use the intended style?

If needed, a quick fix would be to add the missing space manually before the caption:

\begin{center}
\begin{tabular}{c}
Table
\end{tabular}
\vspace{\abovecaptionskip}
\caption{Caption}
\end{center}
\end{table}


In that case, consider to remove the space after the caption by this line in the preamble:

\setlength{\belowcaptionskip}{0pt}


Or set it to the space you like. Similar you can change the value of \abovecaptionskip.

Alternatively, you could use the very fine caption package. It offers many ways of customizing caption format and justification. For instance, if you just write

\usepackage[tableposition=above]{caption}


then you may put \caption above the tabular environment and get the correct spacing.

However, if you don't want to use the caption package, you could redefine the internal \@makecaption command of amsart by writing in your preamble:

\makeatletter
\renewcommand{\@makecaption}[2]{%
\setbox\@tempboxa\vbox{\color@setgroup
{\@cdr#2\@nil}{.\@captionfont\upshape\enspace#2}%
\unskip\kern-2\captionindent\par
\global\setbox\@ne\lastbox\color@endgroup}%
\ifhbox\@ne % the normal case
\setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}%
\fi
\ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line
\setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}%
\else % tempboxa contained more than one line
\setbox\@ne\vbox{\unvbox\@tempboxa\parskip\z@skip
\fi
\hbox to\hsize{\kern\captionindent\box\@ne\hss}%
\relax
}
\makeatother


I just removed the different handling of figures and other floats. The original code has the difference here:

  \ifnum\@tempcnta<64 % if the float IS a figure...
\hbox to\hsize{\kern\captionindent\box\@ne\hss}%
\else % if the float IS NOT a figure...
\hbox to\hsize{\kern\captionindent\box\@ne\hss}%
\nobreak
\vskip\belowcaptionskip
\fi


just before the last \relax. Note, it's usually not a good idea to redefine internal commands like this. Such commands might be changed later. It's just a workaround for the moment.

And doing it with caption package features is much more easier.

Finally, note: using \begin{center} ... \end{center} inside a figure or float environment causes additional space since the center environment is a list environment internally, bringing some space before and after it. I recommend to use the command \centering instead. Perhaps see center vs. \centering.

-
The first suggestion is perfect. Thanks. –  James Borger Aug 18 '10 at 11:56