# Indentation inside theorem environment

I'm trying to get a theorem-derived environment to indent the entire block of text. What I have is

\theoremstyle{aside}
\newtheorem{asides}{Aside}[chapter]
\NewDocumentEnvironment{aside}{m o}
\IfNoValueTF{#2}
\ignorespaces
}
{\endasides}


where you type \begin{aside}{label}[Title] and it puts it into the TOC based on a discussion here: AMS theorems in table of contents

The whole {aside} block should indent. However, what's happening is that only the header indents and nothing else. (When I try to adjust the indent in the {aside} environment style, the same thing happens}.

• You have put \end{adjustwidth} in the begin code for the aside environment, ie. before the body starts. This means that in the body the normal indentation is restored, just as you observe. I think the \end{adjustwidth} must be put in the end code, i.e. just before \endasides. I haven't tested it, though. – Piet van Oostrum Nov 25 '16 at 23:28
• If I swap the } with the \endadjustwidth (} \end{adjustwidth} {\endasides}), I end up with the error Extra \endgroup. \end{adjustwidth – Necarion Nov 26 '16 at 21:32
• That's not what I meant. ...\ignorespaces} {\end{adjustwidth}\endasides} instead. – Piet van Oostrum Nov 26 '16 at 22:34

You're placing wrongly \end{adjustwidth}.

\documentclass{report}
\usepackage{xparse}
\usepackage{chngpage}
\usepackage{amsthm}

\usepackage{lipsum}

% guess
#3 \protect\ref{#2}%
\IfValueT{#1}{ (#1)}%
}%
}

%\theoremstyle{aside} % no idea what this should be
\newtheorem{asides}{Aside}[chapter]
\NewDocumentEnvironment{aside}{mo}
{%
\IfNoValueTF{#2}
\label{#1}%
}
{%
\endasides
}

\begin{document}

\tableofcontents

\chapter{First}

\lipsum[2]

\begin{aside}{foo}[Whatever]
\lipsum[3]
\end{aside}

\lipsum[4]

\end{document}


I had to guess a definition for \addtheocontentsline.

Here is how one could do it very easily with the ntheorem package:

\theoremstyle{plain}

The package defines a customisable \listtheorems command, analog of \listoffigures, except the heading has to be defined.
• I actually want the aside entries to go in the main ToC rather than in a custom secondary list. – Necarion Nov 26 '16 at 21:34