我想在表格中添加多個腳註。讓它正常工作的最佳方法是什麼?

我想在表格中添加多個腳註。讓它正常工作的最佳方法是什麼?

我想在表格中添加多個腳註。但是當我到達第一個時,腳註計數器已經增加了太多次\footnotetext。讓它正常工作的最佳方法是什麼?

\documentclass{article}

\begin{document}

\ \vfill\

\begin{tabular}{|r|l|}
\hline
First & footnote.\footnotemark  \\ 
Second & footnote.\footnotemark   \\ 
Third & footnote.\footnotemark  \\ 
\hline
\end{tabular}

\footnotetext{First}  \footnotetext{Second} \footnotetext{Third}

Fourth footnote.\footnote{Four}

\

\end{document}

在此輸入影像描述

答案1

\footnotemark確實增加了計數器的值,但是在使用footnote時這會變得不同步。\footnotetext

必須重新設定footnote計數器tabular對國家的影響。這可以手動完成,但如果值發生變化,或者使用虛擬計數器完成,則可能會變得乏味,虛擬計數器footnote在之前保存計數器tabular,然後在之後恢復到原始數字tabular(此處使用package.json中的命令\AtBeginEnvironment完成) 。\AfterEndEnvironmentetoolbox

但是,\footnotetext不會增加footnote.要麼使用pretocmd-- 方法,要麼使用包裝巨集\myfootnotetext來自動執行此單步執行。 (或手動執行。)

\documentclass{article}


\newcommand{\myfootnotetext}[1]{%
\stepcounter{footnote}\footnotetext{#1}%
}

\newcounter{dummycounter}

\usepackage{etoolbox}

\AtBeginEnvironment{tabular}{%
  \setcounter{dummycounter}{\value{footnote}}%
}

\AfterEndEnvironment{tabular}{%
  \setcounter{footnote}{\value{dummycounter}}%
}


\begin{document}


\begin{tabular}{|r|l|}
\hline
First & footnote.\footnotemark  \\ 
Second & footnote.\footnotemark   \\ 
Third & footnote.\footnotemark  \\ 
\hline
\end{tabular}
\myfootnotetext{First}
  \myfootnotetext{Second} \myfootnotetext{Third}

Fourth footnote.\footnote{Four}

%\

\end{document}

在此輸入影像描述

答案2

如果您想考慮使用table環境,該tablefootnote套件可以解決您的問題:

\documentclass[colorlinks]{article}%

\usepackage{footnotebackref}
\usepackage{tablefootnote}

\begin{document}
\mbox{}\vfill
A first footnote\footnote{First}

\begin{table}[htbp]
  \renewcommand\arraystretch{1.5}
  \begin{tabular}{|r|l|}
    \hline
    First & footnote.\tablefootnote{Second} \\
    Second & footnote.\tablefootnote{Third} \\
    Third & footnote.\tablefootnote{Fourth} \\
    \hline
  \end{tabular}
\end{table}

Fifth footnote.\footnote{Fifth}

\end{document} 

在此輸入影像描述

相關內容