4

I'm looking to create a theorem and definition list with thmtools's \listoftheorems for my thesis.

I have the following theorem types (grouped by style)

  • Lemma, Proposition, Corollary, Theorem
  • Definition, Algorithm, Notation
  • Example, Note

and associated theorem declarations.

When I tell \listoftheorems to only show the first group (by \listoftheorems[ignoreall, show={lemmathm, propositionthm, corollarythm, theoremthm}] (where lemmathm, etc. are the environment names), the list also includes entries for the other two groups.

The list of definitions created by \listoftheorems[ignoreall, show={definitionthm}] is correct however.

My command invocation doesn't seem to be wrong. I adapted it from the example in the thmtools documentation

Is there a known problem with multiple filters (this is what it seems like)? Can someone provide a fix or work-around?


MWE

The following MWE reproduces the error on my system. I have stripped dependencies with potential bad interaction as far as I could. — Please excuse the German. ;)

\documentclass[11pt, a4paper, twoside, openany, hidelinks]{book}

%!%!%!%!%!%!
% packages %
%!%!%!%!%!%!

%
% decoding/ encoding
% 
\usepackage[applemac]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

%
% fonts & symbols
%
\usepackage{bera}
\usepackage{amsmath}
\usepackage{amssymb}


%
% layout
%
\usepackage{amsthm, thmtools}
\usepackage{listings}

%!%!%!%!%!%!
% commands %
%!%!%!%!%!%!

%
% font commands
%
\newcommand{\berafamily}{\fontfamily{fve}\selectfont}

%%%%%%%%%%%%%%%%%%%%
% theorem commands %
%%%%%%%%%%%%%%%%%%%%

%
% Sub theorem counters.
%
\newcounter{subtheoremcounter}
\setcounter{subtheoremcounter}{0}

\declaretheoremstyle[
    spaceabove=1em, 
    spacebelow=1em, 
    headfont=\normalsize\bfseries\berafamily, 
    bodyfont=\rmfamily\normalsize,
    postheadspace=\parindent, 
    postheadhook={\hfill\newline\setcounter{subtheoremcounter}{0}},
    qed=$\square$, 
    headpunct={.}]{proof-style} 

\declaretheorem[numberwithin=chapter, style=proof-style, name=Theorem]{theoremthm}
\declaretheorem[numberlike=theoremthm, style=proof-style, name=Proposition]{propositionthm}
\declaretheorem[numberlike=theoremthm, style=proof-style, name=Lemma]{lemmathm}
\declaretheorem[numberlike=theoremthm, style=proof-style, name=Korollar]{corollarythm}

\declaretheoremstyle[
    spaceabove=1em, 
    spacebelow=1em, 
    headfont=\normalsize\bfseries\berafamily, 
    bodyfont=\rmfamily\normalsize,
    postheadspace=\parindent, 
    postheadhook={%
        \hfill\newline%
        \setcounter{subtheoremcounter}{0}},
    qed=$\blacksquare$, 
    headpunct={.}]{definition-style} 

\declaretheorem[numberlike=theoremthm, style=definition-style, name=Definition]{definitionthm}
\declaretheorem[numberlike=theoremthm, style=definition-style, name=Algorithm]{algorithmthm}
\declaretheorem[numberlike=theoremthm, style=definition-style, name=Notation]{notationthm}

\declaretheoremstyle[
    spaceabove=1em, 
    spacebelow=1em, 
    headfont=\normalsize\bfseries\berafamily, 
    bodyfont=\rmfamily\normalsize,
    postheadspace=\parindent, 
    postheadhook={\setcounter{subtheoremcounter}{0}},
    qed=$\blacksquare$]{example-style}

\declaretheorem[numberlike=theoremthm, style=example-style, name=Beispiel]{examplethm}
\declaretheorem[numberlike=theoremthm, style=example-style, name=Bemerkung]{notethm}

\makeatletter

%
% Title, date, institute, etc.
%
\title{<Titel>}
\author{<Autor>}
\date{\today}

%!%!%!%!%!%!        
% document %
%!%!%!%!%!%!
\begin{document}
\raggedbottom
%
% I. Front Matter
%
\frontmatter
%
% I.1 Title Page
%
\maketitle

%
% I.1 Inhaltsverzeichnis
% 
\tableofcontents

%
% II. Main Matter
%
\mainmatter
\addcontentsline{toc}{part}{Hauptteil}

%
% II.1
%
\chapter{Das erste Kapitel!}
\section{Der erste Abschnitt!}

\begin{definitionthm}[Definition A]%
\ldots
\end{definitionthm}

\begin{lemmathm}[Lemma 1]%
\ldots
\end{lemmathm}

\begin{notationthm}[Notation]
\ldots
\end{notationthm}

