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}