Sin sangría después del entorno del teorema con amsthm

Sin sangría después del entorno del teorema con amsthm

Utilizo el paquete amsthm y no quiero que se sangren las líneas que comienzan justo después del entorno del teorema. Consulté el manual del paquete y decía definir un nuevo estilo de teorema. Esperaba que el siguiente MWE realizara esta tarea.

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

Sin embargo termino con esto. siguiente línea sin sangría

Eso es lo que esperaría (obtenido usando una sangría justo después de que finaliza el entorno del teorema)

ingrese la descripción de la imagen aquí

Respuesta1

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

ingrese la descripción de la imagen aquí

Sin embargo, esto va en contra de la intuición; la oración después de una definición (o cualquier otra estructura similar a un teorema) lógicamente comienza un nuevo párrafo, por lo que su primera línea debe tratarse como cualquier otra primera línea de un nuevo párrafo.

Respuesta2

Puedes solucionar este problema basándose en un solo tipo de teorema parcheando \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}

ingrese la descripción de la imagen aquí

La elección del estilo no influye.

Para obtener el mismo comportamiento paratodoentornos de teoremas, cambie la definición de \@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}

Otro ejemplo que muestra que esto no agrega espacio no deseado cuando dos entornos de teoremas se suceden.

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

ingrese la descripción de la imagen aquí

información relacionada