[Tex/LaTex] Wrong spacing before theorem environment (amsthm)

amsthmline-spacingsetspacetheorems

I am using the amsthm package to have environment.
I also use \usepackage[onehalfspacing]{setspace} to have 1.5 line spacing.

However, when I use the the theorem environment, the spacing before is not done correctly. It gives me a normal line spacing instead of the 1.5-line spacing.
Lets say I have:

First paragraph

Second paragraph

Third paragraph

\begin{theorem} Bla bla. \end{theorem}

I get something like this:

First paragraph

Second paragraph

Third paragraph
Theorem 1. Bla bla.

Do you know how I can change this?

Best Answer

I actually found out the answer to my question by going the ECM route.

What was causing the problem was that I was using the parskip package with the option parfill, so that paragraphs, instead of starting with a blank indent, would start with no indent but separated by a blank line. ECM:

\documentclass{article}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem} % <-- Note this line?
\usepackage[onehalfspacing]{setspace}
\usepackage[parfill]{parskip}
\begin{document}
First paragraph

Second paragraph

Third paragraph
\begin{theorem}
  1+1=2
\end{theorem}

\end{document}

I found out that I wasn't the first one to have the problem. The solution is to add:

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

in the preamble after calling the amsthm package. It will redefine the theorems environment (or any user-defined environment) by adding the warranted extra space at the beginning. The extra space is not hard-coded , so if you remove the parskip package from your preamble, everything returns to the default spacing: nice!

Hope this helps!