2

How can I remove the word theorem/defintion from a list of theorems:

\usepackage{amsthm}
\usepackage{thmtools}

\declaretheorem[numberwithin=section]{defn}

...

\listoftheorems

\begin{defn}[My definition]
  \[a^2 + b^2 = c^2\]
\end{defn}

Results into:

List of Theorems

1.1 Defn (MyDefinition)... 1

I would like have this:

1.1 My Definition ..........1

Any ideas?

4
  • 1
    I guess that “My Definition” is an exceptional definition, so I suggest trying something along the lines of (untested) \declaretheorem[numberwithin=section, name=My Definition]{mydefn} followed by \begin{mydefn} \[a^2 + b^2 = c^2\] \end{mydefn}. – GuM Aug 28 '18 at 21:47
  • @GuM I'm afraid I have quite a few definitions: around 15 I'd prefer a generic solution rather than defining 15 theorem types... – Koenig Lear Aug 29 '18 at 10:45
  • @JohnKormylo where do I set the gobble parameter? – Koenig Lear Aug 29 '18 at 10:48
  • Actually, the theorem style only affects the main text, not the \contentsline entry. – John Kormylo Aug 29 '18 at 17:40
1

Remove the code that adds the theorem name:

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

\makeatletter
\patchcmd{\thmt@mklistcmd}{\thmt@thmname}{}{}{}
\patchcmd{\thmt@mklistcmd}{\thmt@thmname}{}{}{}
\makeatother
\renewcommand\thmtformatoptarg[1]{#1}

\declaretheorem[numberwithin=section]{defn}

\begin{document}

\listoftheorems

\begin{defn}[My definition]
   \[a^2 + b^2 = c^2\]
\end{defn}

\end{document}

enter image description here

0
1

Thrmtools redefines \contentsline inside the \listoftheorems, adding an extra argument (the theorem name). So I created a new theorem name for the sole purpose of adding things with \addcontentsline.

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

\declaretheorem[numberwithin=section]{defn}
\declaretheorem{test}

\begin{document}

\listoftheorems[ignore=defn]

\begin{defn}[My definition]
\addcontentsline{loe}{test}{\string\numberline {\thedefn}My definition}%
   \[a^2 + b^2 = c^2\]
\end{defn}

\end{document}

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.