# A theoremstyle with complete indentation using amsthm

I want to define a theoremstyle using amsthm, such that the complete environments content produced by \newtheorem with this style are indented.

The following standalone example uses an adapted version of a suggestion posted in theorem-environment-with-hanging-indentation:

\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[english]{babel}
\usepackage{blindtext}

\theoremstyle{indented}
\newtheorem{definition}{Definition}

\begin{document}
\blindtext
\begin{definition}[test]
some text
\begin{enumerate}
\item an item
\item another item
\end{enumerate}
more text.
\end{definition}
\blindtext
\end{document}


which will produce a result like this:

The question at hand is of course, how can an indentation be realized, such that lists will be indented too. Would it for instance be advisable, to format the whole environment as a list? If so, how?

I would prefer to keep the definition as simple as possible, without for instance redefining amsthm commands.

-

Your code can be made to work by modifying both \@totalleftmargin (which controls nested list indentation) and \linewidth as well as issuing a \parshape to take these changes into consideration:

\documentclass{article}
%\documentclass[fleqn]{article}

\usepackage{amsthm}

\newcommand{\Blabla}{Bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla.}

\makeatletter
\newtheoremstyle{indented}
{3pt}% space before
{3pt}% space after
\parshape 1 3.5em \linewidth}% body font
{}% indent
{.}% punctuation
{}% header specification (empty for default)
\makeatother

\theoremstyle{indented}
\newtheorem{definition}{Definition}

\begin{document}

\Blabla
\begin{definition}
\Blabla
\begin{enumerate}
\item \Blabla
\item \Blabla
\end{enumerate}
\Blabla
$A=B$
\Blabla
\end{definition}
\Blabla

\end{document}

-
This approach does not affect the equation environment. This may be problematic if you also want to increase the indentation of equations with the fleqn option in the book class for instance. –  pluton Oct 29 '13 at 3:18
\addtolength{\mathindent}{2.5em} shall also be added then –  pluton Oct 29 '13 at 3:38
@pluton: thanks for spotting this. A better solution is to use \parshape 1 3.5em \linewidth which will work correctly whether or not the fleqn option is used. This will also take care of the problem mentioned in tex.stackexchange.com/q/116379. –  Philippe Goutet Oct 29 '13 at 12:51

I think that all theorem-like environments should be treated in the same way, so a solution can be to use list instead of trivlist in the definitions, thus making it possible to use \leftmargin:

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@thm}{\trivlist}{\list{}{\leftmargin=2.5em}}{}{}
\patchcmd{\@endtheorem}{\endtrivlist}{\endlist}{}{}
\makeatother


Now statements such as

\newtheoremstyle{indentedupright}
{3pt}
{3pt}
{}
{}
{\bfseries}
{.}
{.5em}
{}


for definitions and

\newtheoremstyle{indenteditalic}
{3pt}
{3pt}
{\itshape}
{}
{\bfseries}
{.}
{.5em}
{}


for theorems will do.

Here's an extended version that allows to have different indentations for the various theorem-like environments:

\documentclass{amsbook}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[english]{babel}
\usepackage{blindtext}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\@thm}{\trivlist}{\list{}{\leftmargin=\thm@margin}}{}{}
\patchcmd{\@endtheorem}{\endtrivlist}{\endlist}{}{}
\newlength{\thm@margin}
\newcommand{\xnewtheorem}[2][0pt]{%
\newenvironment{#2}{\thm@margin=#1 \begin{#2INNER}}{\end{#2INNER}}%
\newtheorem{#2INNER}%
}

\makeatother

\newtheoremstyle{indentedupright}
{3pt}
{3pt}
{}
{}
{\bfseries}
{.}
{.5em}
{}
\newtheoremstyle{indenteditalic}
{3pt}
{3pt}
{\itshape}
{}
{\bfseries}
{.}
{.5em}
{}

\theoremstyle{indenteditalic}
\xnewtheorem{theorem}{Theorem}

\theoremstyle{indentedupright}
\xnewtheorem[2.5em]{definition}{Definition}

\begin{document}
\blindtext
\begin{definition}[Companion and cut-off event]
\label{def:cutoff}
Let $\beta$ be a branching process and let $\prec$ be an adequate partial order on the
configurations of $\beta$. An event $e$ is a \emph{cut-off event} (with respect to $\prec$)
if $\beta$ contains a local configuration $[e']$ such that
\begin{enumerate}
\item $Mark(e) = Mark(e')$, and \label{def:cutoff-markequal}
\item $[e'] \prec [e]$ \label{def:cutoff-smaller}
\end{enumerate}
Another way to express the condition \ref{def:cutoff-markequal} is $e' \in [e]_{Mark}$. The
event $e'$ is called \emph{companion} of $e$, if in addition it is minimal in $[e]_{Mark}$
with respect to $\prec$. Moreover, if $\prec$ is total, then the companion of a cut-off
event $e$ is uniquely defined and is denoted by $e_{\mathfrak{c}}$.
\end{definition}
\blindtext
\begin{theorem}
This is the statement of an important theorem; however we don't want to have an indentation
for this kind of statement.
\end{theorem}
\end{document}


Note that if a new theorem must share a counter with another, the syntax should be like

\xnewtheorem{prop}[theoremINNER]{Proposition}


(with or without the optional argument for the indentation).

-

How about using the changepage package with adjustwidth option as shown below:

\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{changepage}
\newtheoremstyle{indented}{3pt}{3pt}{}{}{\bfseries}{.}{.5em}{}
%
\theoremstyle{indented}
\newtheorem{definition}{Definition}

\begin{document}
\blindtext
\begin{definition}[test]
some text
\begin{enumerate}
\item an item
\item another item
\end{enumerate}
more text.
\end{definition}

Note that the above can be made into a \newcommand or a \newenvironment as you please.