[Tex/LaTex] Theorem environment with hanging indentation

indentationtheorems

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.

Best Answer

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.

Related Question