# huge table + footnote-ish thing

I have a book, which is basically a 100-page table. I use xtab package to layout this book.

The book has a list of 100-ish definitions, which are referenced multiple times in the table. Think of a bank commission table, where there are many footnotes referenced multiple times, eg. 1) for this thing You need to have a gold credit card, 2) for this thing You need to have $1M in Your account, etc. The numbering of the definitions is fixed (Say, this is a legal document). The definitions can have arbitrary numbering (like "1", "W" , "III"). What I want to be able to do, is for each of the definitions that are referenced on the page have them appear as footnotes (or something that resembles footnotes visually). Is this doable? Or at least partially doable? • Is longtable an option? I think xtab uses supertabular internally, and possibly longtable is better at footnote, or at least I might be better at coercing longtable to do footnotes than supertabular – David Carlisle Jul 2 '12 at 12:18 • @DavidCarlisle I have not tried longtable yet, but yes, it seems like an option. The arbitrary numbering requirement seems to be the most important blocker. – maniek Jul 2 '12 at 12:33 • @maniek Please, give us an example of one or two pages. I'm asking myself, where would you like to put the footnotes, as the tabular filles the whole page . . . – Keks Dose Jul 2 '12 at 12:36 • @maniek -- it seems to me that, rather than thinking of these as footnotes, they might be thought of as part of a running footer. the problem then becomes how to omit the ones that aren't referenced on the page. could the format be matched simply with \tabbing? if so, then repeating column heads could probably be handled as part of a running head, and footnotes would work (though you'd have to avoid repeating any). (i've done this sort of thing with plain tex, but never with latex, where you're more constrained.) – barbara beeton Jul 2 '12 at 13:14 ## 1 Answer So this lists A and i on the first page and i and w on the second, just listing once each, in the order of definition. It takes the page numbers for which cite to use on each page from the previous run so will take a couple of runs to settle down. \documentclass{article} \textheight.3\textheight \paperheight.5\paperheight \pdfpageheight\paperheight \usepackage{longtable} \makeatletter \def\foopage#1#2{\global\expandafter\let\csname foopage-#1-#2\endcsname\@empty} \let\foolist\@empty \def\foodef#1#2{% \g@addto@macro\foolist{{#1}}% \@namedef{foo-#1}{#2}} \def\foocite#1{% \textsuperscript{#1}% \let\reserved@a\relax \protected@write\@auxout{}{\string\foopage{#1}{\thepage}}% } \def\fooloop{% \expandafter\@tfor\expandafter\tmp\expandafter:\expandafter=\foolist\do{% \expandafter\ifx\csname foopage-\tmp-\thepage\endcsname\@empty \insert\footins{% \reset@font\footnotesize \interlinepenalty\interfootnotelinepenalty \splittopskip\footnotesep \splitmaxdepth \dp\strutbox \floatingpenalty \@MM \hsize\columnwidth \@parboxrestore \textsuperscript{\tmp}\csname foo-\tmp\endcsname}% \fi }} % add the insert loop \def\foopatch#1\output#2{% \def\LT@start{#1\fooloop\output{\LT@output}}} \expandafter\foopatch\LT@start \def\foopatch#1\copy\LT@head\nobreak#2{% \def\LT@output{#1\copy\LT@head\nobreak\fooloop#2}} \expandafter\foopatch\LT@output \begin{document} \foodef{A}{Something about A.} \foodef{i}{Something equally dull about i.} \foodef{w}{In case you missed$xy$and$z$, here's$w\$.}

\begin{longtable}{ll}
aaaa&bbb\\
aaaa&bbb\\
aaaa&bbb\foocite{A}\\
aaaa&bbb\\
aaaa&bbb\\
aaaa&bbb\foocite{i}\\
aaaa&bbb\\
aaaa&bbb\\
aaaa&bbb\\
aaaa&bbb\\
aaaa&bbb\foocite{i}\\
aaaa&bbb\\
aaaa&bbb\\
aaaa&bbb\\
aaaa&bbb\foocite{w}\\
aaaa&bbb\\
aaaa&bbb\\
aaaa&bbb\\
aaaa&bbb\\
aaaa&bbb\foocite{i}\\
aaaa&bbb\\
aaaa&bbb\\
aaaa&bbb\foocite{w}\\
aaaa&bbb\\
aaaa&bbb\\
\end{longtable}

\end{document}

• This is a wonderful sorcery, thank You very much! works GREAT! – maniek Jul 2 '12 at 16:42
• I found a glitch with this solution. Sometimes the document never stabilizes. A row jumps between 2 pages on subsequent compilations (and the footnotes don't match the table). Here is an example (I just moved around the citations from Your solution, and expanded a definition). Is there a fix for this? – maniek Oct 26 '12 at 10:11
• The link in your comment is broken should be pastebin.com/0QEjCKXq I guess. There is always a fix for anything but probably don't have time today, ping me again if nothing appears in a day or so – David Carlisle Oct 26 '12 at 10:16