LaTeX forum ⇒ Page LayoutFootnote 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

Postby jannetta » Sun Mar 01, 2015 12:35 pm

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:
  1. \documentclass{report}
  2.  
  3. \usepackage{hyperref}% if you want/for demonstration of hyperlinks
  4. \usepackage{tablefootnote}
  5.  
  6. \makeatletter
  7. \newcommand{\spewfootnotes}{%
  8. \tfn@tablefootnoteprintout%
  9. \global\let\tfn@tablefootnoteprintout\relax%
  10. \gdef\tfn@fnt{0}%
  11. }
  12. \makeatother
  13.  
  14. \begin{document}
  15. Text\footnote{text1} Text\footnote{text2}
  16.  
  17. \vbox{%
  18. \begin{itemize}
  19. \item X\tablefootnote{a}
  20. \item Y\tablefootnote{b}
  21. \item Z\tablefootnote{c}
  22. \end{itemize}
  23. }\spewfootnotes
  24.  
  25. Text\footnote{text7}
  26.  
  27. \newpage
  28.  
  29. Just to get another page to demonstrate the hyperlinks.
  30.  
  31. \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:
  1. %\documentclass{report}
  2. \documentclass[11pt, a4paper, oneside, onecolumn, openany]{book} % Current
  3. \setlength{\parskip}{\medskipamount} \setlength{\parindent}{0em}
  4. \usepackage{ae,aecompl,amsbsy,amssymb,eurosym, graphics, graphicx, mathptmx, setspace}
  5. \usepackage{epsfig, multicol, multirow, paralist}
  6. \usepackage{a4wide}
  7. \usepackage[printonlyused]{acronym} %Acronyms
  8. \usepackage{helvet}
  9. \usepackage{fancyref}
  10. \usepackage{caption}
  11. \captionsetup{justification=justified}
  12. \usepackage{subfigure}
  13. \usepackage{url}
  14. \usepackage{tablefootnote}
  15. \setstretch{1.5}
  16. \setlength{\oddsidemargin}{1.7cm}
  17. \setlength{\evensidemargin}{-0.8cm}
  18. \setlength{\topmargin}{-0.8cm}
  19. \setlength{\textwidth}{15.4cm}
  20. \setlength{\textheight}{24cm}
  21. \makeatletter
  22. \newcommand{\spewfootnotes}{%
  23. \tfn@tablefootnoteprintout%
  24. \global\let\tfn@tablefootnoteprintout\relax%
  25. \gdef\tfn@fnt{1}%
  26. }
  27. \makeatother
  28.  
  29. \begin{document}
  30. Text\footnote{text1}
  31. \newpage
  32. Text\footnote{text2} Text\footnote{text3}
  33.  
  34. \vbox{%
  35. \begin{itemize}
  36. \item X\tablefootnote{a4}
  37. \item Y\tablefootnote{b5}
  38. \item Z\tablefootnote{c6}
  39. \end{itemize}
  40. }\spewfootnotes
  41.  
  42. \begin{figure}[H]
  43. \begin{center}
  44. \includegraphics[width=15cm]{graphics/model_organisms.png}
  45. \end{center}
  46. \end{figure}\spewfootnotes
  47.  
  48. Text\footnote{text7}
  49. \newpage
  50.  
  51. Just to get another page to demonstrate the hyperlinks.
  52.  
  53. \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. :D

  1. \documentclass[11pt, a4paper, oneside, onecolumn, openany]{book} % Current
  2. \setlength{\parskip}{\medskipamount} \setlength{\parindent}{0em}
  3. \usepackage{ae,aecompl,amsbsy,amssymb,eurosym, graphics, graphicx, mathptmx, setspace}
  4. \usepackage{epsfig, multicol, multirow, paralist}
  5. \usepackage{a4wide}
  6. \usepackage[printonlyused]{acronym} %Acronyms
  7. \usepackage{helvet}
  8. \usepackage{fancyref}
  9. \usepackage{caption}
  10. \captionsetup{justification=justified}
  11. \usepackage{subfigure}
  12. \usepackage{url}
  13. \usepackage{tablefootnote}
  14. \setstretch{1.5}
  15. \setlength{\oddsidemargin}{1.7cm}
  16. \setlength{\evensidemargin}{-0.8cm}
  17. \setlength{\topmargin}{-0.8cm}
  18. \setlength{\textwidth}{15.4cm}
  19. \setlength{\textheight}{24cm}
  20. \makeatletter
  21. \newcommand{\spewfootnotes}{%
  22. \tfn@tablefootnoteprintout%
  23. \global\let\tfn@tablefootnoteprintout\relax%
  24. \gdef\tfn@fnt{1}%
  25. }
  26. \makeatother
  27.  
  28. \input{preamble}
  29. \begin{document}
  30.  
  31.  
  32. \chapter{Test Chapter}
  33. \label{chap:test}
  34. 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}.
  35.  
  36. \begin{figure}[H]
  37. \begin{center}
  38. \includegraphics[width=15cm]{graphics/model_organisms.png}
  39. \caption{From left to right: \textit{Caenorhabditis elegans}\tablefootnote{A footnote}, \textit{Drosophila melanogaster}\tablefootnote{Another footnote}, \textit{Saccharomyces cerevisiae}, \textit{Danio rerio}.}
  40. \label{fig:model_organisms}
  41. \end{center}
  42. \end{figure}\spewfootnotes
  43.  
  44.  
  45. \backmatter
  46. \pagestyle{plain}
  47. %\bibliographystyle{newPlain}
  48. \bibliographystyle{plain}
  49. \begin{singlespace}
  50. \bibliography{research}
  51. \end{singlespace}
  52.  
  53. \end{document}
