3

I'd like to put some footnotes in a caption of a subcaption paragraph. However, as you can see the footnode appears in the caption itself, and not at the bottom of the page.

enter image description here

Any solution?

Thanks!

MWE

\documentclass{article}
\usepackage{graphicx}
% To display subfigures
\usepackage{caption}
\usepackage{subcaption}

\begin{document}
\begin{figure}[h!]
  \centering
  \begin{subfigure}[t]{.47\textwidth}
    \centering
    \includegraphics[width=\linewidth]{example-image-a}
    \caption{My caption with a footnote\footnote{Yes I like footnotes ! But this one is not a true foot note, because it's not at the bottom of the page...}}
    \label{fig:myfiga}
  \end{subfigure}\hspace*{.05\textwidth}%
  \begin{subfigure}[t]{.47\textwidth}
    \centering
    \includegraphics[width=\linewidth]{example-image-b}
    \caption{Other caption}
    \label{fig:myfigb}
  \end{subfigure}
  \caption{My big caption}
  \label{fig:myfig}
\end{figure}
\end{document}
tobiasBora
  • 8,684
  • Since a subfigure is basically a minipage, see https://tex.stackexchange.com/questions/274/can-i-get-a-normal-footnote-in-a-minipage-environment-in-latex-how?s=4|54.0991 However, since you don't know what page you will wind up on (despite the h!) you may have problems putting it at the bottom of the page. The bottom of the figure would work. – John Kormylo Feb 07 '18 at 18:08

2 Answers2

7

You can use a \footnotemark and \footnotetext pair:

enter image description here

\documentclass{article}
\usepackage{graphicx}
% To display subfigures
\usepackage{caption}
\usepackage{subcaption}

\begin{document} \begin{figure}[h!] \centering \begin{subfigure}[t]{.47\textwidth} \centering \includegraphics[width=\linewidth]{example-image-a} \caption{My caption with a footnote\protect\footnotemark} \label{fig:myfiga} \end{subfigure}\hspace*{.05\textwidth}% \begin{subfigure}[t]{.47\textwidth} \centering \includegraphics[width=\linewidth]{example-image-b} \caption{Other caption} \label{fig:myfigb} \end{subfigure} \caption{My big caption} \label{fig:myfig} \end{figure} \footnotetext{Yes I like footnotes ! But this one is not a true foot note, because it's not at the bottom of the page...} \end{document}

Or, if you prefer a more automatic solution (requires LaTeX 2020-10-01, at least), you can redefine \footnote in the figure environment, so that it does \footnotemark, and store the \footnotetext in a hook to be executed after the figure environment, then you can just use \footnote inside figure:

enter image description here

\documentclass{article}
\usepackage{graphicx}
% To display subfigures
\usepackage{caption}
\usepackage{subcaption}

\AddToHook{env/figure/begin}{% \DeclareRobustCommand\footnote[1]{% \footnotemark \expanded{\AddToHookNext{env/figure/after}% {\noexpand\setcounter{footnote}{\thefootnote}% \noexpand\footnotetext\unexpanded{{#1}}}}}}

\begin{document} \begin{figure}[h!] \centering \begin{subfigure}[t]{.47\textwidth} \centering \includegraphics[width=\linewidth]{example-image-a} \caption{My caption with a footnote\footnote {Yes I like footnotes ! But this one is not a true foot note, because it's not at the bottom of the page...}} \label{fig:myfiga} \end{subfigure}\hspace*{.05\textwidth}% \begin{subfigure}[t]{.47\textwidth} \centering \includegraphics[width=\linewidth]{example-image-b} \caption{Other caption\footnote{Another}} \label{fig:myfigb} \end{subfigure} \caption{My big caption\footnote{MOAR}} \label{fig:myfig} \end{figure} \end{document}

  • Is there any option to reduce the coupling of this approach? I have defined each subfigure in its own file and placing the \footnotemark and the \footnotetext in different files sounds confusing to me. – Christoph Thiede Sep 13 '21 at 13:33
  • @ChristophThiede I added a solution that doesn't require separating the text from the footnotemark – Phelype Oleinik Sep 13 '21 at 15:49
  • My latex compiler does not know \AddToHook (undefined control sequence), is this some miktex specific thing? – Christoph Thiede Sep 13 '21 at 17:27
  • @ChristophThiede No, you need to update your distribution. You need at least TeX Live 2020. Try this instead (didn't check throughly though): \usepackage{etoolbox} \makeatletter \def\atendfigurenotes{} \AfterEndEnvironment{figure}{\atendfigurenotes\let\atendfigurenotes\@empty}% \makeatother \AtBeginEnvironment{figure}{\DeclareRobustCommand\footnote[1]{\footnotemark\xdef\atendfigurenotes{\unexpanded\expandafter{\atendfigurenotes}\noexpand\setcounter{footnote}{\thefootnote}\noexpand\footnotetext\unexpanded{{#1}}}}} – Phelype Oleinik Sep 13 '21 at 22:52
  • Sigh, installed texlive 2021 but \AddToHook is still not found ... I also tried your other alternative (assuming the % should not be part of the string) but footnotes still appear in the figure. – Christoph Thiede Sep 16 '21 at 17:44
  • 1
    @ChristophThiede Something's wrong then, in TeX Live 2021 \AddToHook should already be there. What does latex '\stop' show on the terminal? – Phelype Oleinik Sep 16 '21 at 23:40
  • latex '\stop' and pdflatex '\stop' shows TeX Live 2021, but the Latex Workshop extension for VS Code still uses the old version, I don't know why. I have filed an issue here: https://github.com/James-Yu/LaTeX-Workshop/issues/2868 – Christoph Thiede Sep 17 '21 at 16:20
  • 1
    @ChristophThiede Ah, so it seems VS Code is not using the right path to TL 2021. I don't use VS Code, so I can't help you further, sorry. – Phelype Oleinik Sep 17 '21 at 22:35
  • Yahoo, I finally got it working! :-) / I needed to change env/figure to env/figure* as I use a full-page figure in a two-column document, maybe that's worth a note. / It's just a pity that your approach seems not to work for figures that are displayed on the next page, but this seems to be a general issue with footnotes and figures. – Christoph Thiede Sep 29 '21 at 18:58
0

FWIW, I had a similar use case but I wanted to display all footnotes spawned from a subfigure right below the parent figure. To achieve this, I have adjusted Phelype's solution from above (requires LaTeX 2020-10-01 or higher):

\usepackage{footmisc}
\AddToHook{env/subfigure/begin}{%
    \DeclareRobustCommand\footnote[1]{%
        \mpfootnotemark
        \expanded{\AddToHookNext{env/subfigure/after}%
            {\noexpand\setcounter{mpfootnote}{\arabic{mpfootnote}}%
             \noexpand\footnotetext\unexpanded{{#1}}}}}}

MWE:

\documentclass{article}
\documentclass{article}
\usepackage{graphicx}
% To display subfigures
\usepackage{subcaption}

\usepackage{footmisc} \AddToHook{env/subfigure/begin}{% \DeclareRobustCommand\footnote1{% \mpfootnotemark \expanded{\AddToHookNext{env/subfigure/after}% {\noexpand\setcounter{mpfootnote}{\arabic{mpfootnote}}% \noexpand\footnotetext\unexpanded{{#1}}}}}}

\begin{document}

\begin{figure*} \begin{minipage}{\linewidth} \begin{center} \begin{subfigure}[t]{.47\linewidth} \includegraphics[width=\linewidth]{example-image-a} \caption{Other caption} \end{subfigure}% \hspace*{.05\textwidth}% \begin{subfigure}[t]{.47\linewidth} \includegraphics[width=\linewidth]{example-image-c} \caption[LoF entry]{My caption with a footnote\footnote{This footnote is displayed right below the subfigure at the bottom of the containing parent figure.}} \end{subfigure}

        \caption{My big caption.}
        \label{fig:usage_mining/patterns}
    \end{center}
\end{minipage}

\end{figure*}

\end{document}