# Problem understanding how thmtools works

The answer to this question directs me to editing \thmt@mklistcmd to change the appearance of the Theorem List, and it seems to be the solution, since it defines \csname ll@\thmt@envname\endcsname (e.g. \ll@definame if I say \newtheorem{defi}{Definizione}), which is then the responsible for that appearance. But the following MWE shows editing that command is useless:

\documentclass[a4paper]{report}
\usepackage{amsthm,thmtools,amsmath,amssymb,amsfonts}
\newtheorem{teor}{Theorem}[section]
\makeatletter
\renewcommand\thmt@mklistcmd{%
\@xa\protected@edef\csname l@\thmt@envname\endcsname{% CHECK: why p@edef?
\@nx\@dottedtocline{1}{1.5em}{\@nx\thmt@listnumwidth}{\thmt@thmname}{mu}%
}%
\ifthmt@isstarred
\@xa\def\csname ll@\thmt@envname\endcsname{%
\protect\numberline{\thmt@thmname\protect\let\protect\autodot\protect:}%
\ifx\@empty\thmt@shortoptarg\else\protect\thmtformatoptarg{\thmt@shortoptarg}\fi
}%
\else
\@xa\def\csname ll@\thmt@envname\endcsname{%
\thmt@thmname\ \csname the\thmt@envname\endcsname:\hfil%
\ifx\@empty\thmt@shortoptarg\else\thmt@shortoptarg\fi
}%
\fi
\@xa\gdef\csname thmt@contentsline@\thmt@envname\endcsname{%
\thmt@contentslineShow% default:show
}%
}
\makeatother

\begin{document}
\chapter{Measures}
\begin{teor}[name=$\sigma$-subadditivity of a measure]
If $(X,\mathcal{E},\mu)$ is a measure space, then for any countable collection of measurable sets $\{A_n\}_{n\in\mathbb{N}}$ we have:
$\mu\!\left(\bigcup_{n\in\mathbb{N}}A_n\right)\leq\!\sum_{n=1}^\infty\mu(A_n).$
\end{teor}

\listoftheorems
\end{document}


Compiling it as many times as you wish, you will (or at least I do) always get the same result as without the redefinition of \thmt@mklistcmd. However, redefining \ll@<envname> (e.g. \ll@definame) does work. So apparently, whether \thmt@mklistcmd is used or not, there must be something else defining that control sequence. So:

1. Does \thmt@mklistcmd have anything to do with the appearance of the theorem list, or does it not, despite the fact it appears to?
2. What is responsible for defining \ll@<envname> for each theorem?
3. Maybe there is something redefining \ll@<envname> or \thmt@mklistcmd at a certain point beyond my redefinition?

Edit: The question is ready for closure :), since as @UlrikeFischer noted all I need to change is that the redefinition must take place after \newtheorem{defi}{Definition}[section]. Sorry for asking such a stupid question and thanks @Ulrike for your comment.

• I have no idea what exactly you are trying to change but at first I would move the redefinition before \newtheorem{teor}{Theorem}[section]. – Ulrike Fischer Jan 5 '15 at 17:06
• Whoops! That worked :). Let me edit the MWE to show the change I want. – MickG Jan 5 '15 at 17:18
• Now if the redefinition is carried out before the \newtheorem I get the desired result, i.e. "Theorem 1.0.1: σ-subadditivity of a measure" in the list instead of the default "1.0.1 Theorem (σ-subadditivity of a measure)". – MickG Jan 5 '15 at 17:21

I have no idea what exactly you are trying to change but at first I would move the redefinition before \newtheorem{teor}{Theorem}[section].
And that's all you must do. Evidently defining the theorem before redefining mklistcmd makes the theorem have the old mklistcmd whereas defining it afterwards makes it have the desired new mklistcmd.