0

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:

enter image description here

\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}
egreg
  • 1,121,712

1 Answers1

0

\noindent starts a new paragraph. This is imho the wrong way to suppress the identation. I would either use like lists \@doendpe, which suppress the identation only if there is no empty line after the environment, or like \section \setbox\z@\lastbox at the next par.

\documentclass{scrbook}

\usepackage{amsthm}

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

\usepackage{etoolbox}
\makeatletter
%\AfterEndEnvironment{thm}{\@doendpe}
\AfterEndEnvironment{thm}{\everypar{\setbox\z@\lastbox\everypar{}}}
\makeatother

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

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}
Ulrike Fischer
  • 327,261
  • Thank you for the answer, I really like the 'lazy option' which always removes the indentation, regardless of the existence of an empty line. –  Dec 05 '17 at 11:15