Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I Have a very wide table that where I want to have footnotes.

I found that one way to make the table fit in my page was to use tabu and longtable. And the package tablefootnote for the in table footnotes.

However now each time I compile, I get duplicated tablefootnotes but not the simple footnotes.

\documentclass{arcticle}
\usepackage{hyperref}
\usepackage{pdfpages}
\usepackage{url}
\usepackage{tablefootnote}
\usepackage{tabu} 
\usepackage{longtable}
\usepackage[export]{adjustbox}

\begin{document}
blablabla\footnote{this is a footnote}
\begin{table}[h]
\centering
\begin{longtabu}to \textwidth{|X[1]|X[2]|X[3]|}%|l|l|l|
\hline 
\textbf{A} & \textbf{B} & \textbf{C} \\ 
\hline 
c & b & a\tablefootnote{this is a tablefootnote.} \\ 
\hline 
\end{longtabu} 
\caption{Messages description}
\label{tab:messagedesc}
\end{table} 
\end{document}

In this example, I will get one footnote for the simple footnote and 3 for the table footnote.

share|improve this question
1  
you have a longtable/tabu construct which is for multi-page tables but have it inside a table environment so it can not possibly break. If you need it in a float then a normal tabular 9or tabu) mot a long version is what you want. Also avoid using [h] which vastly increases the chance of the table going to the end of the document. use [htp] to give latex a chance to set it. –  David Carlisle Aug 7 '12 at 11:28
    
@DavidCarlisle I need to have a reference to that table and also display it in my list of tables. –  MSIS Aug 7 '12 at 11:44
1  
longtable and table each (separately) allow references and put things in the list of tables. But if you nest one inside the other you remove all longtable features. A table in a box can never break over a page. –  David Carlisle Aug 7 '12 at 12:10
    
@DavidCarlisle How do I make a label to the longtabu and print it caption? I couldn't find the answer in the documentation. –  MSIS Aug 7 '12 at 12:38
1  
assuming it is like longtable just use `\\\caption{my caption\label{foo}} \` ie the caption is a complete row of the table. –  David Carlisle Aug 7 '12 at 13:01
show 2 more comments

2 Answers

up vote 3 down vote accepted

As @DavidCarlisle already pointed out, you cannot have page breaks within a floating environment. You can, however, use the usual longtable syntax to include the caption in the table's first head. According to the manual, the \caption is handled like a \multicolumn over the whole table width:

\documentclass{article}

\usepackage{tabu,longtable}
\usepackage{hyperref}

\begin{document}
blablabla\footnote{this is a footnote}

\begin{longtabu}to \textwidth{|X[1]|X[2]|X[3]|}%|l|l|l|
\caption{Messages description}\label{tab:messagedesc} \\
\hline
\textbf{A} & \textbf{B} & \textbf{C} \\ 
\hline
\endfirsthead
\hline
\textbf{A} & \textbf{B} & \textbf{C} \\ 
\hline
\endhead
\hline
\endfoot
\hline 
\endlastfoot
c & b & a \\
c & b & a\footnote{this is a tablefootnote.} \\ 
\end{longtabu} 

\end{document}

This eliminates also the need for the special \tablefootnotes within the longtabu environment.

share|improve this answer
    
This seems to solve the problem, but it looks like there's a hiden table which is not referenced. Maybe longtabu gets it's own refence but doesn't print it? –  MSIS Aug 7 '12 at 12:32
    
@MSIS This is a known feature in longtable (and longtabu use the same code). Use the label command as David Carlisle recommend, or you have to manually reduce the counter for tables. –  Sveinung Aug 7 '12 at 13:14
1  
@hakaze I think your answer will give wrong numbering of the tables. –  Sveinung Aug 7 '12 at 13:15
    
@Sveinung: I revised my answer. Now footnotes and the table numbering should work properly. –  hakaze Aug 7 '12 at 14:01
    
@hakaze: What I did is that I removed '\captionof...' and placed '\caption{my caption\label{foo}} \' as david suggested and it works fine! I will post the answer as soon as I'm allowed too ;) –  MSIS Aug 7 '12 at 14:19
add comment

I did the following based on the comments of @DavidCarlisle and the answer of @hakaze

\documentclass{article} 

\usepackage{tabu,longtable} 
\usepackage{hyperref} 

\begin{document} 
blablabla\footnote{this is a footnote} 

\begin{center} 
\begin{longtabu}to \textwidth{|X[1]|X[2]|X[3]|}%|l|l|l|
\caption{my caption\label{foo}} \\
\hline  
\textbf{A} & \textbf{B} & \textbf{C} \\  
\hline  
c & b & a \\ 
c & b & a\footnote{this is a tablefootnote.} \\  
c & b & a \\ 
\hline  
\end{longtabu}  
\end{center} 
\end{document}

Thank you all!

share|improve this answer
add comment

Your Answer

 
discard

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.