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
\advance\hsize-2\captionindent\noindent
\@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp
{\@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
\noindent\unhbox\@ne\advance\hsize-2\captionindent\par}%
\fi
\addvspace\abovecaptionskip
\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...
\addvspace\abovecaptionskip
\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
.
You can modify the length \floatsep
, as appropriate, which designates the vertical distance/length between floats at the top/bottom of a page. By "as appropriate" you would typeset your document and only worry about this (manual) fine-tuning at the end.
The following minimal example shows two pages that are duplicate, except for a modification in \floatsep
to show the effect of modifying the float separation.
\documentclass{article}
\usepackage[demo]{graphicx}% http://ctan.org/pkg/graphicx
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\begin{document}
\lipsum[1]
\begin{figure}[t]
\centering \includegraphics{figure1}
\caption{This is a figure}
\end{figure}
\begin{figure}[t]
\centering \includegraphics{figure2}
\caption{This is another figure}
\end{figure}
\lipsum[2]
\clearpage
\setlength{\floatsep}{1pt}
\lipsum[1]
\begin{figure}[t]
\centering \includegraphics{figure1}
\caption{This is a figure}
\end{figure}
\begin{figure}[t]
\centering \includegraphics{figure2}
\caption{This is another figure}
\end{figure}
\lipsum[2]
\end{document}
From the layouts
package documentation it is possible to see the lengths in terms of page/document float elements (p 21 onward):
The default is 12.0pt plus 2.0pt minus 2.0pt
which allows for a 2pt
stretchability from 12pt
.
It is also possible to modify the distance between the figure and the caption using the skip
key-value from the caption
package. Default is 10pt
.
Best Answer
When the caption is below the float contents, you can adjust the following caption parameters through
\captionsetup
:aboveskip
(space between the float contents and the caption)belowskip
(space after the caption)The default values are, for
scrbook
class,aboveskip=10pt
andbelowskip=0pt
. Also, a\baselineskip
is added by default before the floating object and1.2\baselineskip
after it, IIRC.The above settings don't work for listings. But you can similarly set these parameters for listings through
\lstset
:abovecaptionskip
(space between the float contents and the caption)belowcaptionskip
(space after the caption)aboveskip
(space between the float contents and the preceding text)belowskip
(space between the float contents and the following text)So leaving
figure
parameters untouched and adding in your\lstset
something likeshould do what you want.
Complete code
Output
You can adjust these values if you think they don't meet your needs.