Generating lists of custom environment.
There are several package you can use for this purpose:
caption using
\DeclareCaptionType
float and its commands
\newfloat
and\listof
floatrow and
\DeclareNewFloatType
tocloft, a comprehensive package for customizing such lists, providing
\newlistof
and related commands
If you follow these links, you can find the documentation. Just look for the mentioned commands. Check out further features which may help deciding which package you might use.
The package thmtools by U. Schwarz is what you need:
\usepackage{thmtools}
\renewcommand{\listoftheoremname}{List of examples}
...
\begin{document}
...
\listoftheorems[ignoreall,show={example}]
For a footnote in a theorem label, you can do with the usual trick of \footnotemark
and \footnotetext
, but another trick is needed in order to avoid the footnote mark in the list of theorems:
\usepackage{thmtools}
\declaretheorem[name=Example]{example}
\renewcommand{\listoftheoremname}{List of examples}
...
\begin{document}
...
\begingroup
\let\footnotemark\relax
\listoftheorems[ignoreall,show={example}]
\endgroup
...
\begin{example}[name=Nice example\protect\footnotemark]
\footnotetext{Due to E. X. Ample}%
This is a very nice example
\end{example}
You don't want the footnote mark in the list, do you? :)
--- Additional formatting ---
The macro responsible for writing the entry in the loe
file that is read for typesetting the list of examples is \ll@example
. You can obtain a list showing only the names of the example by saying, just after the relevant \declaretheorem
\makeatletter
\def\ll@example{%
\protect\numberline{\csname the\thmt@envname\endcsname}%
\ifx\@empty\thmt@shortoptarg
\thmt@thmname
\else
\thmt@shortoptarg
\fi}
\makeatother
Why don't you use float
as already suggested?
It's similar to figures and tables and well documented:
Add this before \begin{document}
:
\usepackage{float}
\floatstyle{plain}
\newfloat{example}{thp}{loc}[chapter]
\floatname{example}{Example}
Add this to where you want the list:
\listof{example}{List of examples}
Add this if you also want this in your tableofcontents:
\addcontentsline{toc}{chapter}{List of examples}
And of course define a small example:
\begin{example}
This is a small example.
\caption[Small example]{Small example - you can add links and other stuff here}
\label{example:foo}
\end{example}
And reference it:
As you can see in Example \ref{example:foo}, ...
Full documentation of float