13

I use the amsthm package and dont want lines which start right after the theorem environment to be indented. I consulted the manual of the package and it said to define a new theorem style. I expected the following MWE to accomplish this task.

\documentclass[12pt,a4paper]{scrreprt}

\usepackage{amsthm}
\newtheoremstyle{abcd}% name
  {}%      Space above, empty = `usual value'
  {}%      Space below
  {\itshape}% Body font
  {}%         Indent amount (empty = no indent, \parindent = para indent)
  {\bfseries}% Thm head font
  {.}%        Punctuation after thm head
  {.5em}% Space after thm head: \newline = linebreak
  {}%         Thm head spec
\theoremstyle{abcd}

\newtheorem{defn}{Definition}
\begin{document}
\begin{defn}
Some defintion
\end{defn}
This sentence shouldn't be indented.
\end{document}

However, I end up with this non indented next line

That is what I would expect (obtained using a noindent right after the theorem environment ends)

enter image description here

3
  • 1
    I expect a definition to be a paragraph of its own, so the following one should be indented.
    – egreg
    May 8, 2014 at 13:16
  • 2
    @egreg I think that depends on context and the document markup should decide and not the package. Maybe it varies by discipline, though.
    – cfr
    Sep 23, 2017 at 17:29
  • @egreg Often, when writing thms into the flow of the sentence ("... we use Proposition 2. ..."), a paragraph break is jarring to me. Your solution below is perfect. John D., if you are still around, consider changing the accepted answer.
    – ntessore
    Mar 7 at 9:38

2 Answers 2

17
\documentclass[12pt,a4paper]{scrreprt}
\usepackage{amsthm}
\usepackage{etoolbox}

\newtheorem{defn}{Definition}
\AfterEndEnvironment{defn}{\noindent\ignorespaces}

\begin{document}
\begin{defn}
Some definition.
\end{defn}
This sentence isn't indented.
\end{document}

enter image description here

However this goes against intuition; the sentence after a definition (or any other theorem-like structure) logically starts a new paragraph, so its first line should be treated as any other first line of a new paragraph.

2
  • 1
    Sorry, but this solution is wrong.
    – egreg
    Dec 5, 2017 at 10:52
  • This doesn't seem to work. Apr 7, 2021 at 20:37
5

You can fix this on a single theorem type basis by patching \end<name>:

\documentclass{article}

\usepackage{etoolbox}
\usepackage{amsthm}

\newtheoremstyle{abcd}% name
  {}%      Space above, empty = `usual value'
  {}%      Space below
  {\itshape}% Body font
  {}%         Indent amount (empty = no indent, \parindent = para indent)
  {\bfseries}% Thm head font
  {.}%        Punctuation after thm head
  {.5em}% Space after thm head: \newline = linebreak
  {}%         Thm head spec

\theoremstyle{abcd}
\newtheorem{defn}{Definition}

\makeatletter
\patchcmd{\enddefn}{\@endpefalse}{}{}{}
\makeatother


\begin{document}

\begin{defn}
Some definition
\end{defn}
This sentence shouldn't be indented.

\begin{defn}
Some definition
\end{defn}

This sentence should be indented.

\end{document}

enter image description here

The style choice has no influence.

In order to get the same behavior for all theorem environments, change the definition of \@endtheorem.

\documentclass{article}

\usepackage{amsthm}

\makeatletter
\def\@endtheorem{\endtrivlist}
\makeatother

\newtheoremstyle{abcd}% name
  {}%      Space above, empty = `usual value'
  {}%      Space below
  {\itshape}% Body font
  {}%         Indent amount (empty = no indent, \parindent = para indent)
  {\bfseries}% Thm head font
  {.}%        Punctuation after thm head
  {.5em}% Space after thm head: \newline = linebreak
  {}%         Thm head spec

\theoremstyle{abcd}
\newtheorem{defn}{Definition}

\begin{document}

\begin{defn}
Some definition
\end{defn}
This sentence shouldn't be indented.

\begin{defn}
Some definition
\end{defn}

This sentence should be indented.

\end{document}

Another example, showing this doesn't add unwanted space when two theorem environments follow each other.

\documentclass{scrbook}

\usepackage{amsthm}
\makeatletter
\def\@endtheorem{\endtrivlist}
\makeatother

\theoremstyle{plain}
\newtheorem{thm}{Theorem}[chapter]
\newtheorem*{thm*}{Theorem}

\begin{document}

\chapter{Chapter}

\section{Section}

Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. 

\begin{thm}
    Theorem. Theorem. Theorem. Theorem. Theorem. Theorem. Theorem. Theorem. Theorem. Theorem. 
\end{thm}
No indentation. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. 

\begin{thm}
    Theorem. Theorem. Theorem. Theorem. Theorem. Theorem. Theorem. Theorem. Theorem. Theorem. 
\end{thm}

\begin{thm}
    Theorem. Theorem. Theorem. Theorem. Theorem. Theorem. Theorem. Theorem. Theorem. Theorem. 
\end{thm}

Indentation. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. 

\end{document}

enter image description here

5
  • 1
    This does not work with amsthm and thmtools loaded. Mar 17, 2018 at 14:14
  • @VishalGupta I'm not at all surprised.
    – egreg
    Mar 17, 2018 at 14:19
  • 1
    Are you trying to say that it is well known? Is there a workaround? I do agree with your sentiment that a theorem \emph{should} be a paragraph. However, I still believe that the code should decide that not the class or environments. Mar 17, 2018 at 18:50
  • 1
    @VishalGupta I'm not surprised because I know that thmtools changes several things, in particular it doesn't use \@endtheorem. I'm not going to change this answer just to support it. If you want, you can ask a new question.
    – egreg
    Mar 17, 2018 at 18:59
  • This works so well, it should have been the default behaviour.
    – ntessore
    Mar 7 at 9:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .