Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

up vote 7 down vote accepted

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}
share|improve this answer
    
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
1  
\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).

share|improve this answer

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{adjustwidth}{20pt}{20pt}
  \begin{definition}[test]
    some text
    \begin{enumerate}
      \item an item
      \item another item
    \end{enumerate}
    more text.
  \end{definition}
  \end{adjustwidth}
  \blindtext
\end{document}

enter image description here

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

share|improve this answer
    
The problem with this solution is that it introduces a spurious white line before the definition. –  Philippe Goutet Aug 16 '12 at 5:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.