9

I am using the amsthm package. I defined some enviroments like

\theoremstyle{plain}
\newtheorem{theo}[subsection]{Theorem}
\newtheorem{satz}[subsection]{Satz}

the numbering works as expected, counting the theorems as if they where subsections. However I also want them to appear in the table of contents as if they were subsections.

UPDATE

To be more precise, say I have the following document:

\begin{document}
\tableofcontents

\chapter{Chapter One}

\section{Section A}
\begin{theo}[First Theorem]
Whatever.
\end{theo}

\section{Section B}
\begin{theo}[Second Theorem]
Whatever.
\end{theo}

\chapter{Chapter Two}

\section{Section A} 
\begin{theo}[Third Theorem]
Whatever.
\end{theo}

\begin{theo}[Fourth Theorem]
Whatever.
\end{theo}
\end{document}

I want my table of contents to look like this

1. Chapter One
    1.1 Section A
        1.1.1 First Theorem
    1.2 Section B
        1.2.1 Second Theorem
2. Chapter Two
    2.1 Section A
        2.1.1 Third Theorem
        2.1.2 Fourth Theorem
5
  • Do you want the theorem headers themselves to subsections (in which case they'll automatically show up in the table of contents at the subsection level), or do you just want to be able to create a list of all theorems and theorem-like environments for the table of contents, with all theorems numbered the way they are in the body of the document? Please elaborate.
    – Mico
    Jun 22 '12 at 18:30
  • @Mico: I have added an example of how I want it.
    – Haatschii
    Jun 22 '12 at 18:41
  • In that case, why not just (i) issue commands such as \subsubsection{First Theorem} through \subsubsection{Fourth Theorem} and (ii) surround each theorem's actual expression with {\em and }?
    – Mico
    Jun 22 '12 at 18:47
  • Here is another solution: golatex.de/…
    – bodo
    Jun 22 '12 at 19:05
  • 2
    this is the first time i remember seeing a request that theorems be listed in the toc. i have seen theorems entered as (sub)sections, with the text set as `\emph{...}. Jun 22 '12 at 19:17
5

You can incorporate the writing in the .toc file by defining an auxiliary environment; I use xparse because it makes easy to cope with the presence of an optional argument.

\documentclass{article}

\usepackage{amsthm,xparse}

\usepackage{lipsum}

\theoremstyle{plain}
\newtheorem{theoaux}[subsection]{Theorem}

\NewDocumentEnvironment{theo}{o}
 {\IfNoValueTF{#1}
   {\theoaux\addcontentsline{toc}{subsection}{\protect\numberline{\thesubsection}Theorem}}
   {\theoaux[#1]\addcontentsline{toc}{subsection}{\protect\numberline{\thesubsection}Theorem (#1)}}%
   \ignorespaces}
 {\endtheoaux}

\begin{document}

\tableofcontents

\section{A section}

\lipsum[1]

\subsection{A subsection}

\lipsum[2]

\subsection{A subsection}

\lipsum[3-4]

\begin{theo}\label{theo1}
$0=0$
\end{theo}

\section{Sec 2}

\lipsum[4]

\begin{theo}[B. C. Dull]\label{theo2}
$1>0$
\end{theo}

\end{document}
2

Try this:

\documentclass{report}

\usepackage{amsthm}

\theoremstyle{plain}
\newtheorem{theo}[subsection]{Theorem}
\newtheorem{satz}[subsection]{Satz}

\newcommand{\counttosubsec}{\arabic{chapter}.\arabic{section}.\arabic{subsection}}
\newcommand{\addtheocontentsline}[1]{\addcontentsline{toc}{subsection}{\counttosubsec \quad Theorem~\ref{#1}}}
\newcommand{\addsatzcontentsline}[1]{\addcontentsline{toc}{subsection}{\counttosubsec \quad Satz~\ref{#1}}}

\begin{document}

\tableofcontents
\clearpage

\section{Sec 1}

\addtheocontentsline{theo1}
\begin{theo}\label{theo1}
Something
\end{theo}

\section{Sec 2}

\addsatzcontentsline{satz1}
\begin{satz}\label{satz1}
Something else
\end{satz}

\end{document}
2
  • Thanks, this could be a work around. However I think there should be a better way, that does not require me to add one extra line before each theorem? :( Another big drawback is, that the names of the theorems will not show up in the TOC...
    – Haatschii
    Jun 22 '12 at 18:51
  • @Haatschii I've edited my answer to give the formatting that you want and to simplify the "extra line" before each theorem, but this approach still needs the extra line. Jun 22 '12 at 19:39
0

I've just figured out a solution which satisfies my needs regarding this problem (which were not satisfied by either of the previous answers here).

This requires the amsmath package, but not much else. In the preamble, we define a new theorem style which, when it is invoked with an optional note (or name), it adds a line with the name of the theorem to the table of contents. This way, only the most important results -- those worthy of being named -- actually end up in your table of contents.

\newtheoremstyle{mythmstyle}%
    {}%
    {}%
    {\it}%
    {}%
    {\bf}%
    {}%
    { }%
    {\thmname{#1}\thmnumber{ #2}%
    \thmnote{: #3\addcontentsline{toc}{subsubsection}{{\it#1}: #3}}. }
\theoremstyle{mythmstyle}
\newtheorem{theorem}{Theorem}

Then in the body, we write something like

\begin{theorem}
A finite group is a $p$-group if and only if $\abs{G} = p^n$ for
some integer $n \ge 1$.
\end{theorem}
...
\begin{theorem}[Sylow Theorem, First]
Suppose that $\abs{G} = p^n m$, $p \nmid m$. Then 
for each $1 \le i \le n$, $G$ has a subgroup $H_i$ of order $i$.
Moreover, these form a chain of normal subgroups, so that
\[ H_1 \unlhd H_2 \unlhd H_3 \unlhd \cdots \unlhd H_{n-1} \unlhd H_n \]
\end{theorem}

Doing so, with a table of contents earlier in the document, yields something vaguely like that below:

Example of a glorious theorem-filled table of contents

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.