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 would like to define a theorem environment with custom layout. In particular, I want the body of the theorem to be indented, like this

Text body. Text body. Text body.

Theorem 1 (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

More text. And even more text.

This is similar to the quote environment, I believe.

How can I do this?

Preferably, I would like to use the existing \newtheorem command, but that's not mandatory.

share|improve this question
1  
@Dilaton Oh, thanks, sounds cool. I'll join up. –  Greg Graviton Apr 3 at 19:34

4 Answers 4

up vote 8 down vote accepted

Since you would like to use the standard LaTeX theorem commands, here's a solution for that: let's insert \newline\quote into the beginning of a theorem and \endquote at the end. A complete compilable example for this:

\documentclass{article}
\makeatletter
\def\@begintheorem#1#2{\trivlist
   \item[\hskip \labelsep{\bfseries #1\ #2}]\mbox\newline\quote\itshape}
\def\@opargbegintheorem#1#2#3{\trivlist
      \item[\hskip \labelsep{\bfseries #1\ #2\ (#3)}]\mbox\newline\quote\itshape}
\def\@endtheorem{\endquote\endtrivlist}
\makeatother
\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}
More text. And even more text.
\end{document}

Output:

alt text

That's a point to start for you. You may insert additional commands of your own regarding spacing and formatting. For instance you may notice that I used \mbox before \newline to get a line break - if I write \mbox{} instead there would be more space, if I omit it there cannot be a line break at this point (or use \leavevmode). Simply writing \par instead of \newline would not work.

You may also consider to use one of these useful theorem packages:

Both offer commands for customizing theorem layouts.

share|improve this answer
1  
A variation on the theme: \usepackage{thmtools} \addtotheorempostheadhook{\leavevmode\vspace{-\baselineskip}\par\smallskip\quote‌​} \addtotheoremprefoothook{\endquote} \newtheorem{thm}{Theorem} (Bleepin' bloop, this one could do with a formatter as well...) –  Ulrich Schwarz Nov 17 '10 at 16:28
    
I checked amsthm and ntheorem, neither have easy access to what the OP wanted. ntheorem offers a way to indent the entire theorem, includeing the theorem heading, and also a way to insert a line break between the theorem heading and theorem text, but I couldn't see a way to "unindent" the theorem heading there. –  Willie Wong Nov 17 '10 at 18:59
    
In that case theorem environments of those packages could be patched in a similar way, inserting a quote environment. –  Stefan Kottwitz Nov 17 '10 at 20:15
    
Thanks a lot, works like a charm! Sometimes, however, LaTeX feels entitled to insert a page break after the \newline. Is there any way to prevent that? Hopefully, this will only be a minor issue, though. –  Greg Graviton Nov 17 '10 at 22:06
1  
@Greg: to avoid such bad page breaks I like to use the needspace package: ctan.org/pkg/needspace –  Stefan Kottwitz Nov 17 '10 at 22:21

I just did it like this (with amsthm):

\newtheoremstyle{indenteddefinition}{\topsep}{\topsep}{\hangindent=2em}{}{}{}{.5em}{}

this works only for one paragraph though. better:

\newtheoremstyle{indenteddefinition}{.5\topsep}{.5\topsep}{\addtolength{\leftskip}{2.5em}}{-2.5em}{}{}{ }{}

i realized though that this doesnt nest.

share|improve this answer
    
Thanks, this is a million times better than the @-heavy solution that got accepted! I was actually going to ask how to do it with the amsthm package when I found your answer. I'm glad I did :) –  Christian Jun 18 '12 at 21:24
    
Unfortunately this solution does not work well with lists inside it. –  RghtHndSd Jan 10 at 23:20

I've used ntheorem for my answer. You might want to look at page 7 (predefined theorem styles) of the manual.

\documentclass[a4paper]{scrartcl}
\usepackage{amssymb, amsmath} % needed for math
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf
\usepackage{ntheorem}

\theoremstyle{break}
\theoremindent20pt 
\theoremheaderfont{\normalfont\bfseries\hspace{-\theoremindent}}
\newtheorem{theorem}{Theorem}

\begin{document}
Text body. Text body. Text body.

\begin{theorem}[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{theorem}

More text. And even more text.
\end{document}

which results in

enter image description here

share|improve this answer

there is an indent parameter in the theorem environment of ams. how to change the way theorems are displayed

share|improve this answer
    
That indent parameter is for the first line, not for the theorem body. –  Stefan Kottwitz Nov 17 '10 at 15:32
    
yes, I was not sure and did not try. Thanks –  pluton Nov 17 '10 at 15:35

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.