# Make eledmac footnotes available in tabular environment

Is there a way to make eledmac footnotes available in tabular environments? The \savenotes and \makesavenoteenv commands from footnote.sty don't work here anymore.

In the following MWE, footnotes inside the table just don't appear. The label is set, but not the foornote.

\documentclass{scrartcl}
\RequirePackage{eledmac}
\newseries{T}
\let\footnote\footnoteT

\begin{document}
Foo bar\footnote{This footnote works.}

\begin{tabular}{ll}
A & B \\
C\footnote{This footnote doesn't appear.} & D \\
\end{tabular}

\end{document}


I'm using eledmac's footnote engine for familiar footnotes. (And I cannot switch away from eledmac.)

## 2 Answers

Eledmac knows this problem. That's why it provides an edtabularl environnement (§ 13 of the actual handbook).

However, for some technical reason, the \let\footnote\footnoteC can't work in this case (see https://github.com/maieul/ledmac/issues/207#issuecomment-54959471 for more details), and you have to do something like def\footnote#1{\footnoteT{#1}}.

So the full MWE is :

\documentclass{scrartcl}
\RequirePackage{eledmac}
\newseries{T}

\def\footnote#1{\footnoteT{a}}
\begin{document}
Foo bar\footnote{This footnote works.}

\begin{edtabularl}
A & B \\
C\footnote{This footnote doesn't appear.} & D \\
\end{edtabularl}

\end{document}

• Thank you! The problem is that the edtabularl is not as functional as tabular. Especially, I need p-columns. And also longtables. I will post my solution as a separate answer. – LaTechneuse Jan 29 '15 at 18:17
• indeed, it's not as functional. Your solution is welcomed, I could help me to NOT have to implement tabular in eledmac. – Maïeul Jan 29 '15 at 18:22

I have a solution now that implements a push pop system, pushing footnotes into a token list within the tabular (and any other) environment and spawning them after the end. The basic idea was inspired from cacamailg's answer in the post: Footnote in tabu table not shown

My solution provides a \Mymakesavenoteenv command which works similar to \makesavenoteenv from footnote.sty. You can selectively activate the environments you like to be able to handle footnotes. The whole thing was implemented for the footnote series T. I preferred making this specific to one series only to not disturb the eledmac functionality otherwise. (I'm using series T for global normal footnotes.)

Here the solution MWE:

\documentclass{scrartcl}

\usepackage{eledmac}
\usepackage{longtable}

\makeatletter

\newseries{T}
\def\footnote#1{\footnoteT{#1}}

% push-pop-system for eledmac footnotes, saving footnotes around an environment.
\newtoks\Myftn@toks

\newcommand*{\@popftn@vfootnoteT}[3]{%
\def\@thefnmarkT{#1}%
\vfootnoteT{#2}{#3}%
}

\def\pushftn{%
\let\vfootnoteT\@pushftn@vfootnoteT
}

\def\popftn{%
\global\Myftn@toks\expandafter{\expandafter}\the\Myftn@toks%
}%

\long\def\@pushftn@vfootnoteT#1#2{%
\edef\@tempa{\the\Myftn@toks\noexpand\@popftn@vfootnoteT
{\csname @thefnmarkT\endcsname}{T}{#2}}%
\global\Myftn@toks\expandafter{\@tempa}%
}%

\def\Mymakesavenoteenv#1{
\AtBeginEnvironment{#1}{\pushftn}
\AfterEndEnvironment{#1}{\popftn}
}

% push pop functionality can simply be activated for selected environments
% similar to \makesavenoteenv from footnotes.sty
\Mymakesavenoteenv{longtable}
\Mymakesavenoteenv{tabular}

\makeatother

\begin{document}

Foo bar\footnote{This footnote works.}

\begin{tabular}{p{2cm}l}
A & B \\
C\footnote{tabular p-column} & D\footnote{tabular l-column} \\
\end{tabular}

\begin{longtable}{p{2cm}l}
A & B \\
C\footnote{longtable p-column} & D\footnote{longtable l-column} \\
\end{longtable}

\end{document}

• your solution is nice, but quite problematique for longtables: the footnotes will be called only in the final pages. – Maïeul Jan 29 '15 at 18:41
• I also don't understand why you use eledmac footnote and not normal footnote for your series T. – Maïeul Jan 29 '15 at 18:41
• Yes, you're right, they only appear at the final page. I Guess I have to engage more with lontable to fix this. But yet, this provies a general solution for many environments (especially tabular!). – LaTechneuse Jan 29 '15 at 18:42
• I'm using the excellent eledmac footnote system for normal footnotes as I'm actually typesetting twocolumn footnotes in the whole book. And unlike eledmac, the classical dblfnote.sty solution would not break long footnotes accross pages. This is a tremendous disadvantage in the cases of books I'm doing. – LaTechneuse Jan 29 '15 at 18:45
• ok, I understand. – Maïeul Jan 29 '15 at 18:48