Skip to content

Instantly share code, notes, and snippets.

@user202729
Last active September 16, 2024 11:34
Show Gist options
  • Save user202729/09825890622de02512e750e04eee41d4 to your computer and use it in GitHub Desktop.
Save user202729/09825890622de02512e750e04eee41d4 to your computer and use it in GitHub Desktop.
Footnote in tabular

Resource for answer in https://tex.stackexchange.com/questions/109467/footnote-in-tabular-environment .

Packages to be tested:

Features to be tested:

  1. hyperref support
  2. footnotetext are placed on the correct page where the footnotemark appear for floating table
  3. automatic numbering when there are multiple footnotes
  4. footnotes are placed below the table/at the bottom of the page
  5. support for tabular environment itself without table environment around it
  6. support for floating environment, tabular inside table

Result:

Package 1 2 3 4 5 6
footnotehyper yes no yes bottom of the page yes yes
footnote one link per table no yes bottom of the page yes yes
tablefootnote yes no yes bottom of the page no yes
longtable only go to last page no yes bottom of the page yes yes
ftnxtra no no yes bottom of the page yes no
threeparttable no yes yes below the table yes yes
tabularx no no yes bottom of the page yes no
bidiftnxtra no no yes bottom of the page yes no
nicematrix yes no yes both supported yes no
tabularray yes yes no below the table yes yes
raw footnotemark/footnotetext one link per table no yes bottom of the page yes no

Things missing here

Things that could be tested, but isn't:

Features that could be tested, but isn't:

  1. support for align environment from amsmath
