[Tex/LaTex] Mysterious Vertical Space After Theorem/Proof Environments

amsthmspacingtheorems

I have defined my own theorem style to have 0pt above and 0pt below. For simplicity I have also set all other relevant spacings to 0pt. However, when I use a theorem or proof environment I get some mysterious white space below.

Note that I don't get any space above (so the 0pt above in \newtheoremstyle seems to be working). Can anyone tell me where the space is coming from? Here is my code:

\documentclass[11pt,a4paper]{report}

\usepackage{amsmath,amssymb,amsthm}

\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt plus 0pt minus 0pt}
\setlength{\parskip}{0pt}
\setlength{\parindent}{0pt}

\newtheoremstyle{mytheoremstyle}{0pt}{0pt}{\itshape}{}{\bf}{.}{.5em}{} 

\theoremstyle{mytheoremstyle}

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}

\begin{document}
Some normal text goes here, with a lemma immediately below.
\begin{lemma}
This is the statement of the lemma.
\end{lemma}
\begin{proof}
This is the proof of the lemma, with a mysterious space above.
\end{proof}
Some normal text goes here, with a mysterious space above. \par
The next paragraph comes immediately below.

\end{document}

Sample output

Best Answer

The proof environment resets \topsep before opening a trivlist; you can remove this setting by redefining \proof or by patching it.

\documentclass[11pt,a4paper]{report}

\usepackage{amsmath,amssymb,amsthm,xpatch}

\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt plus 0pt minus 0pt}
\setlength{\parskip}{0pt}
\setlength{\parindent}{0pt}

\newtheoremstyle{mytheoremstyle}{0pt}{0pt}{\itshape}{}{\bfseries}{.}{.5em}{} 

\theoremstyle{mytheoremstyle}

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}

\makeatletter
\xpatchcmd{\proof}{\topsep6\p@\@plus6\p@\relax}{}{}{}
\makeatother

\begin{document}
Some normal text goes here, with a lemma immediately below.
\begin{lemma}
This is the statement of the lemma.
\end{lemma}
\begin{proof}
This is the proof of the lemma, with a mysterious space above.
\end{proof}
Some normal text goes here, with a mysterious space above. \par
The next paragraph comes immediately below.

\end{document}

enter image description here

I hope this is just for studying how LaTeX works, because the output is terrible.

Please, note that \bf has been obsolete for twenty years and \bfseries should be used.