TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some problems using longtable with a caption. The caption repeats every page therefore multiple entries are created in the list of tables. I only want one caption per table - for the following example there should be one caption and one entry in the list of tables - not three.

How can this be achieved?

\documentclass{scrbook}
\usepackage{longtable}
\begin{document}
\listoftables

\renewcommand{\arraystretch}{5.0}
\begin{longtable}[htb]{|p{1in}|p{1in}|}
\caption{my table}\\
    \hline 
    1 & 2 \\
    \endhead
    \hline  a & b  \\ \hline c & d \\ \hline e & f \\
    \hline  a & b  \\ \hline c & d \\ \hline e & f \\
    \hline  a & b  \\ \hline c & d \\ \hline e & f \\
    \hline  a & b  \\ \hline c & d \\ \hline e & f \\
    \hline  a & b  \\ \hline c & d \\ \hline e & f \\
\end{longtable}
\end{document}
share|improve this question
up vote 6 down vote accepted

Use \endfirsthead to define the first table heading (including a \caption), and \endhead for all other headings. See section 3 of the longtable documentation for details.

\documentclass{scrbook}
\usepackage{longtable}
\begin{document}
\listoftables

\renewcommand{\arraystretch}{5.0}
\begin{longtable}[htb]{|p{1in}|p{1in}|}
    \caption{my table}\\
    \hline 
    1 & 2 \\
    \endfirsthead
    \hline 
    1 & 2 \\
    \endhead
    \hline  a & b  \\ \hline c & d \\ \hline e & f \\
    \hline  a & b  \\ \hline c & d \\ \hline e & f \\
    \hline  a & b  \\ \hline c & d \\ \hline e & f \\
    \hline  a & b  \\ \hline c & d \\ \hline e & f \\
    \hline  a & b  \\ \hline c & d \\ \hline e & f \\
\end{longtable}
\end{document}
share|improve this answer
    
Is there any way to prevent the duplication of the sections? Like a \endsharedhead section? – Kevin Cox Apr 6 at 17:04

define \endfirsthead

\documentclass{scrbook}
\usepackage{longtable}
\begin{document}
\listoftables

\renewcommand{\arraystretch}{5.0}
\begin{longtable}[htb]{|p{1in}|p{1in}|}
\caption{my table}\\\hline 
\endfirsthead
\hline
        1 & 2 \\
    \endhead
    \hline  a & b  \\ \hline c & d \\ \hline e & f \\
    \hline  a & b  \\ \hline c & d \\ \hline e & f \\
    \hline  a & b  \\ \hline c & d \\ \hline e & f \\
    \hline  a & b  \\ \hline c & d \\ \hline e & f \\
    \hline  a & b  \\ \hline c & d \\ \hline e & f \\
\end{longtable}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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