1

I would like to have formatting of theorem environment (and only this environment) with indentation, like this

enter image description here

It is exactly the same question as Theorem environment with hanging indentation

The solutions from there do not want to work well in amsart document class which I am working with.

I have a simple solution

\documentclass{amsart}

\makeatletter
\def\th@fancyindent{
    \itshape
    \addtolength{\leftskip}{2.5em} %indentation here
}
\makeatother

\newtheorem{defi}{Definition}
\theoremstyle{fancyindent}
\newtheorem{thm}{Theorem}

\begin{document}
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.
\begin{defi}  
Everything is normal here, no indentation whatsoever. Everything is normal here, no indentation whatsoever. 
\end{defi}
\end{document}

But it is not exactly what I am going for, since it indents the word Theorem too. How can I make my desired indented formatting starting with the Theorem on top with no indent?

4
  • Does putting \noindent in front of the header formatting work? – Davislor Jul 15 '20 at 21:28
  • What do you mean? Where would you put it? In body of the document it does not work. – MRH Jul 15 '20 at 22:02
  • In the theorem style, before the commands to format the header. E.g., \noindent\bfseries? – Davislor Jul 15 '20 at 22:04
  • @Davislor No, putting \noindent in theoremstyle does not work. – MRH Jul 16 '20 at 13:52
3

A simple modification of https://tex.stackexchange.com/a/106582/4427

\documentclass[a4paper]{scrartcl}
\usepackage{amsthm,thmtools}
\usepackage{etoolbox}
\usepackage{lipsum}
\usepackage{showframe}

\declaretheoremstyle[
  headfont=\kern-2.5em\bfseries,
  bodyfont=\itshape,
  headindent=0pt,
  headpunct=\newline,
]{INDENTthm}
\declaretheoremstyle[
  headfont=\bfseries,
  bodyfont=\itshape,
  headindent=0pt,
  headpunct={},
]{NOINDENTthm}

\declaretheorem[
  within=section,
  style=INDENTthm,
  name=Theorem
]{theorem}

\makeatletter
\AtBeginEnvironment{theorem}{%
  \patchcmd\@thm
    {\trivlist}
    {\list{}{\leftmargin2.5em\itemindent-15em}}
    {}{}%
}
\makeatother

\declaretheorem[
  style=NOINDENTthm,
  name=Definition
]{definition}

\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.
\begin{definition}
Everything is normal here, no indentation whatsoever. Everything is 
normal here, no indentation whatsoever. 
\end{definition}

\end{document}

H

7
  • It looks promising but for now I cannot avoid changes to definition environment (definitions became indented) unless I redefine it (not good). – MRH Jul 15 '20 at 23:01
  • Another quirk is that when you change documentclass from scrartcl to amsart indents in new paragraphs in a theorem appear (which I don't want to have either). – MRH Jul 15 '20 at 23:16
  • @Maria The indent after theorems is a precise choice by the AMS. I don’t see why theorems should be indented and definitions not; anyway, you can look at the linked answer for how to do it. – egreg Jul 16 '20 at 7:19
  • This comment is misleading in many ways. You can adjust indent at beginning of new paragraphs globally (inside and outside theorem enviroments uniformly) in amsart class by setting \setlength{\parindent}{0em} to whatever value you please. I was also speaking of "new paragraphs in a theorem" anyways, which is exactly why the solution you linked is worrisome: it breaks this global behavior. As noted earlier it gives rise also to other problems which is obvious after some simple modifications. – MRH Jul 16 '20 at 13:45
  • @Maria Sorry, but I can't understand what you're meaning. Where do you not want indents? – egreg Jul 16 '20 at 14:03
0

I am posting this answer for future reference (because I am not an advanced LaTeX user and did not know of existence of amsthm package before).

This solution uses amsthm package and works nicely in amsart as well as when changing to other standard document class. It adjusts to global rules of indentation and does not break existing theorem styles.

\documentclass{amsart}
\usepackage{amsthm}

\newtheoremstyle{fancyindent}               % name of theoremstyle
{.5\baselineskip±.2\baselineskip}           % Space above, these are standard values for AMS class document
{.5\baselineskip±.2\baselineskip}           % Space below
{\itshape\addtolength{\leftskip}{15mm}\setlength{\parindent}{0em}}      % Body font +indent added +no indent between paragraphs
{-15mm}                                     % Indent of header amount
{\bfseries}                                 % Theorem head font
{\newline}                                  % Punctuation after theorem head and start at new line
{.5em}                                      % Space after theorem head
{\thmname{#1}\thmnumber{ #2}. \thmnote{[#3]}}% Theorem head spec (can be left empty, meaning ‘normal’)

\newtheoremstyle{fancyindentwithindents}    % name of theoremstyle
{.5\baselineskip±.2\baselineskip}           % Space above, these are standard values for AMS class document
{.5\baselineskip±.2\baselineskip}           % Space below
{\itshape\addtolength{\leftskip}{15mm}}     % Body font +indent added
{-15mm}                                     % Indent of header amount
{\bfseries}                                 % Theorem head font
{}                                          % Punctuation after theorem head
{.5em}                                      % Space after theorem head
{\thmname{#1}\thmnumber{ #2}. \thmnote{[#3]}}% Theorem head spec (can be left empty, meaning ‘normal’)

\newtheorem{defi}{Definition}

\theoremstyle{fancyindent}
\newtheorem{thm}{Theorem}

\theoremstyle{fancyindentwithindents}
\newtheorem{thmind}{Theorem}

%\setlength{\parindent}{0em}

Now in the body of document you will produce a following outcome: enter image description here

Details can be found here: http://www.ams.org/arc/tex/amscls/amsthdoc.pdf

Drawback is that it indeed does not work well with enumerate, to fix this one needs to follow advice here: A theoremstyle with complete indentation using amsthm . For instance the solution of Philippe Goutet works well with indenting enumerate

\makeatletter
\newtheoremstyle{indentedenumerate} % name of theoremstyle
{.5\baselineskip±.2\baselineskip}           % Space above, these are standard values for AMS class document
{.5\baselineskip±.2\baselineskip}           % Space below
{\itshape\addtolength{\@totalleftmargin}{15mm}
   \addtolength{\linewidth}{-15mm}
   \parshape 1 15mm \linewidth}             % Body font +indent added +will work well with enumerate! (you need to add makeatletter)
{-15mm}                                     % Indent of header amount
{\bfseries}                                 % Theorem head font
{}                                          % Punctuation after theorem head
{.5em}                                      % Space after theorem head
{\thmname{#1}\thmnumber{ #2}. \thmnote{[#3]}}% Theorem head spec (can be left empty, meaning ‘normal’)
\makeatother

but in amsart fails to indent equations (sic!).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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