如何在目录中隐藏章节标题中的脚注

如何在目录中隐藏章节标题中的脚注

这是此处评论中出现的一个问题:仅在目录中将章节标题更改为小型大写字母

我通常通过执行以下操作来隐藏目录中的脚注:

\section[title]{title\footnote{This is a footnote.}}

这适用于许多文档类别(回忆录、文章等),但并非适用于所有类别。amsbook例如,仅对运行头使用可选参数,因此脚注标记仍会出现在目录中。那么“通用解决方案”是什么?

答案1

不存在“通用”解决方案。AMS 文档类别基于标题和目录的“基本”情况(用于运行标题和目录的“短”形式)不能令人满意的结论,遵循不同的方法:正文和目录均使用完整标题,仅用于运行标题的短(括号)版本,并\mark...提供其他调整来处理异常情况。

最初尝试的方法是插入一个命令,\SkipTocEntry以抑制文件中的“下一个”条目.toc,并使用\addcontentsline插入替换。(示例从 amsbook 中的目录中排除章节有没有办法在目录中显示章节的简称而不是长标题?) 存在时间问题,因此已被其他方法所取代。

现在提供了两个命令\exclude{toc}{...}\for{toc}{...},用于将“变体”的说明直接包含在标题或标题的文本中。这在用户手册中尚未得到很好的记录,但在ams 作者常见问题解答

通过一个(详尽的/令人筋疲力尽的)例子可以最好地理解这些可能性。

\documentclass{amsbook}
\usepackage{verbatim}

\begin{document}

\tableofcontents

\chapter[Title with two footnotes]%
  {Title\except{toc}{\protect\footnote{The first footnote}}
  with two footnotes\except{toc}{\protect\footnote{The second footnote}}}

There is some text in this chapter.\footnote{With a footnote}

Footnotes should be avoided on chapter titles whenever possible.
However, if a footnote---or other material that should not go
into the table of contents, such as a line break---is present, the
command \verb+\except{toc}{...}+ should be wrapped around that element
to suppress it from the contents.

If the header with such a modification may be used in a running head,
either the \verb+[...]+ option or a suitable \verb+\mark...+ command
must be given to omit the modification from the running head.

\newpage

There is a second page in this chapter.

\chapter*{A starred title\except{toc}{\protect\footnotemark}\ with two
  footnotes\except{toc}{\protect\footnotemark}}
\markboth{TITLE WITHOUT EITHER FOOTNOTE}{TITLE WITHOUT EITHER FOOTNOTE}

\addtocounter{footnote}{-1}
\footnotetext{This is the first footnote}
\addtocounter{footnote}{1}
\footnotetext{This is the second footnote}

Notice that footnote numbering isn't reset for ``starred'' chapters.
Also, the bracketed \verb+[...]+ option doesn't work to provide alternate
titles for such chapters so a \verb+\mark...+ must be used
(this may be changed in the future).
Furthermore, a \verb+\footnotemark+, although enclosed in braces as an
argument of \verb+\except+, will gobble the next space, so an explicit
space must be provided.

Section headings can also have footnotes\footnote{An irrelevant footnote}
excluded from the TOC.

\section[A section heading with a footnote]%
  {A section heading, with a
  footnote,\except{toc}{\protect\footnote{And yet another.}}
  that is very long\except{toc}{\protect\\}
  so that it has\for{toc}{\protect\\} to be broken under input control}

There is also a command \verb+\for+ that can be used to \emph{include}
selected material in the TOC, such as an explicit linebreak different
from one used in the body.

\newpage

There is a second page in this chapter.

\chapter[Another chapter title]{Another chapter title with a
  footnote\except{toc}{\protect\footnote{This is another footnote}}}

Footnote numbering \emph{is} reset for numbered chapters.

\newpage

There is also a second page in this chapter too.

\vspace{3\baselineskip}
\small
\verbatiminput{\jobname.tex}
\end{document}

由于示例太长,这里没有显示输出。但是,经过处理后,输入将逐字显示在处理后的输出的末尾,以便于处理。

答案2

通常,\protect当参数移动到 toc 文件时,系统会使脚注“安全”,但在这种情况下,您可以使用简单地将其删除的变体:

\documentclass{article}

\makeatletter
\def\myfnt{\ifx\protect\@typeset@protect\expandafter\footnote\else\expandafter\@gobble\fi}
\makeatother

\begin{document}

\tableofcontents

\section{AAA\myfnt{this}}
z
\section{BBB\myfnt{that}}
z
\section{CCC\myfnt{the other}}
z

\end{document}

答案3

上述解决方案会为您提供使用与章节标题相同字体大小的脚注标记,这可能是不受欢迎的。

如果你想要小一点的:

%%PREAMBLE

\usepackage[stable]{footmisc}

%%BODY

\section{Your Title \textsuperscript{\footnotesize{\footnote{Your foonote}}}}

答案4

自上述答案以来已经发生了几次更新,现在有一个适用于大多数软件包的“通用”解决方案(适用于以下软件包:

\documentclass[a4paper,12pt]{book}
\usepackage[T1]{fontenc}
\usepackage{titlesec}

使用\chapter[TOC_Title]{Title in chapter\protect\footnote{This is a footnote that will only appear in chapter.}}

相关内容