thmtools 中定理列表的编辑格式

thmtools 中定理列表的编辑格式

我正在尝试更改包\listoftheorems中命令的格式thmtools。它当前打印“定理(定理名称)....页码”,我希望它打印“定理名称....页码”。我尝试使用此处的修复程序仅显示 \listoftheorems 中的 \NAME和这里生成自定义环境列表。无济于事。

\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools}
\renewcommand{\listtheoremname}{List of Important Theorems}

\declaretheoremstyle[
spaceabove=6pt, spacebelow=6pt,
headfont=\normalfont\bfseries,
notefont=\bfseries, notebraces={(}{)},
bodyfont=\normalfont,
postheadspace=0.5 em,
qed={}
]{theorem}

\declaretheorem[style=theorem]{theorem}
\begin{document}
\listoftheorems
\begin{theorem}[Test]
This is a test theorem.
\end{theorem}
\end{document}

答案1

事实上,答案是埃格尔生成自定义环境列表。适用于此,予以适当修改

\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools}

\renewcommand{\listtheoremname}{List of Important Theorems}

\declaretheoremstyle[
spaceabove=6pt, spacebelow=6pt,
headfont=\normalfont\bfseries,
notefont=\bfseries, notebraces={(}{)},
bodyfont=\normalfont,
postheadspace=0.5 em,
qed={},
]{theorem}

\declaretheorem[style=theorem]{theorem}

\makeatletter
\def\ll@theorem{%
  \protect\numberline{\csname the\thmt@envname\endcsname}%
  \ifx\@empty\thmt@shortoptarg
    \thmt@thmname
  \else
    \thmt@shortoptarg
  \fi}
\def\l@thmt@theorem{} 
\makeatother

\begin{document}
\listoftheorems
\begin{theorem}[First test theorem]
This is a test theorem.
\end{theorem}
\begin{theorem}[Second test theorem]
This is another test theorem.
\end{theorem}
\begin{theorem}
This is another test theorem.
\end{theorem}

\end{document}

在此处输入图片描述

从上面的示例中可以看出,对于未使用可选参数的定理,先前的解决方案仍将仅排版“数定理...页面”。如果您想从列表中隐藏这些定理,而只包含具有名称的定理,则可以使用:

\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools}

\renewcommand{\listtheoremname}{List of Important Theorems}
\makeatletter
\declaretheoremstyle[
spaceabove=6pt, spacebelow=6pt,
headfont=\normalfont\bfseries,
notefont=\bfseries, notebraces={(}{)},
bodyfont=\normalfont,
postheadspace=0.5 em,
qed={},
postheadhook={%
  \ifx\@empty\thmt@shortoptarg
    \renewcommand\addcontentsline[3]{}
  \fi}
]{theorem}
\makeatother

\declaretheorem[style=theorem]{theorem}

\makeatletter
\def\ll@theorem{%
  \protect\numberline{\csname the\thmt@envname\endcsname}%
  \ifx\@empty\thmt@shortoptarg
    \thmt@thmname
  \else
    \thmt@shortoptarg
  \fi}
\def\l@thmt@theorem{} 
 \makeatother

\begin{document}
\listoftheorems
\begin{theorem}[First test theorem]
This is a test theorem.
\end{theorem}
\begin{theorem}[Second test theorem]
This is another test theorem.
\end{theorem}
\begin{theorem}
This is another test theorem.
\end{theorem}

\end{document}

在此处输入图片描述

相关内容