0

I have a figure (includegraphics) in a longtable and I have added a caption to it with the solution taken from https://tex.stackexchange.com/a/85920

How can I add a footnote to the caption of the figure?

\documentclass{scrartcl}
\usepackage{longtable}
\usepackage{graphicx}
% caption for figure in longtable
\makeatletter
\def\figcaption{%
    \refstepcounter{figure}%
     \@dblarg{\@caption{figure}}}
\makeatother
% /caption for figure in longtable
\begin{document}
    \begin{longtable}{ | p{3,5cm} | p{10cm} | }
        \hline
        text here & text here
        $\vcenter{
            \centering
            \includegraphics[width=0.5\linewidth]{/tmp/tmp.png}
            \figcaption{sometext\footnotemark{\footnotetext{another text}}} % error here
        }$
        \\\hline
        \caption{some caption}
    \end{longtable}
\end{document}

The above solution gives me the following errors:

/tmp/t.tex:23: Argument of \@caption has an extra }. [...footnotemark{\footnotetext{another text}}}]
/tmp/t.tex:23: Paragraph ended before \@caption was complete. [...footnotemark{\footnotetext{another text}}}]
/tmp/t.tex:25: Missing } inserted. [        \\\hline]
/tmp/t.tex:25: Missing \cr inserted. [      \\\hline]
/tmp/t.tex:25: Misplaced \cr. [     \\\hline]
/tmp/t.tex:25: Missing \cr inserted. [      \\\hline]
[...]
Too many errors. TeX stopped.
  • Where should this footnote be placed exactly? Just below the caption? – Bernard Jun 19 '17 at 9:48
  • Just place \def – Emad kareem Jun 19 '17 at 9:57
1

Use the optional argument. You don't want the footnote to wander in the listoffigures anyway:

\documentclass{scrartcl}
\usepackage{longtable}
\usepackage{graphicx}
% caption for figure in longtable
\makeatletter
\def\figcaption{%
    \refstepcounter{figure}%
     \@dblarg{\@caption{figure}}}
\makeatother
% /caption for figure in longtable
\begin{document}
\listoffigures

    \begin{longtable}{ | p{3,5cm} | p{10cm} | }
        \hline
        text here & text here
        $\vcenter{
            \centering
            \includegraphics[width=0.5\linewidth]{example-image}
            \figcaption[sometext]{sometext\footnotemark{\footnotetext{another text}}} % error here
        }$
        \\\hline
        \caption{some caption}
    \end{longtable}
\end{document}
0

Just place \def

So you will be like

\documentclass{scrartcl}
\usepackage{longtable}
\usepackage{graphicx}
% caption for figure in longtable
\makeatletter
\def\figcaption{%
    \refstepcounter{figure}%
     \@dblarg{\@caption{figure}}}
\makeatother
% /caption for figure in longtable
\begin{document}
    \begin{longtable}{ | p{3,5cm} | p{10cm} | }
        \hline
        text here & text here
        $\vcenter{
            \centering
           \includegraphics[width=0.5\linewidth]{/tmp/tmp.png}
      \def\figcaption{sometext\footnotemark{\footnotetext{another text}}}
           }$
        \\\hline
        \caption{some caption}
    \end{longtable}
\end{document}
  • 1
    making a definition that is then not used does nothing at all. – David Carlisle Jun 19 '17 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.