if I use both table and longtable in one document, the spacing between the caption and the table (the empty space after the caption) is different for table and longtable.
I would prefer minimal (and indeed identical) spacing after the caption in both cases.
Thank you.
Example:
\documentclass[12pt]{article}
\usepackage{longtable, booktabs, graphicx}
\begin{document}
\begin{table}
\caption{This is the first caption}
\begin{center}
\resizebox{1\textwidth}{!}{
\begin{tabular}{@{}llllll@{}}
\toprule
\textbf{Name} & \textbf{Description} & \textbf{Unit} & \textbf{Data source} & \textbf{Time frame} & \textbf{Frequency} \\
\midrule
Name & Description & Unit & Data source & Time frame & Frequency \\
\bottomrule
\end{tabular}}
\end{center}
\end{table}
\begin{center}
\begin{longtable}{@{}p{2cm}p{1.5cm}p{3.6cm}p{1.2cm}p{1.5cm}p{1.5cm}@{}}
\caption{This is the second caption} \\
\toprule
\textbf{Author(s)} & \textbf{Area} & \textbf{Estimated relationship} & \textbf{Time frame} & \textbf{Scope} & \textbf{type} \\
\midrule
\endfirsthead
\multicolumn{6}{c}{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
\toprule
\textbf{Author(s)} & \textbf{Area} & \textbf{Estimated relationship} & \textbf{Time frame} & \textbf{Scope} & \textbf{ type} \\
\midrule
\endhead
\midrule
\multicolumn{6}{r}{\textit{Continued on next page}} \\
\endfoot
\bottomrule
\endlastfoot
name & area & relationship & time & scope & type \\
\end{longtable}
\end{center}
\end{document}
Best Answer
Load the
caption
package:center
environment insidetable
, but\centering
center
environment aroundlongtable
: the table will appear centered by default\resizebox
only as a last resortNarrow
p
columns may be better handled if you add\raggedright
, which you can do with thearray
package:would be a good declaration for your third
longtable
column (add\usepackage{array}
to your preamble.