[Tex/LaTex] Inconsistent spacing with parskip option of KOMA script and amsthm

amsthmkoma-scriptparskip

This problem is similar to Question 25346, however the proposed solution does not solve my problem.

\documentclass[parskip=full]{scrreprt}

\usepackage{amsmath, amsthm}

\theoremstyle{definition}
\newtheorem{definition}{Definition}[chapter]

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

\begin{definition} 
In luctus mattis felis ac tristique.
\end{definition}

Nunc vulputate lectus at eros vehicula.

Aliquam fermentum eu justo in lobortis. 
\end{document}

produces inconsistent spacing:


enter image description here


Adding

\begingroup
    \makeatletter
    \@for\theoremstyle:=definition,remark,plain\do{%
        \expandafter\g@addto@macro\csname th@\theoremstyle\endcsname{%
            \addtolength\thm@preskip\parskip
            }%
        }
\endgroup

to the preamble, as suggested in Question 25346 produces


enter image description here


but this space is now significantly bigger than the paragraph skip. I would like the the text-to-theorem-skip be identical in size to the parskip. Thanks!

Best Answer

Your code results in essentially two \parskips before and after the definition. Before the theorem you can set the spacing to \parskip by using \setlength rather than \addtolength in the adjustment of \thm@preskip. For after the theorem the relevant quantity is \thm@postskip, but this needs to be put to zero, as there comes a \parskip anyway:

Sample output

\documentclass[parskip=full]{scrreprt}

\usepackage{amsmath, amsthm}

\begingroup
    \makeatletter
    \@for\theoremstyle:=definition,remark,plain\do{%
        \expandafter\g@addto@macro\csname th@\theoremstyle\endcsname{%
            \setlength\thm@preskip\parskip
            \setlength\thm@postskip{0pt}
            }%
        }
\endgroup

\theoremstyle{definition}
\newtheorem{definition}{Definition}[chapter]

\begin{document}
\show\definition

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

\begin{definition} 
In luctus mattis felis ac tristique.
\end{definition}

Nunc vulputate lectus at eros vehicula.

Aliquam fermentum eu justo in lobortis. 

\end{document}