Skip to content

Instantly share code, notes, and snippets.

@vanto vanto/sx-151380-multicol-issue.tex Secret
Last active Dec 14, 2017

Embed
What would you like to do?
\documentclass{article}
\usepackage{longtable}
%\usepackage[textheight=9\baselineskip]{geometry}
\newcount\zzz
\def\foo{}
\def\zz#1{#1%
\global\advance\zzz#1\relax
\marks1 {\the\zzz}%
}
\marks1{0}
\makeatletter
\def\LT@output{%
\ifnum\outputpenalty <-\@Mi
\ifnum\outputpenalty > -\LT@end@pen
\LT@err{floats and marginpars not allowed in a longtable}\@ehc
\else
\LT@bchunk
page total: &
\edef\tmp{\topmarks1 }%
\the\numexpr\botmarks1 \ifx\tmp\@empty\else - \topmarks1 \fi\relax\\
total:&\botmarks1
\LT@echunk
\setbox\LT@foot\box\z@
\LT@get@widths
\setbox\z@\vbox{\unvbox\@cclv}%
\ifdim \ht\LT@lastfoot>\ht\LT@foot
\dimen@\pagegoal
\advance\dimen@-\ht\LT@lastfoot
\ifdim\dimen@<\ht\z@
\setbox\@cclv\vbox{\unvbox\z@\copy\LT@foot\vss}%
\@makecol
\@outputpage
\setbox\z@\vbox{\box\LT@head}%
\fi
\fi
\global\@colroom\@colht
\global\vsize\@colht
%\vbox
{\unvbox\z@\nobreak\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi}%
\fi
\else
\global\advance\c@LT@chunks\@M
\LT@bchunk
\edef\tmp{\topmarks1 }%
page total: &
\edef\tmp{\topmarks1 }%
\the\numexpr\botmarks1 \ifx\tmp\@empty\else - \topmarks1 \fi\relax\\
running total:&\botmarks1
\LT@echunk
\setbox\LT@foot\box\z@
\LT@get@widths
\global\advance\c@LT@chunks-\@M
\setbox\@cclv\vbox{\unvbox\@cclv\copy\LT@foot\vss}%
\@makecol
\@outputpage
\global\vsize\@colroom
\copy\LT@head\nobreak
\fi}
\makeatother
\begin{document}
\begin{longtable}{c | r | r | r | r}
xxxxxx&yyyyyy&xxx&xxxx&xxxx\\
xxxxxxxxxxxxxxxzz&zzzzzz&zzz&zzxx&yyyyyyy\endfoot% not typeste but needs to be bigger than the foot that is used.
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}\\
a & a & a & a & \zz{1}
\end{longtable}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.