8

I want to make table footnotes by nesting a tabular or tabulary inside a minipage, and that inside a table. When I do this with tabular, it works exactly as it should. But with tabulary, it produces two sets of footnotes at the bottom, and the footnote numbers in the main text are those of the duplicate footnotes.

\documentclass{memoir}
\usepackage{tabulary,lipsum}

\begin{document}

Why are footnotes duplicated when a tabulary is placed inside a minipage?
It happens in memoir class and the standard \LaTeX classes.

See table~\ref{table:mwe} for an example.

\begin{table}
\caption{Tabulary inside minipage with footnotes}
\label{table:mwe}

\begin{minipage}{\textwidth}

\begin{tabulary}{\textwidth}{lL}
Lipsum para. 1%
    \footnote{This is the first footnote.}
                & \lipsum[1]\\
Lipsum para. 2%
    \footnote{This is the second footnote.}
                & \lipsum[2]\\
\end{tabulary}

\end{minipage}
\end{table}

\end{document}

I would prefer a solution that allows me to keep using tabulary, as I have used this technique throughout a 400-page dissertation. I am using the memoir class, but it also happens in the standard LaTeX classes.

This question seems to stem from the same problem.

  • This behaviour is really strange. I tried the footmisc package, but it did not correct it. – Clément Jun 27 '14 at 20:28
  • 1
    @Clément the behaviour's only strange if you don't expect it:-) tabulary sets its content twice so everything happens twice except those things that are protected against that. – David Carlisle Jun 27 '14 at 20:29
  • @DavidCarlisle : I must admit that I do not know tabulary, so it is a strange world to me! – Clément Jun 27 '14 at 20:32
  • @Clément you would see same in \caption or AMS alignments or any other construct that typesets the content multiple times while experimenting with the layout. – David Carlisle Jun 27 '14 at 20:34
8

Just make the footnote on the final typesetting run, not while tabulary is measuring things.

\documentclass{memoir}
\usepackage{tabulary,lipsum}

\begin{document}

Why are footnotes duplicated when a tabulary is placed inside a minipage?
It happens in memoir class and the standard \LaTeX classes.

See table~\ref{table:mwe} for an example.

\begin{table}
\caption{Tabulary inside minipage with footnotes}
\label{table:mwe}

\begin{minipage}{\textwidth}

\begin{tabulary}{\textwidth}{lL}
Lipsum para. 1%
    \ifx\[$\else\footnote{This is the first footnote.}\fi
                & \lipsum[1]\\
Lipsum para. 2%
    \ifx\[$\else\footnote{This is the second footnote.}\fi
                & \lipsum[2]\\
\end{tabulary}

\end{minipage}
\end{table}

\end{document}
  • So could I do this, then? \newcommand{\floatfootnote}[1]{\ifx[$\else\footnote{#1}\fi} . But can you explain more what your solution does? – musarithmia Jun 27 '14 at 20:38
  • 2
    tabulary sets the content twice the first time it makes lots of local definitions so that constructs are "safe" to be measured, one of them is that it makes display math constructs into inline math (so they may be measured) that's irrelevant except that it makes \ifx\[$ an easy test for the first or second pass of tabulary, on the first pass it os true, so do nothing \else on the second path [` has its normal meaning, so make the footnnote. – David Carlisle Jun 27 '14 at 20:41
  • 1
    Fixed a typo in my macro and I can replace this easily throughout--thanks. \newcommand{\floatfootnote}[1]{\ifx\[$\else\footnote{#1}\fi} – musarithmia Jun 27 '14 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.