# Longtable caption too separated

I'm using \longtable for a wide table (wider than the example) and the caption appears too separate from the table. I know I could use the option skip like \usepackage[skip=0pt]{caption}, but this will affect all my figures and tables and the problem is only in one of them, the longtable.

I get the warning \captionof(caption) outside box or environment, but I can't place it before \end{longtable}.

Thanks!

\documentclass[12pt,twoside,titlepage,headinclude]{scrreprt}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage[font=small,labelfont=bf,justification=justified]{caption}% I need this options
\begin{document}

\begin{longtable}{c  c  c}
\toprule
\textbf{Parameter} & \textbf{Used values} & \textbf{Units}\\
\midrule
a & 1 & 10\\
b & 2 & 20\\
c & 3 & 30\\
\bottomrule
\end{longtable}
\captionof{table}[Short caption.]{Long caption}
\label{tab:data}\vspace{1cm}

\end{document}


Without your complete table, I don't get problems. But here is, how you may add the skip just to this table.

% arara: pdflatex

\usepackage{longtable}
\usepackage{booktabs}
\usepackage[%
,font=small
,labelfont=bf
,justification=justified
]{caption}

\begin{document}
\begin{longtable}{c  c  c}
\toprule
\textbf{Parameter} & \textbf{Used values} & \textbf{Units}\\
\midrule
a & 1 & 10\\
b & 2 & 20\\
c & 3 & 30\\
\bottomrule
\captionsetup{skip=0pt}
\caption[Structure of the chromosphere.]{Parameters for the structure of the chromosphere in solar type star models.}
\label{tab:parchromos}
\end{longtable}
\end{document}


As you can see, this fixes the numbering aswell. You should use the \captionof{}[]{} only for very long captions (more than a paragraph). If you are having this case, you need to clarify your question.

• Thanks, the problem was \captionof indeed. If I use \caption, the skip option is not needed anymore. – Cecilia Guerra Apr 16 '14 at 15:48