As already asked here (No indentation after theorem environment with amsthm), I would like to avoid the indentation after a theorem.
The accepted answer (https://tex.stackexchange.com/a/176039) suggests adding
\AfterEndEnvironment{thm}{\noindent\ignorespaces}
to the theorem definition.
While this solution does work for me, it introduces new, undesired vertical space between two theoreoms when they are not separated by some text paragraph.
MWE:
\documentclass{scrbook}
\usepackage{amsthm}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}[chapter]
\newtheorem*{thm*}{Theorem}
\usepackage{etoolbox}
\AfterEndEnvironment{thm}{\noindent\ignorespaces}
\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}
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}
Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.
\end{document}