\begin{propositionthm}[Proposition 2]%
\ldots
\end{propositionthm}

\begin{notethm}
\ldots
\end{notethm}

\begin{examplethm}
\ldots
\end{examplethm}

\begin{theoremthm}[Theorem 3]%
\ldots
\end{theoremthm}

\section{Der Zweite Abschnitt!}

\begin{definitionthm}[Definition B]%
\ldots
\end{definitionthm}

\begin{definitionthm}[Definition C]%
\ldots
\end{definitionthm}

\begin{lemmathm}[Lemma 4]%
\ldots
\end{lemmathm}

\begin{lemmathm}[Lemma 5]%
\ldots
\end{lemmathm}

\begin{propositionthm}[Proposition 6]%
\ldots
\end{propositionthm}

\chapter{Das Zweite Kapitel!}
\section{Der Erste Abschnitt!}

\begin{definitionthm}[Definition D]%
\ldots
\end{definitionthm}

\begin{notethm}
\ldots
\end{notethm}

\begin{lemmathm}[Lemma 7]%
\ldots
\end{lemmathm}

\begin{examplethm}
\ldots
\end{examplethm}

\begin{theoremthm}[Theorem 8]%
\ldots
\end{theoremthm}

\begin{examplethm}
\ldots
\end{examplethm}

\begin{notationthm}[Notation]
\ldots
\end{notationthm}

%
% III. Anhang
%
\newpage
\appendix

\chapter*{Anhang}
\addcontentsline{toc}{chapter}{Anhang}

%
% IV. Verzeichnisse
%
\backmatter
%\chapter*{Verzeichnisse}
\addcontentsline{toc}{chapter}{Verzeichnisse}
%
% IV.1 Theoreme
%
\renewcommand{\listtheoremname}{Theoremverzeichnis}
\addcontentsline{toc}{section}{Theoremverzeichnis}
\listoftheorems[showall, ignore={definitionthm, notationthm, notethm, examplethm}]
%
% IV.2 Definitionen
%
\renewcommand{\listtheoremname}{Definitionsverzeichnis}
\addcontentsline{toc}{section}{Definitionsverzeichnis}
\listoftheorems[ignoreall, show={definitionthm}]
%
% IV.3 Tabellen
%
%\section*{Tabellenverzeichnis}
\addcontentsline{toc}{section}{Tabellenverzeichnis}
\listoftables
%
% IV.4 Abbildungen
%
%\section*{Abbildungsverzeichnis}
\addcontentsline{toc}{section}{Abbildungsverzeichnis}
\listoffigures

%
% IV.5 Listings
%

%
%!ref http://stackoverflow.com/a/9480618
%
\renewcommand{\lstlistlistingname}{Listingverzeichnis}
\addcontentsline{toc}{section}{Listingverzeichnis}
\lstlistoflistings


\end{document}
  • You should really get the habit of saving your files as UTF-8 rather than in MacRoman. – egreg Dec 8 '16 at 14:14
  • "You should really get the habit of saving your files as UTF-8 rather than in MacRoman. " Meaning what? – FK82 Dec 8 '16 at 14:44
  • There's no need to save files in the MacRoman encoding, which limits portability. Maximum portability is obtained by using UTF-8. Are you using TeXShop? – egreg Dec 8 '16 at 14:53
  • @egreg Yeah I'm using TeXShop. I remember that using UTF-8 with german Umlaut accents didn't work on my mac. That's why I switched to applemac input encoding. I might be wrong, though. Haven't tried to change back to UTF-8. – FK82 Dec 8 '16 at 15:01
3

You should avoid spaces in the options to show:

\listoftheorems[ignoreall, show={lemmathm,propositionthm,corollarythm,theoremthm}]

By the way, you should use \cleardoublepage before the \addcontentsline instructions.

enter image description here

Of course you should also act on the space reserved for the numbers, but this is another matter.


With your command

\listoftheorems[ignoreall, show={lemmathm, propositionthm, corollarythm, theoremthm}]

the log file contains

showing lemmathm
showing  propositionthm
showing  corollarythm
showing  theoremthm

and the additional space is considered as part of the theorem name to add.

With

\listoftheorems[ignoreall, show={lemmathm,propositionthm,corollarythm,theoremthm}]

the log file has

showing lemmathm
showing propositionthm
showing corollarythm
showing theoremthm
  • First of all thank you very much! "By the way, you should use \cleardoublepage before the \addcontentsline instructions." Why? "Of course you should also act on the space reserved for the numbers, but this is another matter." Yeah, that's a given. The styling options are limited, but I think it can be done. ; ) – FK82 Dec 8 '16 at 14:45
  • @FK82 \listoftheorems issues \cleardoublepage, so typically \addcontentsline will write out a different page number. – egreg Dec 8 '16 at 14:52

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.