5

Considering this post theorem environment with hanging indentation and Stefan's answer, I'd be interested in the same approach with ntheorem. I've been through the .sty file but I have hard time finding where the beginning and the end of the theorem environments are defined.

pluton
  • 16,421

2 Answers2

9

Here we define a theorem style quote, which is similar to the break style but uses a quote environment in addition. As example, I took the theorem example from your link.

\documentclass{article}
\usepackage{ntheorem}
\makeatletter
\newtheoremstyle{quote}%
  {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
          ##1\ ##2\theorem@separator}\hbox{\strut}}}]\quote}%
  {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
          ##1\ ##2\ (##3)\theorem@separator}\hbox{\strut}}}]\quote}
\makeatother
\theorempostwork{\endquote}
\theoremstyle{quote}
\newtheorem{thm}{Theorem}
\begin{document}
\section*{The Theorem of Pythagoras}
Text body. Text body. Text body.
\begin{thm}%[Pythagoras]
    Let $a,b,c$ the sides of a rectangular triangle.
    Without loss of generality, we assume that  $a<b<c$ .
    Then, the following equality holds:
          \[a^2 + b^2 = c^2\]
\end{thm}
\noindent More text. And even more text.
\end{document}

Theorem with indentation

Stefan Kottwitz
  • 231,401
  • Thanks. I already modified this portion of the code for other purposes but I could not guess it was possible to embed the quote environment here. – pluton Nov 12 '11 at 20:25
7

You can use the predefined commands of ntheorem to manipulate the style. In the example I uses \theoremstyle{break} do set the global style.

\theoremindent is used to set the indention of the whole environment.

theoremheaderfont is used befor every header. So I use this command to "reindent" the \theoremindent

\documentclass{article}
\usepackage{ntheorem}
\theoremstyle{break}
\theoremindent=2cm
\theoremheaderfont{\kern-1cm\normalfont\bfseries} 

\newtheorem{defi}{Definition}

\usepackage{showframe,lipsum}
\begin{document}
\begin{defi}
\lipsum[1]
\end{defi}
\end{document}
Marco Daniel
  • 95,681