[Tex/LaTex] Remove vertical space around theorems

amsthmspacingtheorems

I'm very new to LaTeX (a couple of days ago I didn't know how to use \newtheorem) and was hoping someone could help me with the following problem.

If I'm using \usepackage{amsthm}, how do I obtain control over the vertical gap between Theorems, Propositions etc and their respective proofs? In particular, I am looking for the proof to follow on like a normal line. This is the best I have come up with so far:

\usepackage{amthm}

\newtheoremstyle{newstyle}      
{} %Aboveskip 
{-.25pt} %Below skip
{\mdseries} %Body font e.g.\mdseries,\bfseries,\scshape,\itshape
{} %Indent
{\bfseries} %Head font e.g.\bfseries,\scshape,\itshape
{.} %Punctuation afer theorem header
{ } %Space after theorem header
{} %Heading

\theoremstyle{newstyle}
\newtheorem{thm}{Theorem}[section]
\newtheorem{prop}{Proposition}[thm]
\newtheorem{lem}{Lemma}
\newtheorem{cor}{Corollary}

\newenvironment{pf}
{\n\textit{Proof.}\begin{mdseries}}
{\end{mdseries}}\

However, I have two main problems with it. Firstly, the %Below skip doesn't seem to give me much control – there's a pretty substantial jump between {} and when I type any negative value in. Secondly, the numbering is mucked up e.g. if I was to type \begin{thm}...\end{thm} and then \begin{prop}...\end{prop} (in section 1 say) I would get as my out put:

Theorem 1.1
Proposition 1.1.1

Thanks for any help.

Best Answer

Firstly, below skip should be positive, negative values are ignored. You can clear the spacing provided as standard by writing

\makeatletter
\def\thm@space@setup{\thm@preskip=0pt
\thm@postskip=0pt}
\makeatother

before your \newtheoremstyle. You can adjust this by changing the values 0pt or using the parameters in the \newtheoremstyle.

Try

\newenvironment{pf}{\noindent\textit{Proof.}\begin{mdseries}}{\end{mdseries}}

for your proof environment. If this is too simplistic, e.g. if you wish to have the \qed features of the AMS environment, then you can use the following adaption of the AMS proof code

\makeatletter
\newenvironment{pf}[1][\proofname]{\par
  \pushQED{\qed}%
  \normalfont \topsep0\p@\relax
  \trivlist
  \item[\hskip\labelsep\itshape
  #1\@addpunct{.}]\ignorespaces
}{%
  \popQED\endtrivlist\@endpefalse
}
\makeatother

The important point is setting the value of \topsep to zero.

Lastly, the proposition number is wrong because you have asked it to be numbered within thms! You should write

\newtheorem{prop}[thm]{Proposition}

with [thm] placed between the other arugments not at the end.

Here is this all put in to one sample document.

\documentclass{article}

\usepackage{amsthm}

\makeatletter
\def\thm@space@setup{\thm@preskip=0pt
\thm@postskip=0pt}
\makeatother
\newtheoremstyle{newstyle}      
{} %Aboveskip 
{} %Below skip
{\mdseries} %Body font e.g.\mdseries,\bfseries,\scshape,\itshape
{} %Indent
{\bfseries} %Head font e.g.\bfseries,\scshape,\itshape
{.} %Punctuation afer theorem header
{ } %Space after theorem header
{} %Heading

\theoremstyle{newstyle}
\newtheorem{thm}{Theorem}[section]
\newtheorem{prop}[thm]{Proposition}
\newtheorem{lem}{Lemma}
\newtheorem{cor}{Corollary}

\makeatletter
\newenvironment{pf}[1][\proofname]{\par
  \pushQED{\qed}%
  \normalfont \topsep0\p@\relax
  \trivlist
  \item[\hskip\labelsep\itshape
  #1\@addpunct{.}]\ignorespaces
}{%
  \popQED\endtrivlist\@endpefalse
}
\makeatother

\begin{document}
Some text to indicate the spacing.

\begin{thm}
  First theorem, with sufficiently long text so that it spills on to a
  second line.
\end{thm}

Some text to indicate the spacing.  Fill-up text make this spill on to
an extra line.  Fill-up text make this spill on to an extra line.

More text.

\begin{prop}
  A proposition, with sufficiently long text so that it spills on to a
  second line.
\end{prop}

\begin{pf}
  Proof of the proposition with \verb+pf+ environment and sufficiently
  long text so that it spills on to a second line.
\end{pf}

\begin{prop}
  Another proposition, with sufficiently long text so that it spills
  on to a second line.
\end{prop}

\begin{proof}
  The original proof environment and sufficiently long text so that it
  spills on to a second line.
\end{proof}

\end{document}

Sample output