5
\documentclass[a4paper,12pt]{book}

\usepackage{booktabs}
\usepackage[hang,flushmargin]{footmisc}

\begin{document}

\begin{table}[h]
\begin{minipage}{\linewidth}
\begin{tabular}{@{}lrr@{}}
\toprule
A    & B     & C     \\ \midrule
Text & 123   & 123   \\
Text & 123\footnote{An interesting footnote.} & 123 \\
Text & 123   & 123   \\ \midrule
Text & 12345 & 12345 \\ \bottomrule
\end{tabular}
\end{minipage}
\end{table}

\end{document}

Result of MWE.

I am using the footmisc package to insert footnotes in tables. It shows my footnotes under the tables as desired but the usual footnote separator feels redundant following the booktabs style bottom rule.

Is there a way to disable the footnote separator in these cases only while leaving them intact for the rest of the document?

I know \usepackage[norule]{footmisc} turns them off altogether, but I only need to remove them underneath tables.

3 Answers3

8
\documentclass[a4paper,12pt]{book}

\usepackage{booktabs}
\usepackage[hang,flushmargin]{footmisc}

\begin{document}

\begin{table}[h]
\begin{minipage}{\linewidth}
\renewcommand\footnoterule{}
\begin{tabular}{@{}lrr@{}}
\toprule
A    & B     & C     \\ \midrule
Text & 123   & 123   \\
Text & 123\footnote{An interesting footnote.} & 123 \\
Text & 123   & 123   \\ \midrule
Text & 12345 & 12345 \\ \bottomrule
\end{tabular}
\end{minipage}
\end{table}

test\footnote{An interesting footnote.}
\end{document}
touhami
  • 19,520
2

A more automatic solution, not requiring adding code inside each applicable minipage.

The \InFloat test is borrowed from How can I detect if I'm inside or outside of a float environment?

This renews the \footnoterule command after the end of a tabular only if it's inside a floating environment.

\documentclass[a4paper,12pt]{book}

\usepackage{booktabs}
\usepackage[hang,flushmargin]{footmisc}

\makeatletter
\newcommand\InFloat[2]{\@ifundefined{@captype}{#2}{#1}}
\makeatother
\usepackage{etoolbox}
\AfterEndEnvironment{tabular}{\InFloat{\renewcommand\footnoterule{}}{}}

\begin{document}

\begin{table}[h]
\begin{minipage}{\linewidth}
\begin{tabular}{@{}lrr@{}}
\toprule
A    & B     & C     \\ \midrule
Text & 123   & 123   \\
Text & 123\footnote{An interesting footnote.} & 123 \\
Text & 123   & 123   \\ \midrule
Text & 12345 & 12345 \\ \bottomrule
\end{tabular}
\end{minipage}
\end{table}

Test.\footnote{An interesting footnote.}

\bigskip

\begin{minipage}{\linewidth}
Test.\footnote{An interesting footnote.}
\end{minipage}
\end{document}

enter image description here

Paul Gessler
  • 29,607
0

Another option is to let \endminipage redefine the rule. This does affect all minipages of course but I deem this to be the typical use case anyway.

\documentclass[a4paper,12pt]{book}

\usepackage{booktabs}
\usepackage[hang,flushmargin]{footmisc}

\let\oldendminipage\endminipage
\def\endminipage{\let\footnoterule\relax\oldendminipage}

\begin{document}

\begin{table}[h]
\begin{minipage}{\linewidth}
\begin{tabular}{@{}lrr@{}}
\toprule
A    & B     & C     \\ \midrule
Text & 123   & 123   \\
Text & 123\footnote{An interesting footnote.} & 123 \\
Text & 123   & 123   \\ \midrule
Text & 12345 & 12345 \\ \bottomrule
\end{tabular}
\end{minipage}
\end{table}

Test.\footnote{An interesting footnote.}

\bigskip

\begin{minipage}{\linewidth}
Test.\footnote{An interesting footnote.}
\end{minipage}
\end{document}
stefanct
  • 841
  • 6
  • 16