[Tex/LaTex] A theoremstyle with complete indentation using amsthm

amsthmindentationtheorems

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}
\newtheoremstyle{indented}{3pt}{3pt}{\addtolength{\leftskip}{2.5em}}{}{\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}
  \blindtext
\end{document}

which will produce a result like this:
result

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.

Best Answer

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:

result of the code

\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
  {\addtolength{\@totalleftmargin}{3.5em}
   \addtolength{\linewidth}{-3.5em}
   \parshape 1 3.5em \linewidth}% body font
  {}% indent
  {\bfseries}% header font
  {.}% punctuation
  {.5em}% after theorem header
  {}% 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}