A解决 LaTeX 无法正确编号嵌套脚注的解决方案有废除连续脚注的逗号分隔(该包提供的功能)的副作用footmisc
,如下所示(请注意脚注 2 和 4 之间缺少的逗号):
\documentclass{article}
\usepackage[multiple]{footmisc}
\usepackage{letltxmacro}% http://ctan.org/pkg/letltxmacro
\newcounter{fnmarkcntr}\newcounter{fntextcntr}
\makeatletter
\renewcommand{\footnotemark}{%
\@ifnextchar[\@xfootnotemark
{\stepcounter{fnmarkcntr}%
\refstepcounter{footnote}\label{footnotemark\thefnmarkcntr}%
\protected@xdef\@thefnmark{\thefootnote}%
\@footnotemark}}
\makeatother
\LetLtxMacro{\oldfootnotetext}{\footnotetext}
\renewcommand{\footnotetext}[1]{%
\stepcounter{fntextcntr}%
\oldfootnotetext[\ref{footnotemark\thefntextcntr}]{#1}
}
\begin{document}
This text has multiple sequential footnotes, but comma delination is disrupted %
if one of the footnotes has a nested footnote\footnote{Here is a footnote}%
\footnote{Here is another footnote.\footnotemark{}}%
\footnotetext{This is the nested footnote.}%
\footnote{Here is the third (non-nested) footnote.}.%
\end{document}
有人能帮我解决这个问题吗,以便每个footmisc
包都能正确分隔逗号?非常感谢。
答案1
以下文档正确打印了嵌套的脚注,并在正确的位置使用了逗号:
\documentclass{article}
\usepackage[multiple]{footmisc}
\begin{document}
This text has multiple sequential footnotes, with
commas at the proper places\footnote{Here is a footnote}%
\footnote{Here is another footnote.\footnotemark{}}%
\footnotetext{This is the nested footnote.}%
\footnote{Here is the third (non-nested) footnote.}.
\end{document}
结果如下:
我可以理解您想自动包含多个嵌套脚注的愿望,但您采用的“解决方案”似乎不太有用(例如,它在第一次编译时会产生错误)。此处显示了多个嵌套脚注
This text has multiple sequential footnotes, with
commas at the proper places\footnote{Here is a footnote}%
\footnote{Here is another footnote.\footnotemark{} with another\footnotemark{}}%
\addtocounter{footnote}{-1}\footnotetext{This is the first nested footnote.}%
\addtocounter{footnote}{1}\footnotetext{This is the second nested footnote.}%
\footnote{Here is the third (non-nested) footnote.}.
您可以从这里开始寻找可行的解决方案。
答案2
更新答案,fnpct
版本 1.x
您可以使用fnpct
。您唯一需要做的就是“适应”,\footnotetext
以便fnpct
知道它应该跨越它:
\documentclass{article}
\usepackage[dont-mess-around]{fnpct}
\usepackage[colorlinks]{hyperref}
\AdaptText\footnotetext{o+m}{\IfNoValueTF{#1}{#NOTE{#2}}{#NOTE[#1]{#2}}}
\begin{document}
This text has multiple sequential footnotes, but comma delination is disrupted
if one of the footnotes has a nested footnote\footnote{Here is a footnote}%
\footnote{Here is another footnote\footnotemark.}\footnotetext{This is the
nested footnote.}\footnote{Here is the third (non-nested) footnote.}.%
\end{document}
这也适用于该选项ranges
(显然不能很好地工作hyperref
:
\documentclass{article}
\usepackage[dont-mess-around]{fnpct}
\AdaptText\footnotetext{o+m}{\IfNoValueTF{#1}{#NOTE{#2}}{#NOTE[#1]{#2}}}
\setfnpct{ranges}
\begin{document}
This text has multiple sequential footnotes, but comma delination is disrupted
if one of the footnotes has a nested footnote\footnote{Here is a footnote}%
\footnote{Here is another footnote\footnotemark.}\footnotetext{This is the
nested footnote.}\footnote{Here is the third (non-nested) footnote.}.%
\end{document}
原始答案,fnpct
版本 0.x
我最近回答了另一个问题不知怎么就忘乎所以了……无论如何,现在有一个新包装,fnpct
,它(实际上是偶然地)提供了一个解决方案。或者说是两个解决方案。
- 命令
\innernote
- 命令
\multfootnote
下面的代码显示了三个工作示例和一个可能具有意外输出的示例:
\documentclass{article}
% the option turns the punctuation switching and kerning adjustments off:
\usepackage[dont-mess-around]{fnpct}
\usepackage[colorlinks]{hyperref}
\begin{document}
% \innernote works well as long as you don't need to nest another level deeper
This text has multiple sequential footnotes, but comma delination is disrupted
if one of the footnotes has a nested footnote\footnote{Here is a footnote}%
\footnote{Here is another footnote\innernote{This is the nested footnote}.}%
\footnote{Here is the third (non-nested) footnote.}.%
% The consecutive placing works well as long as one uses the package option
% `punct-after' (or the option `dont'mess-around' which calls the former
% implicitly) but fails otherwise:
\newpage
\setfnpct{punct-after=false}
This text has multiple sequential footnotes, but comma delination is disrupted
if one of the footnotes has a nested footnote\footnote{Here is a footnote}%
\footnote{Here is another footnote\innernote{This is the nested footnote}.}%
\footnote{Here is the third (non-nested) footnote.}.%
% if it is a single inner footnote then \multfootnote works, too:
% place \footnotemark and use the * argument (= \footnotetext) inside
% \multfootnote. In this case the package option doesn't disturb anything.
\newpage
This text has multiple sequential footnotes, but comma delination is disrupted
if one of the footnotes has a nested footnote\multfootnote{Here is a footnote;Here
is another footnote\footnotemark.;*This is the nested footnote.;Here is the third
(non-nested) footnote.}.%
% the combination of both methods is probably best:
\newpage
This text has multiple sequential footnotes, but comma delination is disrupted
if one of the footnotes has a nested footnote\multfootnote{Here is a footnote;Here
is another footnote\innernote{This is the nested footnote}.;Here is the third
(non-nested) footnote.}.%
% so we can see that `hyperref' cooperates well:
\newpage\null
\end{document}
第四个例子如下:
答案3
在您的问题下方https://tex.stackexchange.com/a/38652/10127有一条评论:
另一个可能的解决方案可以在 tex.stackexchange.com/a/38898/6865(包括对 hyperref 的支持)。 — Stephen 12 月 20 日 18:55
这很容易被忽略。应用于这个案例,它意味着:
\documentclass{article}
\usepackage[multiple]{footmisc}
\usepackage{tablefootnote}[2011/11/26]% v1.0e
\makeatletter
\newcommand{\spewnotes}{%
\tfn@tablefootnoteprintout%
\global\let\tfn@tablefootnoteprintout\relax%
\gdef\tfn@fnt{0}%
}
\makeatother
%\usepackage{hyperref}
\begin{document}
This text has multiple sequential footnotes, with
commas at the proper places\footnote{Here is a footnote}%
\footnote{Here is another footnote.\tablefootnote{This is the first nested footnote.}%
with another\tablefootnote{This is the second nested footnote.}}\spewnotes{}%
\footnote{Here is the third (non-nested) footnote.}.
\newpage
The second page is needed when testing the hyperlinks.
\end{document}
警告!
- egreg 的解决方案不会产生正确的超链接!(但
tablefootnote
会这样做。) 使用 hyperref 包时,两者都不egreg 的解决方案也不我的一个会在脚注之间产生逗号,甚至在由
\footnote{Here is a footnote}\footnote{Here is another footnote.}
footmisc
您可以将此称为或包中的错误hyperref
。因此,脚注(标记)或自动逗号之间的hyperref
(和) 。\textsuperscript{,\,}
关于\spewnotes
:tablefootnote 包用于表格中的脚注,除了\footnotemark
在表格中和\footnotetext{...}
表格后使用外,其他方式都无法使用。-\tablefootnote
命令将标记放置在表格中,记住脚注的内容,并在表格末尾放置脚注文本。这些\addtocounter{footnote}{+/- something}
以及\addtocounter{Hfootnote}{+/- something}
超链接都是自动完成的(以及一些额外的必要代码)。您这里没有表格,但可以使用相同的\footnotemark
/\footnotetext
问题\tablefootnote{...}
。但由于它未在表格中使用,因此该表格没有结尾,因此 tablefootnote 包记住的脚注永远不会发出。(好吧,在下一个表格中,但这不是您想要的。)因此\spewnotes
手动“喷出”这些脚注:\tfn@tablefootnoteprintout
打印脚注,\global\let\tfn@tablefootnoteprintout\relax
清除 tablefootnote 包的内存(即\tfn@tablefootnoteprintout
),否则下次\spewnotes
使用表格时会重复脚注,并将tablefootnote 包的\gdef\tfn@fnt{0}
脚注(fnt
)“标志”设置为零,即没有未处理的表格脚注。记录的 tablefootnote 源代码可以在以下位置找到:ctan.org/tex-archive/macros/latex/contrib/tablefootnote。