0

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}
1

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

% arara: pdflatex

\documentclass[12pt,twoside,titlepage,headinclude]{scrreprt}
\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}

enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.