1

when i place a longtable at the bottom of the page a page break occurs and the table starts at the next page. This is absolutely correct and the expected behaviour. But instead of the first header i got both headers printed on the next page.

I tried to put \nopagebreaks everywhere in my code but it doesn't work. And i didn't found a solution for this. Can't believe that this is the first time this error occurs?! Or maybe i googled for the wrong error description ;)

There is a similar Question but the solution doesn't work for me because i don't do the file processing via LyX: Question 149986

Thanks in advance. Martin

MWE:

\documentclass{scrartcl}
\usepackage{longtable}

\begin{document}

\section{My awesome section}
\vspace{175mm}
With some really awesome Text ;)
\begin{longtable}{|c|c|c|}
  \caption{The first table header}\\ \hline
  The & First & Header \\ \hline
  \endfirsthead
  \caption{The main table header (continued)}\\ \hline
  The & Main & Header \\ \hline
  \endhead
  The & Content & 1 \\ \hline
  The & Content & 2 \\ \hline
  The & Content & 3 \\ \hline
\end{longtable}

\end{document}

Output at the top of the second page:

enter image description here

1 Answer 1

2

The documentation (338 kb) says (p. 4, beginning of chapter 3) that one shall replace the \\ by \endhead resp. \endfirsthead.

% arara: pdflatex

\documentclass{scrartcl}
\usepackage{longtable}

\begin{document}
\section{My awesome section}
\vspace{175mm}
With some really awesome Text ;)
\begin{longtable}{|c|c|c|}
  \caption{The first table header}\\ \hline
  The & First & Header \endfirsthead %\hline % as mentioned in comment
  \caption{The main table header (continued)}\\ \hline
  The & Main & Header \endhead \hline
  The & Content & 1 \\ \hline
  The & Content & 2 \\ \hline
  The & Content & 3 \\ \hline
\end{longtable}
\end{document}

enter image description here

2
  • Really great it works! I should read the docs more carefully next time ;) The only thing i modified in your code was to remove the \hline after \endfirsthead to remove the single line on top of the second page.
    – Martin
    Jul 17, 2014 at 6:56
  • Oh, I should read my answers more carefully... Didn't see that.
    – LaRiFaRi
    Jul 17, 2014 at 6:58

You must log in to answer this question.

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