TeX - LaTeX Asked by gustafbstrom on May 4, 2021
I have a footnote in my latex text that that I am reusing a lot. This article on texfaq.org helped me how to do that. However, sometimes I need to refer to the same footnote within, e.g., a figure caption. Latex document example:
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{graphicx}
usepackage{hyperref}
usepackage{footmisc}
usepackage{lipsum}
begin{document}
section*{My text}
Here is textfootnote{Footnote: blahdots}
Here is more textfootnote{label{fn:info} Footnote: blah blahdots}
begin{figure}[h]
centering
includegraphics[width=0.4linewidth]{example-image-a}
% caption{Important remarkfootref{fn:repeat}} %% With footref
caption{Important remarkfootnotemark[ref{fn:info}]} %% With footnoteremark
label{fig:example-image-a}
end{figure}
end{document}
This seems to not work that great. Using footnoteremark
yields:
Argument of @caption has an extra }.
If I try using a footref
(using the "footmisc" package), I get:
Missing endcsname inserted.
Comment in/put the "caption" lines in the example to see the different outputs. How can I use any of these commands inside captions? If I had to choose, I’d prefer an answer for footref
, as I found that to be neater. Thanks.
It is not clear, what is your problem. Solution with commented caption work fine:
documentclass{article}
usepackage[T1]{fontenc}
usepackage{graphicx}
usepackage{footmisc}
usepackage{lipsum}
usepackage{hyperref}
begin{document}
lipsum[1-2]
section*{My text}
Here is textfootnote{Footnote: blahdots}
Here is more textfootnote{label{fn:info} Footnote: blah blahdots}
begin{figure}[h]
centering
includegraphics[width=0.4linewidth]{example-image-a}
caption{Important remark footref{fn:info}.} %% With footnoteremark
label{fig:example-image-a}
end{figure}
end{document}
Note: package hyperref
had to be loaded last (with rare exception)- Above MWE produce:
Correct answer by Zarko on May 4, 2021
You don't need anything special in principle to refer to a footnote. You can simply include a label
in the footnote and refer to it using ref
in the caption of the figure. Here is an example:
documentclass[11pt,a4paper]{article}
usepackage{geometry}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{amsmath}
usepackage{amsfonts}
usepackage{amssymb}
usepackage{graphicx}
usepackage{lipsum}
begin{document}
textbf{Label in caption}
lipsum*[2]footnote{A footnote not related to any figure.}
lipsum*[3]footnote{label{fnInfo} Important information that can be used by different figures.}
begin{figure}[h]
centering
includegraphics[width=0.4linewidth]{example-image-a}
caption{See footnote ref{fnInfo} for details.}
label{fig:example-image-a}
end{figure}
end{document}
Answered by Andre on May 4, 2021
While the answer by @Zarko pointed out what the issue was (package loading order), the answer by @Andre inspired me to create my own solution that worked fine.
newcommand{reffootnote}[1]{$^{scriptsize textrm{ref{#1}}}$}
This creates a command that takes a ref, formats the size and superscripts it. It works anywhere and is quite simple.
Answered by gustafbstrom on May 4, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP