# Mysterious Vertical Space After Theorem/Proof Environments

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}


• Welcome to TeX.SX! The proof environment resets \topsep. Mar 11, 2015 at 23:41

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}


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.

• Oh, thanks! I'm surprised I couldn't find the answer on the internet already; sorry. And yes, I am new to LaTeX - I've been adapting a template sent to me from my supervisor which probably explains the obsolete command. Out of interest, what else is terrible about the output? It's only a test file and obviously the spacing is dodgy. Mar 11, 2015 at 23:53
• @TomOffer Spaces added before and after theorem and proofs are for the reader, who can better identify them when skimming through the pages. Mar 11, 2015 at 23:55
• Yes, I know that! As I said, I set all the spacings to 0pt above so my problem could easily be seen. The patch works in my test file but not in my actual document... is there an obvious reason why that might be? Mar 11, 2015 at 23:59
• It seems that I get a \parskip and a \topsep before and after the proof environment. How can I patch it to ignore one of them? Mar 12, 2015 at 0:15
• @TomOffer \parskip is always inserted by TeX as soon as a paragraph starts. The trivlist used by proof inserts \topsep before and after it. Mar 12, 2015 at 0:33