长表中的图形标题中有脚注吗?

长表中的图形标题中有脚注吗?

我在长表中有一个图形(includegraphics),我为其添加了一个标题,解决方案取自https://tex.stackexchange.com/a/85920

如何为图表标题添加脚注?

\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}

上述解决方案给出了以下错误:

/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.

答案1

使用可选参数。无论如何,您都不希望脚注在图片列表中徘徊:

\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}

答案2

只需放置\def

所以你会像

\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}

相关内容