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 would like to ask a question about longtable package. I've already posted it in other forums.

I have a long table (a several-pages-long one) using longtable package and I would like to add a table caption at the bottom of every piece of table, but a different one in the FIRST page.

longtable package allows a different "header" in the first page of the table (\endfirsthead) and/or a different "footer" in the LAST page of the table (\endlastfoot). What I would like to do is a different foot caption in the FIRST page of the table.

My example would be something like this:

First page table foot caption: "Table 1.2: Table description and so, and so...".

Following page table foot captions: "Table 1.2 (contd.): Table description and so, and so...".

It is similar to the example available at the documentation of longtable package about the usage of \endfirsthead, but I want to put it at the bottom of the tables because captions for all figures and tables in my document are at the foot, not at the head.

Is it so strange what I want to do?? How can I do it with longtable?

I would be very grateful if you could give me any hint or tip.

Thank you in advance for your answers! :)

share|improve this question
up vote 11 down vote accepted

You can try the following example. That adds \endfirstfoot.


  \advance\dimen@ \ht\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi
  \advance\dimen@ \dp\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi
  \advance\dimen@ \ht\ifvoid\LT@firstfoot\LT@foot\else\LT@firstfoot\fi
  \setbox\tw@\vsplit\tw@ to \ht\@arstrutbox
  \advance\dimen@ \ht
  \advance\dimen@ -\pagegoal
  \ifdim \dimen@>\z@\vfil\break\fi
  \ifnum\outputpenalty <-\@Mi
    \ifnum\outputpenalty > -\LT@end@pen
      \LT@err{floats and marginpars not allowed in a longtable}\@ehc
      \ifdim \ht\LT@lastfoot>\ht\LT@foot

\hline first head\\\hline\endfirsthead
\hline head\\\hline\endhead
\hline first foot\\\hline\endfirstfoot
\hline (continued)\\foot\\\hline\endfoot
\hline last foot\\\hline\endlastfoot


share|improve this answer
Thank you very much! It works!! :) – Vicent Aug 29 '12 at 14:13
I used this and added \label into the first footer. The links are generated correctly, but they don't work under hyperref. – choroba Dec 2 '14 at 12:34

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.