我正在使用 longtable 包制作一个漂亮的小表格。表格中的一个条目应有一个符号脚注,我使用它:
%Symbolic footnote command
\newcounter{savefootnote}
\newcounter{symfootnote}
\newcommand{\symfootnote}[1]{%
\setcounter{savefootnote}{\value{footnote}}%
\setcounter{footnote}{\value{symfootnote}}%
\ifnum\value{footnote}>8\setcounter{footnote}{0}\fi%
\let\oldthefootnote=\thefootnote%
\renewcommand{\thefootnote}{\fnsymbol{footnote}}%
\footnote{#1}%
\let\thefootnote=\oldthefootnote%
\setcounter{symfootnote}{\value{footnote}}%
\setcounter{footnote}{\value{savefootnote}}%
}
虽然使用 c 类型命令一切都能正常工作,但使用 p- 时却不行。然后脚注的索引为 1。
梅威瑟:
\documentclass[a5paper, 12pt]{article}
\usepackage{longtable}
%Symbolic footnote command
\newcounter{savefootnote}
\newcounter{symfootnote}
\newcommand{\symfootnote}[1]{%
\setcounter{savefootnote}{\value{footnote}}%
\setcounter{footnote}{\value{symfootnote}}%
\ifnum\value{footnote}>8\setcounter{footnote}{0}\fi%
\let\oldthefootnote=\thefootnote%
\renewcommand{\thefootnote}{\fnsymbol{footnote}}%
\footnote{#1}%
\let\thefootnote=\oldthefootnote%
\setcounter{symfootnote}{\value{footnote}}%
\setcounter{footnote}{\value{savefootnote}}%
}
\begin{document}
\begin{longtable}{p{0.33\textwidth}p{0.59\textwidth}}
Test & Test\symfootnote{With Symbol!}\\
\caption{Test table}
\label{tab:pertModels}
\end{longtable}
\end{document}
答案1
此版本稍微简单一些,允许您使用任何符号(可选参数)。缺点是您必须手动恢复正常脚注。
\documentclass[a5paper, 12pt]{article}
\usepackage{longtable}
\makeatletter
\newcommand{\symfootnote}[2][*]{% #1 = symbol (optional), #2 = text
\xdef\thempfn{#1}%
\if\thempfn\thefootnote
\stepcounter{footnote}%
\xdef\thempfn{\thefootnote}%
\fi
\footnote{#2}%
\addtocounter{footnote}{-1}%
}
\makeatother
\begin{document}
\begin{longtable}{p{0.33\textwidth}p{0.59\textwidth}}
Test & Test\symfootnote{With Symbol!}\\
Test & Test\symfootnote[$\dagger$]{second footnote}\\
Test & Test\symfootnote[\thefootnote]{how to include normal footnotes}\\
\caption{Test table}
\label{tab:pertModels}
\end{longtable}
\def\thempfn{\thefootnote}% restore normal footnotes
%\thefootnote
\end{document}