# Problem with Longtable \endfoot in wrong place [closed]

I'm using longtable to split a couple of tables over several pages - these will be in the appendix of my thesis...

my problem is that for both tables the 'continued on next page' \endfirstfoot is appearing at the end of the table as opposed to at the page break..... I hope someone can help me on this as I've been pulling my hair out on this for 2 days!!

Sorry my example is quite long, but I thought I should leave all my preamble incase something in this is causing the problem and wanted the table to be long enough to see the problem (I've four similar tables and they are all behaving the same

here's the code

\usepackage{afterpage,lscape}
\usepackage{graphicx}
\usepackage{appendix}
\usepackage{varioref}
\usepackage{longtable}
\usepackage{units}
\usepackage{float}
\restylefloat{table}
\usepackage{listings}
\lstset{
language=R,
basicstyle=\scriptsize\ttfamily,
numbers=left,
numberstyle=\ttfamily\color{gray}\footnotesize,
stepnumber=1,
numbersep=5pt,
backgroundcolor=\color{white},
showspaces=false,
showstringspaces=false,
showtabs=false,
frame=single,
tabsize=2,
captionpos=b,
breaklines=true,
breakatwhitespace=false,
title=\lstname,
escapeinside={},
keywordstyle={},
morekeywords={}
}
\usepackage{upgreek}
\usepackage{pdfpages}
\usepackage{gensymb}
\usepackage[version=3]{mhchem}
\usepackage[singlelinecheck=off]{caption}
\setlength{\abovecaptionskip}{0pt}
\usepackage{subcaption}
\usepackage[left=4cm, right=2.5cm, top=2cm, bottom=4cm, includefoot, headheight=13.6pt]{geometry}
\usepackage{tabularx} % for doing tables easily
\usepackage{array} % for centering tables...such a pain
\usepackage{enumerate}
\usepackage{subfig}
\usepackage{pdflscape}
\usepackage[sort]{natbib}
\let\cite=\citep
\usepackage{cmap,graphicx,epsfig,wrapfig,amsmath,amsfonts,longtable,verbatim}
\usepackage{amsmath,varwidth,array,ragged2e}
\newcolumntype{L}{>{\varwidth[c]{\linewidth}}l<{\endvarwidth}}
\newcolumntype{M}{>{$}l<{$}}
\def\ds{\mathrm{d}s}

\parindent 0pt     %indentation set for start of paragraphs
\parskip 8pt       %between paragraph space
\usepackage{setspace}
\linespread{1.3} %\usepackage[hang, small,bf]{caption} % define the title
%to put a word in italics \textit{word}
\usepackage{sectsty}
\chapterfont{\raggedright}
\chaptertitlefont{\mdseries\raggedright}
\sectionfont{\mdseries}
\subsectionfont{\mdseries}
\subsubsectionfont{\mdseries\itshape}

\begin{document}

\begin{titlepage}
\begin{center}
\vspace*{2.5in}
{\Huge amount of boring stuff}
\par
\vspace{0.5in}
{\large Me}
\par
\vspace{3in}
My Thesis
\par
\vspace{0.5in}
2013
\end{center}
\end{titlepage}

testing long table \ref{AICHouseCysti}

\hspace*{-1cm}\begin{longtable}{ll}
\caption[Modelling Process for Human HP10 Positivity]{{\bfseries Comparison of mixed-effects logistic regression risk factor models for human HP10 positivity (cysti)}}\\
\label{AICHumanCysti}
Model\protect\footnotemark &  AIC  \\
\hline

\multicolumn{2}{c}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
Model &  AIC  \\
\hline

\hline \multicolumn{2}{c}{{Continued on next page}} \\
\endfoot

\hline
\endlastfoot

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

{\bf hscysti} \sim other.stud + h20.filter + health.km + other  + health.trav.sch & 159.9 \\
$+ lat.sum + piped + tw.meat + tran.none + pork + tw.pig + well + opendef & \\ + copro + tw + h2o.tx.none + health.mode + roof + river + pond & \\ + undercooked + tran.bike$& \\[3pt]

\footnotetext{small blah blah blahl}}

\hspace*{-1cm}\end{longtable}
\end{center}

\end{document}
-

## closed as unclear what you're asking by Joseph Wright♦Aug 17 '13 at 19:03

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

Please fix your example so that it does not have errors ! Undefined control sequence.<argument> \sf@counterlist , ! Missing $inserted.<inserted text>$l.102 {\bf hscysti} If a document generates tex errors any output produced is essentially arbitrary –  David Carlisle Jun 5 '13 at 17:44
I'm so sorry about that. The problem seems to be with the \endfirstfoot command (which I found somewhere online, but apparently does not exist in the longtable package!). I've amended the code above which seems to work! –  Lian Thomas Jun 5 '13 at 18:20
But the code will still generate lots of errors about mis-use of math mode also it uses \bf which is a deprecated command. –  David Carlisle Jun 5 '13 at 19:19
The \hspace*{-1cm} and center around longtable look odd. longtables are centered automatically. And if the table should be allowed to stick into the margin, this can be done by \setlength{\LTleft}{-1cm plus 1fill} and \setlength{\LTright}{-1cm plus 1fill}. –  Heiko Oberdiek Jun 5 '13 at 21:46
Without a compiling MWE, this is unclear I'm afraid. –  Joseph Wright Aug 17 '13 at 19:03