7

In the following code, I define a theorem environment definition and write a figure and a definition:

\documentclass[12pt]{book}
\usepackage[francais, english]{babel}
\usepackage{amsthm}
\begin{document}

\newtheorem{definition}{Definition}

\tableofcontents
\chapter{Chapter}
\section{Section}
\begin{figure}
a
\caption{haha}
\end{figure}
\begin{definition}[title]
  body
\end{definition}

% ------------------------------------------
% List of figures
\addcontentsline{toc}{chapter}{\protect\numberline{}List of Figures}
\listoffigures
\cleardoublepage
% ------------------------------------------
% List of Definitions
\chapter*{List of Definitions}
\markboth{List of Definitions}{List of Definitions}
\addcontentsline{toc}{chapter}{\numberline{}List of Definitions}

\makeatletter
\@starttoc{lod}
\makeatother
\end{document}

The List of Figures can be correctly generated in the appendix:

enter image description here

However, the List of Definitions is empty:

enter image description here

Does anyone know what to do to make the auto-generation of the list of definitions work?

Edit 1: The solution of @egreg works fine for me in a separate file. When I adapt it to my huge tex files, I have got the following message while compilation. Could anyone help? (Sorry that I could not make the code simpler and copy here)

enter image description here

cmhughes
  • 100,947
SoftTimur
  • 19,767
  • Possibly a duplicate of http://tex.stackexchange.com/questions/74857/toc-like-list-of-definitions-using-theorem-environments – cryingshadow Jan 01 '15 at 11:12

1 Answers1

5

Use thmtools and tocbibind

\documentclass[12pt]{book}
\usepackage[T1]{fontenc}
\usepackage[french,english]{babel}

\usepackage{amsthm,thmtools}
\usepackage[nottoc]{tocbibind}

\declaretheorem[name=Theorem]{theorem}
\declaretheorem[name=Definition]{definition}

\addto\captionsenglish{%
  \renewcommand{\listtheoremname}{List of Definitions}%
}

\begin{document}

\tableofcontents
\chapter{Chapter}
\section{Section}
\begin{figure}
a
\caption{haha}
\end{figure}
\begin{definition}[title]
  body
\end{definition}

\begin{theorem}
Body
\end{theorem}

% List of figures
\listoffigures

% List of Definitions
\listoftheorems[ignoreall,show=definition]

\end{document}

TOC page

enter image description here

List of definitions page

enter image description here

egreg
  • 1,121,712
  • Thank you, that works... But if I add \listoftheorems[ignoreall,show=theorem], the title of that page is still List of Definitions... How could I specify different titles for different lists? – SoftTimur Jan 01 '15 at 11:46
  • I have got an error while adopting your solution to my tex files... Please see OP... – SoftTimur Jan 01 '15 at 11:54
  • @SoftTimur You need to use \declaretheorem for this to work, not \newtheorem – egreg Jan 01 '15 at 12:11
  • I did use \declaretheorem instead of \newtheorem... – SoftTimur Jan 01 '15 at 12:16
  • @SoftTimur Sorry, but it's impossible to say; try producing a MWE and add a new question. – egreg Jan 01 '15 at 14:42
  • Do you have any idea about my first comment (specifying different titles for different lists)? I don't think this has been addressed in the duplicate question either... – SoftTimur Jan 01 '15 at 15:02
  • 1
    @SoftTimur You have to redefine \listtheoremname before using \listoftheorems – egreg Jan 01 '15 at 15:05