Attachments
singlechapter.pdf
(132.66 KiB) Downloaded 227 times

User avatar
Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sun Mar 01, 2015 6:49 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

Postby jannetta » Sun Mar 01, 2015 8:00 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?

User avatar
Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sun Mar 01, 2015 8:40 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.

  1. \documentclass[11pt, a4paper, oneside, onecolumn, openany]{book}
  2. \usepackage{parskip}
  3. \usepackage{showframe}
  4. \usepackage{blindtext}
  5. \usepackage{graphicx}
  6. \usepackage{threeparttable}
  7. \newcommand{\species}[1]{\textit{#1}}
  8. \begin{document}
  9.  
  10. \chapter{Test Chapter}
  11. \label{chap:testB}
  12. Computational models are mathematical models of systems such as
  13. are found in biology, physics, weather systems etc. Such models
  14. can be used to predict the behaviour of these systems in an
  15. effort to develop interventions which help to control our
  16. environment. By predicting weather systems we can safeguard
  17. ourselves against extreme weather conditions or plan our crops to
  18. avoid failures. In physics, models serve the purpose of
  19. discovering the origins of the universe and predicting what the
  20. future might hold for us. In biology, computational models serve
  21. to provide a better understanding of the way our bodies work as
  22. part of our effort to fight disease and prolong
  23. life\footnote{stuff}.
  24.  
  25. \blindtext[2]
  26. \begin{figure}[t]
  27. \centering
  28. \begin{threeparttable}
  29. \begin{tabular}{c}
  30. \includegraphics[width=.9\linewidth]{example-image-b}
  31. \end{tabular}
  32. \caption{From left to right: \species{Caenorhabditis
  33. elegans}\tnote{a}, \species{Drosophila melanogaster}\tnote{b},
  34. \species{Saccharomyces cerevisiae}, \species{Danio rerio}.}
  35. \label{fig:model_organismsB}
  36. \begin{tablenotes}
  37. \item [a] A footnote
  38. \item [b] Another footnote
  39. \end{tablenotes}
  40. \end{threeparttable}
  41. \end{figure}
  42. \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.

User avatar
Stefan Kottwitz
Site Admin
Posts: 9413
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sun Mar 01, 2015 8:42 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
Site admin

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

Postby jannetta » Sun Mar 01, 2015 10:46 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

Postby ghuczek » Sun Mar 01, 2015 10:58 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}

User avatar
Stefan Kottwitz
Site Admin
Posts: 9413
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sun Mar 01, 2015 11:01 pm

I guess it was meant the other way round.

Stefan
Site admin

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

Postby jannetta » Sun Mar 01, 2015 11:27 pm

Yes, the other way round :-)

\renewcommand{\tablename{Figure}}

It worked!

Thank you all for your help :D

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

Postby jannetta » Mon Mar 02, 2015 12:21 am

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.
  1. % Program floats
  2. \newfloat{program}{thp}{lop}
  3. \floatname{program}{Program}
  4. \newfloat{dir}{thp}{lop}
  5. \floatname{dir}{Directory Listing}
  6.  
  7. % Ruled float
  8. \floatstyle{boxed}
  9. %\floatstyle{ruled}
  10. \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?


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 3 guests