%! TEX program = xelatex
\documentclass{scrartcl}
\usepackage{bidi}
\usepackage{bidiftnxtra}
\begin{document}
\begin{tabular}{l}
Content\footnote{Footnote}
\end{tabular}
\begin{table}[h]
\centering
\begin{tabular}{l}
Content\footnote{Footnote}
\end{tabular}
\caption{This is a caption\footnote{Another footnote.}}
\end{table}
\end{document}
\documentclass{article}
\usepackage{hyperref}
\usepackage{footnote}
\makesavenoteenv{table}
\makesavenoteenv{tabular}
\begin{document}
\begin{table}[p]
\centering
\begin{tabular}{|c|c|}
\hline
Item 1 & Item 2\footnote{Footnote of the floating table on the other page.} \\
\hline
Item 3\footnote{Another footnote of the floating table on the other page.} & Item 4 \\
\hline
\end{tabular}
\caption{Table with Hyperref Support and Multiple Footnotes}
\end{table}
\begin{center}
\begin{tabular}{|c|c|}
\hline
Item 5\footnote{Footnote in tabular environment.} & Item 6\footnote{Footnote in tabular environment.} \\
\hline
\end{tabular}
\end{center}
\end{document}
\documentclass{article}
\usepackage{hyperref}
\usepackage{footnotehyper}
\makesavenoteenv{table}
\makesavenoteenv{tabular}
\begin{document}
\begin{table}[p]
\centering
\begin{tabular}{|c|c|}
\hline
Item 1 & Item 2\footnote{Footnote of the floating table on the other page.} \\
\hline
Item 3\footnote{Another footnote of the floating table on the other page.} & Item 4 \\
\hline
\end{tabular}
\caption{Table with Hyperref Support and Multiple Footnotes}
\end{table}
\begin{center}
\begin{tabular}{|c|c|}
\hline
Item 5\footnote{Footnote in tabular environment.} & Item 6\footnote{Footnote in tabular environment.} \\
\hline
\end{tabular}
\end{center}
\end{document}
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\begin{table}[p]
\centering
\begin{tabular}{|c|c|}
\hline
Item 1 & Item 2\footnotemark \\
\hline
Item 3\footnotemark & Item 4 \\
\hline
\end{tabular}
\caption{Table with Hyperref Support and Multiple Footnotes}
\end{table}
\addtocounter{footnote}{-1}
\footnotetext{Footnote of the floating table on the other page.}
\addtocounter{footnote}{1}
\footnotetext{Another footnote of the floating table on the other page.}
\begin{center}
\begin{tabular}{|c|c|}
\hline
Item 5\footnotemark & Item 6\footnotemark \\
\hline
\end{tabular}
\addtocounter{footnote}{-1}
\footnotetext{Footnote in tabular environment for Item 5.}
\addtocounter{footnote}{1}
\footnotetext{Footnote in tabular environment for Item 6.}
\end{center}
\end{document}
\documentclass{article}
\usepackage{hyperref}
\usepackage{ftnxtra}
\begin{document}
\begin{table}[p]
\centering
\begin{tabular}{|c|c|}
\hline
Item 1 & Item 2\footnote{Footnote of the floating table on the other page.} \\
\hline
Item 3\footnote{Another footnote of the floating table on the other page.} & Item 4 \\
\hline
\end{tabular}
\caption{Table with Hyperref Support and Multiple Footnotes}
\end{table}
\begin{center}
\begin{tabular}{|c|c|}
\hline
Item 5\footnote{Footnote in tabular environment.} & Item 6\footnote{Footnote in tabular environment.} \\
\hline
\end{tabular}
\end{center}
\end{document}
\documentclass{article}
\usepackage{hyperref}
\usepackage{blindtext}
\usepackage{longtable}
\begin{document}
\begin{longtable}{|p{8cm}|}
\hline
\Blindtext[1] Footnote.\footnote{Footnote in a long table.} \\ \hline
\Blindtext[1] Footnote.\footnote{Footnote in a long table.} \\ \hline
\Blindtext[1] Footnote.\footnote{Footnote in a long table.} \\ \hline
\caption{Longtable with Footnote}
\end{longtable}
% technically longtable is not supposed to go inside table, but we test anyway (it doesn't work)
\begin{table}[p]
\centering
\begin{longtable}{|c|c|}
\hline
Item 1 & Item 2\footnote{Footnote of the floating table on the other page.} \\
\hline
Item 3\footnote{Another footnote of the floating table on the other page.} & Item 4 \\
\hline
\end{longtable}
\end{table}
\end{document}
\documentclass{article}
\usepackage{enumitem}
\usepackage[footnotehyper]{nicematrix}
\usepackage{hyperref}
\begin{document}
\begin{table}[p]
\centering
\begin{NiceTabular}{|c|c|}
\hline
Item 1 & Item 2\footnote{Footnote of the floating table on the other page.} \\
\hline
Item 3\footnote{Another footnote of the floating table on the other page.} & Item 4\tabularnote{A tabular note.}\\
\hline
\end{NiceTabular}
\caption{Table with Hyperref Support and Multiple Footnotes}
\end{table}
\begin{center}
\begin{NiceTabular}{|c|c|}
\hline
Item 5\footnote{Footnote in tabular environment.} & Item 6\footnote{Footnote in tabular environment.} \\
\hline
\end{NiceTabular}
\end{center}
\end{document}
\documentclass{article}
\usepackage{hyperref}
\usepackage{tablefootnote}
\begin{document}
\begin{table}[p]
\centering
\begin{tabular}{|c|c|}
\hline
Item 1 & Item 2\tablefootnote{Footnote of the floating table on the other page.} \\
\hline
Item 3\tablefootnote{Another footnote of the floating table on the other page.} & Item 4 \\
\hline
\end{tabular}
\caption{Table with Hyperref Support and Multiple Footnotes}
\end{table}
\begin{center} % not supported!
\begin{tabular}{|c|c|}
\hline
Item 5\tablefootnote{Footnote in tabular environment.} & Item 6\tablefootnote{Footnote in tabular environment.} \\
\hline
\end{tabular}
\end{center}
\end{document}
\documentclass{article}
\usepackage{hyperref}
\usepackage{tabularray}
\begin{document}
\begin{table}[p]
\centering
\begin{talltblr}[
note{1}={Footnote of the floating table on the other page.},
note{2}={Another footnote of the floating table on the other page.},
]{
colspec={|c|c|},
}
\hline
Item 1 with some long text & Item 2\TblrNote{1} \\
\hline
Item 3\TblrNote{2} & Item 4 \\
\hline
\end{talltblr}
\caption{Table with Hyperref Support and Multiple Footnotes}
\end{table}
\begin{center}
\begin{talltblr}[
note{3}={Footnote in tabular environment.},
note{4}={Footnote in tabular environment.},
]{
|c|c|
}
\hline
Item 5\TblrNote{3} & Item 6\TblrNote{4} \\
\hline
\end{talltblr}
\end{center}
\end{document}
\documentclass{article}
\usepackage{hyperref}
\usepackage{tabularx}
\usepackage{caption}
\begin{document}
\begin{table}[p]
\centering
\begin{tabularx}{\textwidth}{|X|X|} % Use tabularx and specify column width
\hline
Item 1 & Item 2\footnote{Footnote of the floating table on the other page.} \\
\hline
Item 3\footnote{Another footnote of the floating table on the other page.} & Item 4 \\
\hline
\end{tabularx}
\caption{Table with Hyperref Support and Multiple Footnotes}
\end{table}
\begin{center}
\begin{tabularx}{\textwidth}{|X|X|} % Use tabularx and specify column width
\hline
Item 5\footnote{Footnote in tabular environment.} & Item 6\footnote{Footnote in tabular environment.} \\
\hline
\end{tabularx}
\end{center}
\end{document}
\documentclass{article}
\usepackage{threeparttable}
\usepackage{hyperref}
\begin{document}
\begin{table}[p]
\centering
\begin{threeparttable}
\begin{tabular}{|c|c|}
\hline
Item 1 with some long text & Item 2\tnote{1} \\
\hline
Item 3\tnote{2} & Item 4 \\
\hline
\end{tabular}
\begin{tablenotes}
\item[1] Footnote of the floating table on the other page.
\item[2] Another footnote of the floating table on the other page.
\end{tablenotes}
\end{threeparttable}
\caption{Table with Hyperref Support and Multiple Footnotes}
\end{table}
\begin{center}
\begin{threeparttable}
\begin{tabular}{|c|c|}
\hline
Item 5\tnote{3} & Item 6 with some long text\tnote{4} \\
\hline
\end{tabular}
\begin{tablenotes}
\item[3] Footnote in tabular environment.
\item[4] Footnote in tabular environment.
\end{tablenotes}
\end{threeparttable}
\end{center}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment