## LaTeX forum ⇒ Page Layout ⇒ Footnote in figure caption

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm

### Footnote in figure caption

Hi Folks!

I am trying to add footnotes to the caption of a figure. Just using \footnote did not want to work and was producing several errors. After lots of googling I found something that is almost working but not quite. Rather than trying more solutions it would be great if someone can help me to fix this solution to work as it has, so far, produced the best results. I found the solution here:http://tex.stackexchange.com/questions/43692/footnotetext-numbering-for-many-footnotemark-automatic-solution

If I compile the solution on my system it works fine, i.e. just cutting it from the web page and pasting it to a document on my system like this:
\documentclass{report} \usepackage{hyperref}% if you want/for demonstration of  hyperlinks\usepackage{tablefootnote} \makeatletter\newcommand{\spewfootnotes}{%\tfn@tablefootnoteprintout%\global\let\tfn@tablefootnoteprintout\relax%\gdef\tfn@fnt{0}%}\makeatother \begin{document}Text\footnote{text1} Text\footnote{text2} \vbox{%\begin{itemize}\item X\tablefootnote{a}\item Y\tablefootnote{b}\item Z\tablefootnote{c}\end{itemize}}\spewfootnotes Text\footnote{text7} \newpage Just to get another page to demonstrate the hyperlinks. \end{document}

The next thing I tried was to add an image. To do this I had to include some packages, so I just included the all the includes from my document. This works perfectly for the footnotes but the image is out of place. Following is that document:
%\documentclass{report}\documentclass[11pt, a4paper, oneside, onecolumn, openany]{book}    % Current\setlength{\parskip}{\medskipamount} \setlength{\parindent}{0em}\usepackage{ae,aecompl,amsbsy,amssymb,eurosym, graphics, graphicx, mathptmx, setspace}\usepackage{epsfig, multicol, multirow, paralist}\usepackage{a4wide}\usepackage[printonlyused]{acronym} %Acronyms\usepackage{helvet}\usepackage{fancyref}\usepackage{caption}\captionsetup{justification=justified}\usepackage{subfigure}\usepackage{url}\usepackage{tablefootnote}\setstretch{1.5}\setlength{\oddsidemargin}{1.7cm}\setlength{\evensidemargin}{-0.8cm}\setlength{\topmargin}{-0.8cm}\setlength{\textwidth}{15.4cm}\setlength{\textheight}{24cm}\makeatletter\newcommand{\spewfootnotes}{%	\tfn@tablefootnoteprintout%	\global\let\tfn@tablefootnoteprintout\relax%	\gdef\tfn@fnt{1}%}\makeatother \begin{document}	Text\footnote{text1}	\newpage	Text\footnote{text2} Text\footnote{text3} 	\vbox{%		\begin{itemize}			\item X\tablefootnote{a4}			\item Y\tablefootnote{b5}			\item Z\tablefootnote{c6}		\end{itemize}	}\spewfootnotes 	\begin{figure}[H]		\begin{center}			\includegraphics[width=15cm]{graphics/model_organisms.png}				\end{center}	\end{figure}\spewfootnotes 	Text\footnote{text7}	\newpage 	Just to get another page to demonstrate the hyperlinks. \end{document}

Ignoring the out-of-place image, I created a test document that is a stripped down version of my document. In this case the problem appears. On the page where the footnotes are the \tablefootnotes appear twice, starting the number at 0 for the first instance and then, for the second instance, the numbering is correct. It is difficult to explain. So, below, I'll include the code and then I'll attach the pdf.

If anyone can shed some light on this problem for me, YOU'LL BE MY HERO.

\documentclass[11pt, a4paper, oneside, onecolumn, openany]{book}    % Current\setlength{\parskip}{\medskipamount} \setlength{\parindent}{0em}\usepackage{ae,aecompl,amsbsy,amssymb,eurosym, graphics, graphicx, mathptmx, setspace}\usepackage{epsfig, multicol, multirow, paralist}\usepackage{a4wide}\usepackage[printonlyused]{acronym} %Acronyms\usepackage{helvet}\usepackage{fancyref}\usepackage{caption}\captionsetup{justification=justified}\usepackage{subfigure}\usepackage{url}\usepackage{tablefootnote}\setstretch{1.5}\setlength{\oddsidemargin}{1.7cm}\setlength{\evensidemargin}{-0.8cm}\setlength{\topmargin}{-0.8cm}\setlength{\textwidth}{15.4cm}\setlength{\textheight}{24cm}\makeatletter\newcommand{\spewfootnotes}{%	\tfn@tablefootnoteprintout%	\global\let\tfn@tablefootnoteprintout\relax%	\gdef\tfn@fnt{1}%}\makeatother \input{preamble}\begin{document}  \chapter{Test Chapter} \label{chap:test}Computational models are mathematical models of systems such as are found in biology, physics, weather systems etc. Such models can be used to predict the behaviour of these systems in an effort to develop interventions which help to control our environment. By predicting weather systems we can safeguard ourselves against extreme weather conditions or plan our crops to avoid failures. In physics, models serve the purpose of discovering the origins of the universe and predicting what the future might hold for us. In biology, computational models serve to provide a better understanding of the way our bodies work as part of our effort to fight disease and prolong life\footnote{stuff}. \begin{figure}[H]	\begin{center}		\includegraphics[width=15cm]{graphics/model_organisms.png}		\caption{From left to right: \textit{Caenorhabditis elegans}\tablefootnote{A footnote}, \textit{Drosophila melanogaster}\tablefootnote{Another footnote}, \textit{Saccharomyces cerevisiae}, \textit{Danio rerio}.}		\label{fig:model_organisms}	\end{center}\end{figure}\spewfootnotes  	\backmatter	\pagestyle{plain}	%\bibliographystyle{newPlain}	\bibliographystyle{plain}	\begin{singlespace}				\bibliography{research}	\end{singlespace} \end{document}
Attachments
singlechapter.pdf

Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm
You can use package threeparttable. This way you can put the footnots right below the object, which is where they belong.
As you noticed, the picture can float away, making you intervene by hand. This can mess up everything right before you want to submit your paper or thesis.

I really recommend not to use footnotes on the bottom of the page.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm
Hi Johannes

If not at the bottom of the page, where then would you say is the appropriate place to put them and how?

Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm
When it comes to floating objects, they should they right with the object.

I just noticed, that threeparttable is a little bit quirky, please see the following example. As stated in the documentation, there is nothing automatic here, everything relies on manual work. Pity.

\documentclass[11pt, a4paper, oneside, onecolumn, openany]{book}\usepackage{parskip}\usepackage{showframe}\usepackage{blindtext}\usepackage{graphicx}\usepackage{threeparttable}\newcommand{\species}[1]{\textit{#1}}\begin{document} \chapter{Test Chapter}\label{chap:testB}Computational models are mathematical models of systems such asare found in biology, physics, weather systems etc. Such modelscan be used to predict the behaviour of these systems in aneffort to develop interventions which help to control ourenvironment. By predicting weather systems we can safeguardourselves against extreme weather conditions or plan our crops toavoid failures. In physics, models serve the purpose ofdiscovering the origins of the universe and predicting what thefuture might hold for us. In biology, computational models serveto provide a better understanding of the way our bodies work aspart of our effort to fight disease and prolonglife\footnote{stuff}. \blindtext[2]\begin{figure}[t]	\centering	\begin{threeparttable}		\begin{tabular}{c}		\includegraphics[width=.9\linewidth]{example-image-b}	\end{tabular}		\caption{From left to right: \species{Caenorhabditis		elegans}\tnote{a}, \species{Drosophila melanogaster}\tnote{b},		\species{Saccharomyces cerevisiae}, \species{Danio rerio}.}		\label{fig:model_organismsB}		\begin{tablenotes}		\item [a] A footnote		\item [b] Another footnote		\end{tablenotes}		\end{threeparttable}\end{figure}\end{document}

Btw: A lot of the packages you are using are obsolete.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Stefan Kottwitz
Posts: 9413
Joined: Mon Mar 10, 2008 9:44 pm
The common way for adding footnotes to a floating object is
• keeping it within the environment, such as directly below the table or figure,
• using different symbols. For example, if normal footnotes are numbered 1, 2, 3, ... table footnotes may get a, b, c.
That's the case with footnotes in a minipage by default in LaTeX. So, possible solutions are minipage and threeparttable.

Stefan

jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm
Okay, I have followed your suggestions and implemented the threeparttable. Just on question though. The caption says "Table 1.1". I want it to be Figure. How can I change that?

ghuczek
Posts: 23
Joined: Sun Dec 23, 2012 8:09 pm
The caption is in the figure environment. Would this work for you?

\renewcommand{\figurename}{Table}

Then change it back later if other figures need proper captioning.

\renewcommand{\figurename}{Figure}

Stefan Kottwitz
Posts: 9413
Joined: Mon Mar 10, 2008 9:44 pm
I guess it was meant the other way round.

Stefan

jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm
Yes, the other way round

\renewcommand{\tablename{Figure}}

It worked!

Thank you all for your help

jannetta
Posts: 46
Joined: Mon Dec 22, 2008 12:59 pm
I have another problem now. The boxes around my figures disappeared. I had to remove the following lines from my preamble because they were messing up the caption and footnote order. I don't really understand what they all do.
% Program floats\newfloat{program}{thp}{lop}\floatname{program}{Program}\newfloat{dir}{thp}{lop}\floatname{dir}{Directory Listing} % Ruled float\floatstyle{boxed}%\floatstyle{ruled}\newfloat{figure}{thp}{lop}

I would also like to change the font of the footnotes to be smaller like those that are at the bottom of the page. How would I do that?