[Tex/LaTex] Space between caption and table in TeX

captionsspacingtables

I have this code

\begin{table}[h]
\caption{Numerical example geometry}
\label{tab_numerical_geo}
\begin{center}
\scalebox{0.9}{
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
$d^A$  & $d^B$  & $d^C$  & $l^A_{12}$ & $l^C_{12}$ & $h^A$ & $h^C$ \\
\hline
-0.4434 & 0.3455 & 0.7798 & 0.1023 & 0.1523 & 0.04 & 0.023 \\
\hline
\end{tabular}
}
\end{center}
\end{table}

I'm using \scalebox to reduce the size of the table, but it shrinks the space between the caption and the table. Without using it, there is a space, which is nice for my article.

Does anyone know how to reduce the size of the table while keeping that space?
I've tried with \footnotesize instead of \reducebox, but the result was the same.
Thanks!

Best Answer

Some suggestions:

  • To create a bit more spacing between the caption and the tabular material, load the caption package and specify the desired value for the option skip; in the example below, I set skip=0.5\baselineskip.

  • Don't use a center environment inside a table; instead, use the \centering macro.

  • Since the material in the data row can, apparently, contain negative numbers, use an array environment instead of a tabular environment. Doing so will free you from having to type lots of $ symbols in the header row.

  • If you must use a smaller font size, don't use \scalebox, as doing so will create very "spindly-looking" output. Instead, use \small (for a 10% linear reduction of the font size) or \footnotesize (for a 20% linear reduction).

  • For better spacing in the header and data rows, insert typographic struts.

enter image description here

\documentclass{article}
\usepackage[skip=0.5\baselineskip]{caption}
%% define a few struts
%% (from code by Claudio Beccari in TeX and TUG News, Vol. 2, 1993)
\newcommand\Tstrut{\rule{0pt}{2.9ex}}         % "top" strut
\newcommand\Bstrut{\rule[-1.2ex]{0pt}{0pt}}   % "bottom" strut
\newcommand\TBstrut{\Tstrut\Bstrut}           % "top and bottom" strut

\begin{document}

\begin{table}
\caption{Numerical example geometry}
\label{tab_numerical_geo}
\small % better than \scalebox{0.9}{...}
\centering
$\begin{array}{|*{7}{c|}}
\hline
d^A\TBstrut & d^B  & d^C  & l^{A}_{12} & l^C_{12} & h^A & h^C \\
\hline
-0.4434\TBstrut & 0.3455 & 0.7798 & 0.1023 & 0.1523 & 0.04 & 0.023 \\
\hline
\end{array}$
\end{table}
\end{document}
Related Question