TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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 am trying to use longtable with repeating headers on each page. For example:

Column 1 & Column 2 & Column 3 \endhead \midrule

results in an ugly multi-page table. The horizontal rule separating the headers from the data appears only on the first page.

In an attempt to fix it:

Column 1 & Column 2 & Column 3 \midrule \endhead

I'd get the following error upon compile:

! Misplaced \noalign.
\midrule ->\noalign 
                    {\ifnum 0=`}\fi \@aboverulesep =\aboverulesep \global \@...
l.6 ...) & Column 2 & Column 3 \midrule

How do I make the horizontal rule also appear on every page?

Here's a screenshot of the part of the manual where \endhead is described: alt text

share|improve this question
up vote 11 down vote accepted

It seems that you simply forgot the double \\

\geometry{paperwidth=5cm,paperheight=5cm}%a very small page
 \caption{My longtable} \\
col 1 &col 2  \\ \midrule
col 1 & col 2 \\ \midrule
1 & 2\\
1 & 2\\
1 & 2\\
1 & 2\\
1 & 2\\
1 & 2\\
1 & 2\\
1 & 2\\



alt text

share|improve this answer
Thanks, @Martin. It wasn't described as such by texdoc longtable. It said "to replace". I'll add a screenshot to make it more informative. – Kit Dec 17 '10 at 16:07
Thank you, that helped me a lot. But when I want all the "content" rows separated by \midrule, I run into trouble with the bottom: If I add a \midrule for the bottom, I get a double line, and if I omit it, I get the equivalent of a \hlinewith its poor spacing to the text... – Lagerbaer May 4 '11 at 14:45

Your Answer


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.