# Longtables and caption: spacing problem

I have been using the \longtable environment and I have an issue with the captions.
All captions appear at the bottom of each part of the table, which is the result I wanted. However, there is a quite annoying wrinkle: only the caption at the bottom of the last part of the table is too close to the table border, and I cannot figure out how to control the spacing within \longtable.

This is the code I have been using:

\begin{document}
\begin{center}
\scriptsize
\begin{longtable}{|p{2cm}|p{4cm}|p{8cm}|}\hline\hline
\multicolumn{1}{|p{2cm}|}{\textbf{Text1}} &
\multicolumn{1}{p{4cm}|}{\textbf{Text2}} &
\multicolumn{1}{p{8cm}|}{\textbf{Text3}}\\ \hline

\multicolumn{3}{p{3cm}}
{{\bfseries \tablename\ \thetable{} -- continued from previous page}}\\
\hline\multicolumn{1}{|p{2cm}|}{\textbf{Text1}} &
\multicolumn{1}{p{4cm}|}{\textbf{Text2}} &
\multicolumn{1}{p{8cm}|}{\textbf{Text3}}\\\hline

\hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
\caption[Caption]{Caption}\label{label-caption}
\endfoot
\caption[Caption]{Caption}\label{label-caption}
\endlastfoot

\end{longtable}
\end{center}
\end{document}


Any advice is more than welcome! Thanks. I.

• What document class and what other (caption or longtable related) packages are you using?
– user2574
Jun 9, 2011 at 6:22
• @Axel, I am using \documentclass[12pt,a4paper]{report}, \usepackage[float], and \usepackage{longtable} To my understanding, \usepackage[float] takes care of all captions in figures or tables and numbers them accordingly. Jun 10, 2011 at 18:17
• please see my edited answer for a possible solution. Jun 10, 2011 at 20:09
• The float package offers the redesign of existing float types or the definition of new floating environments. Futhermore it offers the float placement "H" for "place it here!". That's all this package does, so it does not take care of captions or numbering of existing floating environments like figure or table. And it does not touch longtable, neither the captions nor the numbering of them.
– user2574
Jun 11, 2011 at 6:18

If you don't mind using the caption package, you can increase the vertical spacing between the table and the caption by using something like the following (change 1em to the value that best suits your needs):

\usepackage[tableposition=below]{caption}
\captionsetup[longtable]{skip=1em}


EDIT: I changed my answer according to Axel's comment.

• 1. By default the longtable package is not using \abovecaptionskip or \belowcaptionskip at all but a \baselineskip below the caption instead. 2. When using the caption package better use the package option tablecaption=b and \captionsetup[longtable]{skip=1em}.
– user2574
Jun 9, 2011 at 5:44
• @Axel Sommerfeldt: thank you for your comments. Initially I deleted my answer, but then I decided to undelete it and edit it according to your suggestion. – Gonzalo Medina Jun 10, 2011 at 20:08

you shouldn't use the center-environment. You get additional space between the text and the table. longtable has an optional argument which controls the horizontal alignment.

I can't see any problems?

\documentclass{scrartcl}
\usepackage{longtable}
\usepackage{ltcaption}
\usepackage{showframe,lipsum}

\begin{document}
\lipsum[1]
\begin{scriptsize}
\begin{longtable}{|p{2cm}|p{4cm}|p{8cm}|}\hline\hline
\multicolumn{1}{|p{2cm}|}{\textbf{Text1}} &
\multicolumn{1}{p{4cm}|}{\textbf{Text2}} &
\multicolumn{1}{p{8cm}|}{\textbf{Text3}}\\ \hline

\multicolumn{3}{p{3cm}}
{{\bfseries \tablename\ \thetable{} -- continued from previous page}}\\
\hline\multicolumn{1}{|p{2cm}|}{\textbf{Text1}} &
\multicolumn{1}{p{4cm}|}{\textbf{Text2}} &
\multicolumn{1}{p{8cm}|}{\textbf{Text3}}\\\hline

\hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
\caption[Caption]{Caption}\label{label-caption}
\endfoot
\caption[Caption]{Caption}\label{label-caption}
\endlastfoot

\end{longtable}
\end{scriptsize}

\clearpage
\lipsum[1]
\begin{center}
\scriptsize
\begin{longtable}{|p{2cm}|p{4cm}|p{8cm}|}\hline\hline
\multicolumn{1}{|p{2cm}|}{\textbf{Text1}} &
\multicolumn{1}{p{4cm}|}{\textbf{Text2}} &
\multicolumn{1}{p{8cm}|}{\textbf{Text3}}\\ \hline

\multicolumn{3}{p{3cm}}
{{\bfseries \tablename\ \thetable{} -- continued from previous page}}\\
\hline\multicolumn{1}{|p{2cm}|}{\textbf{Text1}} &
\multicolumn{1}{p{4cm}|}{\textbf{Text2}} &
\multicolumn{1}{p{8cm}|}{\textbf{Text3}}\\\hline

\hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
\caption[Caption]{Caption}\label{label-caption}
\endfoot
\caption[Caption]{Caption}\label{label-caption}
\endlastfoot

\end{longtable}
\end{center}

\end{document}

• thank you very much for your help. I am currently using \documentclass[12pt,a4paper]{report}, \usepackage[float], and \usepackage{longtable} in my preamble, and it does not seem to work for me. You seems to include \center in your example, would it be of any problem to see what kind of output your compilation returns? Thanks indeed, I. Jun 10, 2011 at 18:37

\caption{\label{tab:tab1} Some text in caption}\\

\begin{longtable}{|p{5cm}|p{5cm}|p{5cm}|}