3

I use declaretheoremstyle to define a theorem environment, and print a list of theorems in the end of my document:

\documentclass{article}
\usepackage[english]{babel}
\usepackage[margin=2cm]{geometry}% just for the example
\usepackage{xcolor}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{mdframed}

\declaretheoremstyle[
spaceabove=6pt, spacebelow=6pt,
headfont=\normalfont\bfseries,
postheadspace=1em,
notefont=\bfseries,
notebraces={(}{)},
bodyfont=\itshape,
shaded={bgcolor=yellow!20}
]{thmstyle}

\declaretheorem[style=thmstyle,name=Theorem]{theorem}

\begin{document}

\begin{theorem}[name]
...
\end{theorem}

\renewcommand{\listtheoremname}{List of Theorems}
\addcontentsline{toc}{section}{\listtheoremname}
\listoftheorems[ignoreall,show=theorem]

\end{document}

The list of theorems is printed in the end (please ignore the font color):

enter image description here

Now, the problem is how to print directly the name of the theorems, instead of repeating always "Theorem("?

Could anyone help?

4

Not sure if this is what you want:

\documentclass{article}
\usepackage[english]{babel}
\usepackage[margin=2cm]{geometry}% just for the example
\usepackage{xcolor}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{mdframed}
\usepackage{etoolbox}

\makeatletter
\patchcmd\thmt@mklistcmd
  {\thmt@thmname}
  {\check@optarg{\thmt@thmname}}
  {}{}
\patchcmd\thmt@mklistcmd
  {\thmt@thmname\ifx}
  {\check@optarg{\thmt@thmname}\ifx}
  {}{}
\protected\def\check@optarg#1{%
  \@ifnextchar\thmtformatoptarg\@secondoftwo{#1}%
}
\makeatother

\declaretheoremstyle[
  spaceabove=6pt, spacebelow=6pt,
  headfont=\normalfont\bfseries,
  postheadspace=1em,
  notefont=\bfseries,
  notebraces={(}{)},
  bodyfont=\itshape,
  shaded={bgcolor=yellow!20}
]{thmstyle}

\declaretheorem[style=thmstyle,name=Theorem]{theorem}

\begin{document}

\begin{theorem}[Somebody]
...
\end{theorem}

\begin{theorem}
...
\end{theorem}

\renewcommand{\listtheoremname}{List of Theorems}
\addcontentsline{toc}{section}{\listtheoremname}
\listoftheorems[ignoreall,show=theorem]

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.