# No indentation after theorem environment with amsthm

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)
{.5em}% Space after thm head: \newline = linebreak
\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

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

• I expect a definition to be a paragraph of its own, so the following one should be indented. – egreg May 8 '14 at 13:16
• @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 '17 at 17:29

\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}


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.

• Sorry, but this solution is wrong. – egreg Dec 5 '17 at 10:52

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)
{.5em}% Space after thm head: \newline = linebreak

\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}


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)
{.5em}% Space after thm head: \newline = linebreak

\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}


• This does not work with amsthm and thmtools loaded. – Vishal Gupta Mar 17 '18 at 14:14
• @VishalGupta I'm not at all surprised. – egreg Mar 17 '18 at 14:19
• 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. – Vishal Gupta Mar 17 '18 at 18:50
• @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 '18 at 18:59