etoc 可以与 amsart 一起使用吗?

etoc 可以与 amsart 一起使用吗?

A问题突然被删除,这让我开始调查 etoc 是否与 amsart 兼容。答案是它需要一点调整。

答案1

etoc软件包与 amsart 不兼容:

  • \@mkboth {\MakeUppercase \contentsname}{\MakeUppercase \contentsname} etoc 默认从文章类的代码来看似乎存在问题 ,

  • 此外,从 amsart 文档复制粘贴

    In amsart.sty \@startsection, \@sect, and a couple of other things are rede-
    fined to fix a few hard-coded things that would interfere with the desired style.
    The most noteworthy difference is that all section headings will go into the table
    of contents (governed by secnumdepth as usual), EVEN WHEN THE * FORM
    IS USED. The only section heading not listed in the table of contents is the
    heading for the toc itself.
    

可以通过覆盖etoc“toc 显示样式”的默认行为来处理这两件事,以避免\@mkboth和避免使用,\section*因为这会在 toc 文件中创建不需要的条目。因此,这个最小示例对我来说是有效的:

\documentclass{amsart}

\usepackage{etoc}
\etocsettocstyle{\noindent\textbf{\contentsname}\par}{}

\begin{document}

\tableofcontents

\section{FOO}

\etocsettocstyle{\noindent\textbf{Local table of contents}\par}{}
\localtableofcontents

\subsection{bar1}
\subsection{bar2}
\subsection{bar3}

\section{FOOII}

\end{document}

在此处输入图片描述

相关内容