6

When using one of the main KOMA-Script classes — scrartcl, scrreprt, scrbook but not scrlttr2 —, the vertical position of the caption in a longtable environment changes when one loads or unloads the xcolor package: if the latter is loaded, there is an additional spacing above the caption.

Here is a minimal working example.

\documentclass[a4paper]{scrartcl}% scrartcl, scrreprt, scrbook

\usepackage{xcolor}% comment and uncomment to see the effect
\usepackage{longtable}

\begin{document}
%
\noindent%
\centering%
Blah blah blah blah.
\begin{longtable}{l l l l}
\hline
\caption{Caption} \\
\hline
\endfirsthead
\hline
\endfoot
Cell & Cell & Cell & Cell \\
Cell & Cell & Cell & Cell \\
\end{longtable}
Blah blah blah blah.
%
\end{document}

The result is given in the following picture.

Caption spacing in longtable whether xcolor is loaded or not

The problem also happens if I load xcolor after longtable or if I put the caption at the foot of the table. But, if I load the caption package, the additional space disappears and the result is the first — expected — one in every case. I just don’t need this additional package, provided that I can get what I want with the commands and options from the KOMA-Script classes. Finally, there is no such situation with the standard classes, whether the package caption is loaded or not.

(Just a few remarks about my code: I have only inserted the \hline before the caption to make the situation clearer, and the problem still occurs without it; furthermore, in a final version, I would obviously use \captionabove instead of \caption or the KOMA-Script option captions=tableheading, as well as booktabs!)

The question is: how do I get rid of the additional space without loading the caption package?

I have a subsidiary question: why is the spacing after the longtable environment greater than the spacing before? By default, both lengths \LTpre and \LTpost are defined as equal to \bigskipamount, in the longtable package.

3

1 Answer 1

6

A workaround without loading any extra packages is

\def\capfont{\leavevmode\normalfont\normalcolor}

which adds \leavevmode

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .