# Footnotes in tabular environments within multicols

I'm running into a strange inconsistency when I use footnotes in and out of tabular environments within multicols. In particular, I'm declaring a savenotes environment in a style file as follows:

\makesavenoteenv[tabunote]{tabular}


Then, in the same two-column page of my document, I'm using a footnote from within a tabunote environment

and another footnote in a bare paragraph

producing the following results:

It appears that my first footnote, from within the savenotes tabular environment, wraps to the column, whereas the bare footnote wraps to the page (which is the behavior I expect under multicols). Moreover, since the savenotes footnote comes first, it causes the footnote separator line to be half the expected length—on pages where I reverse the order of footnotes (bare, then tabunote), the separator is normal-length. The following should yield similar results:

\documentclass{article}
\usepackage{footnote}
\usepackage{multicols}

\makesavenoteenv[tabunote]{tabular}

\begin{document}
\begin{multicols}{2}

\begin{center}
\begin{tabunote}{c|c}
foo & bar%
\footnote{A long enough footnote here will wrap to the column
rather than to the page---this is easily illustrated by the use
of lots of filler text.}
\end{tabunote}
\end{center}

On the other hand, this footnote will be fine.%
\footnote{Here is the aforementioned example of the footnote that is
fine and represents the expected behavior for footnotes in a multicols
environment.}

\end{multicols}
\end{document}


Is there a way to rectify this issue? In particular, how can I use both bare and tabular/savenotes footnotes such that both wrap to the page, rather than the column?

• Could you please add a minimal working example (MWE) that reproduces the problem? It will be much easier for us to find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – clemens Apr 30 '13 at 21:30
• Sure thing—updated. – Max Wang Apr 30 '13 at 22:59
• An easy way out would be to use the usual \footnotemark/\footnotetext approach. Then you could also drop the footnotes package and use the normal {tabular} environment. – clemens May 1 '13 at 14:17

Add the following code to the preamble:

\makeatletter
\def\savenotes{%
\begingroup%
\if@savingnotes\else%
\@savingnotestrue%
\let\@footnotetext\fn@fntext%
\let\@mpfootnotetext\fn@fntext%
\fn@width\textwidth%
\let\fn@colwidth\fn@width%
\global\setbox\fn@notes\box\voidb@x%
\let\fn@thempfn\thempfn%
\let\fn@mpfn\@mpfn%
\ifx\@minipagerestore\relax\let\@minipagerestore\@empty\fi%
\expandafter\def\expandafter\@minipagerestore\expandafter{%
\@minipagerestore%
\let\thempfn\fn@thempfn%
\let\@mpfn\fn@mpfn%
}%
\fi%
}
\makeatother


and the footnote inside your custom tabular environment will have the right width.

I think that when the environment for which the footnotes are stored (the tabunote in your case) is placed inside a multicol env. the fn@width is not set to the textwidth but stays at the default value, which is columnwidth. In the code above the default value has been changed to textwidth. The line I changed is

\fn@width\textwidth


which was originally

 \fn@width\columnwidth


This way the width is not wrapped around the column.

The reasons why the default fn@width is set to columnwidth are explained in the footnote documentation at page 4.

I'm not sure if there are cases where the change in the default value will cause problems, but I assume that if there are someone will tell us :)

• the same a bit shorter: \usepackage{etoolbox}\patchcmd\savenotes{\columnwidth}{\textwidth}{}{} :) – clemens May 1 '13 at 18:23
• @cgnieder cool, thanks! I think it's time to look at the etoolbox package doc. :) – Nico Boni May 1 '13 at 21:32
• And I would consider this a bug in the footnotes package from mdwtools bundle: It should have used \linewidth, I guess. – Speravir May 1 '13 at 22:19