[Tex/LaTex] amsthm: how to reduce the vertical spacing between theorem and proof

amsthmspacingtheorems

I'm using the amsthm package to layout theorems and their proofs. How can I reduce the vertical spacing between the last line of the theorem statement and the first line of the proof?

BTW, I tried achieving this by fiddling with the third parameter to

\newtheoremstyle{mystyle}{4ex}{-4ex}{}{}{\bfseries}{.}{3ex}{}

…but even negative values (as illustrated above) failed to bring the first line of the proof closer than a certain fixed distance of about 2.5 line heights.

A related question: how can I prevent pagebreaks between the theorem and the proof? I would like to ensure that at least two lines from the theorem statement precede the first line of a proof on a page. (One may fairly assume that there is no text interposed between the last line of the theorem statement and the first line of the proof.)

Best Answer

One possibility would be to redefine the proof anvironment as defined in amsthm.sty (the definition uses \topsep6\p@\@plus6\p@\relax, so you could make some changes there). Another approach would be to use the front-end thmtools to define a new theorem-like structure behaving like the standard proof environment, but using the spaceabove key to control the vertical space above it. The following example illustrates this second approach and shows the different spacing for the new prf environment and the standard proof environment:

\documentclass{article} 
\usepackage{amsthm} 
\usepackage{thmtools}

\declaretheorem{theorem} 
\declaretheoremstyle[%
  spaceabove=-6pt,%
  spacebelow=6pt,%
  headfont=\normalfont\itshape,%
  postheadspace=1em,%
  qed=\qedsymbol%
]{mystyle} 
\declaretheorem[name={Proof},style=mystyle,unnumbered,
]{prf}

\begin{document} 

\begin{theorem} 
A really important result.
\end{theorem}
\begin{prf} 
And its proof with less space above.
\end{prf} 
\begin{theorem} 
A really important result.
\end{theorem}
\begin{proof} 
And its proof with too much space above.
\end{proof} 

\end{document}

enter image description here