# restatables and \listoftheorem

I am using the restatable environment from the thm-restate package ofthmtools.

I am also using \listoftheorems command to give me a list of the theorems.

However, my restatable theorem is appearing twice in the list of theorems, even when I used the starred version. My feeling is that it should only be in the list of theorems once.

Here is a mwe:

\documentclass{article}
\usepackage{thmtools}
\usepackage{thm-restate}

\declaretheorem[name=Theorem,numberwithin=section]{thm}

\begin{document}

\listoftheorems[ignoreall,show={thm}]

\section{First}

\begin{restatable}[Goldbach's conjecture]{thm}{goldbach}
\label{thm:goldbach}
Every even integer greater than 2 can be expressed as the sum of two primes.
\end{restatable}

\begin{thm}
Some other theorem
\end{thm}

Lets look at the first one again
\goldbach*

\end{document}


I've tried using the ignoreall key and to show just thm environments, but I guess the restatable is a thm too so this doesn't work.

Any ideas appreciated, thanks!

• I got around this by not using restatable and by creating a new un-numbered theorem environment. May 31, 2013 at 14:22

This solution requires some customisation of the thmtools files.

Copy the file thm-listof.sty into the same directory as your document and alter it; I was doing this anyway in order to reformat the list of theorems. If you try to override the format in your preamble, it does not work due to the packages use of \AtBeginDocument.

In this file, find the block which starts \addtotheorempostheadhook{% and modify it to read:

\newif\ifdontputthminlist
\dontputthminlistfalse
\ifdontputthminlist\else
\thmtlo@chaptervspacehack
\csname ll@\thmt@envname\endcsname
}%
\fi
}


Then, when you restate your theorem with \oldtheorem* just write it as follows:

\dontputthminlisttrue
\oldtheorem*
\dontputthminlistfalse


This may also come in handy if there's some random theorem you don't want to show up in the list for any other reason. If you want, you could adopt this approach but flip the flag automatically by modifying the code in thm-restate.sty, but I haven't tried that since this sufficed.

• When I try to modify the addtotheorempostheadhook block as you say, I get the error (./thm-listof.sty ! Undefined control sequence. l.122 \dontputhminlistfalse. Oct 2, 2016 at 12:38
• @ImmanuelWeihnachten There was a typo in the code... The command should be \dontputthminlistfalse with two t's. Sep 9, 2019 at 13:25

There are two options: The first, simpler option is to write additional code into the *.loe file (which is where the list of theorems is stored) to prevent the superfluous lines to be printed. This can simply be achieved like this:

\addtocontents{loe}{\protect\iffalse}
\goldbach*

All theorems between the two \addtocontents commands will be omitted from the list of theorems.
The other option would be to prevent the restated theorems from writing the additional \contentslines to the *.loe file in the first place. However, this is likely to be more complicated, as the thm-listof.sty package uses \addtotheorempostheadhook to make theorems automatically write to the *.loe file, and this command is already executed when you load the package. It should be possible to locally redefine \addcontentsline, which is used inside the hook, to be a no-op.
• If i try this \addtocontents{loe}{\protect\iffalse} \goldbach* \addtocontents{loe}{\protect\fi} i get the error message: ! Extra }, or forgotten \endgroup. Apr 16, 2019 at 11:47