# How to reduce vertical spacing between proof environment and enumerate environment

How can I reduce the space between the proof environment head and the enumerate environment in the minimal example below?

Note: This is most likely not a duplicate question. Some while ago, I posted this problem here (How to suppress vertical space between theorem heads and enumitem environments?). A fix concerning nested enumerate environments was then provided under (Nested enumerate (enumitem) interferes with suppressing vertical space after theorem heads.). Finally, there was a follow-up flaw, corrected under Weird vertical spacing problem with (adjusted) enumerate to which I refer to here. This worked for me for quite some time, but suddenly (I have no idea why), the space is too large again. I tried to adjust the +0.3em, but that doesn't change any vertical space.

\documentclass{scrartcl}

\usepackage[american]{babel}
\usepackage{enumitem}
\usepackage{etoolbox}
\usepackage{amsthm}

\newif\ifstarttheorem

% proofs
\makeatletter% q.e.d. adjustment (posted by ???)
\renewenvironment{proof}[1][Proof]{\par
\pushQED{\qed}%
\normalfont\topsep2\p@\@plus2\p@\relax
\trivlist
\item[\hskip\labelsep
\sffamily\bfseries #1]\gdef\mycurrenvir{proof}\global\starttheoremtrue\mbox{}\hfill\\*\ignorespaces
}{%
\gdef\mycurrenvir{\relax}
\popQED\endtrivlist\@endpefalse
}
\makeatother

% suppress vertical spacing (for itemize) when newtheorems start with an environment
\makeatletter
\preto\enumerate{%
\if@inlabel
\ifstarttheorem
\mbox{}\par\nobreak\vskip\glueexpr-\parskip-\baselineskip+0.3em\relax\hrule\@height\z@
\fi
\fi
\global\starttheoremfalse
\def\tempa{proof}%
\ifx\tempa\mycurrenvir
\ifstarttheorem
\mbox{}\par\nobreak\vskip\glueexpr-\parskip-\baselineskip+0.3em\relax\hrule\@height\z@
\fi
\fi
\global\starttheoremfalse
}
\preto\endenumerate{\global\starttheoremfalse}
\makeatother

\begin{document}
Some text
\begin{proof}
\begin{enumerate}
\item Proof ...
\end{enumerate}
\end{proof}
\end{document}


Update:

The second part of Karl's answer works, surprisingly without the \appto-part. However, I realized that there is a spurious (horizontal) space/indent introduced. Minimizing this example, I ended up with the following:

\documentclass{scrartcl}

\usepackage[american]{babel}
\usepackage{amsthm}
\newif\ifstarttheorem

% proofs
% see https://tex.stackexchange.com/questions/173158/how-to-reduce-vertical-spacing-between-proof-environment-and-enumerate-environme
\makeatletter
\renewenvironment{proof}[1][Proof]{\par
\pushQED{\qed}%
\normalfont\topsep2\p@\@plus2\p@\relax
\trivlist\item[\hskip\labelsep\sffamily\bfseries #1]\ignorespaces\global\starttheoremtrue\mbox{}\vskip0pt\noindent
}{%
\popQED\endtrivlist\@endpefalse
}
\makeatother

\begin{document}
\noindent Proof with an optional argument:
\begin{proof}[Alternative]
Why is there a space before "Why"?
\end{proof}
\end{document}

• I assume you don't have an enumerate with every proof. Why not just add a \vspace{-\baselineskip} or more as the first entry inside the proof environment? – Werner Apr 24 '14 at 4:38
• See David Carlisle's answer to pluton on tex.stackexchange.com/questions/46357/… Also, modern journals can treat this automatically, so I think there must be a nice(r) solution. Furthermore, if you put the code into the journal format, you have to manually remove these spaces again -- which is why I try to keep the actual code as 'light' as possible. – Marius Hofert Apr 24 '14 at 4:42

You can simply redefine proof

in this way

\makeatletter% q.e.d. adjustment (posted by ???)
\renewenvironment{proof}[1][Proof]{\par
\pushQED{\qed}%
\normalfont\topsep2\p@\@plus2\p@\relax
\trivlist
\item[\hskip\labelsep
\sffamily\bfseries #1]\ignorespaces\mbox{}\vskip0pt\noindent
}{%
\popQED\endtrivlist\@endpefalse
}
\makeatother


and use topsep=0 when calling enumerate.

MWE

\documentclass{scrartcl}

\usepackage[american]{babel}
\usepackage{enumitem}
\usepackage{etoolbox}
\usepackage{amsthm}

% proofs
\makeatletter% q.e.d. adjustment (posted by ???)
\renewenvironment{proof}[1][Proof]{\par
\pushQED{\qed}%
\normalfont\topsep2\p@\@plus2\p@\relax
\trivlist
\item[\hskip\labelsep
\sffamily\bfseries #1]\ignorespaces\mbox{}\vskip0pt\noindent
}{%
\popQED\endtrivlist\@endpefalse
}
\makeatother

% suppress vertical spacing (for itemize) when newtheorems start with an environment

\begin{document}
Some text
\begin{proof}
\begin{enumerate}[topsep=0pt]
\item Proof ...
\end{enumerate}
\end{proof}

Some text
\begin{proof}
Some text
\end{proof}
\end{document}


Output

## EDIT

A solution without enumitem

\documentclass{scrartcl}

\usepackage[american]{babel}
\usepackage{etoolbox}
\usepackage{amsthm}

\newif\ifstarttheorem

% proofs
\makeatletter% q.e.d. adjustment (posted by ???)
\renewenvironment{proof}[1][Proof]{\par
\pushQED{\qed}%
\normalfont\topsep2\p@\@plus2\p@\relax
\trivlist
\item[\hskip\labelsep
\sffamily\bfseries #1]\ignorespaces\global\starttheoremtrue\mbox{}\vskip0pt\noindent
}{%
\popQED\endtrivlist\@endpefalse
}
\makeatother

% suppress vertical spacing (for itemize) when newtheorems start with an environment
\makeatletter
\appto\enumerate{%
\ifstarttheorem
\vspace{-.5\baselineskip}
\fi
\global\starttheoremfalse
}
\preto\endenumerate{\global\starttheoremfalse}
\makeatother

\begin{document}
Some text
\begin{proof}
\begin{enumerate}
\item Proof ...
\end{enumerate}
\end{proof}

Some text
\begin{proof}
Some text
\end{proof}
\end{document}


Output:

• Thanks, I am aware of this solution. But it is similar to Werner's suggestion. Also (although I used it), not many of my coauthors use enumitem. When they run the code with their templates, the argument topsep is not recognized. For this reason, I am looking for a solution which works with enumerate without additional arguments. – Marius Hofert Apr 24 '14 at 5:04
• @MariusHofert Why is your question tagged enumitem then? – karlkoeller Apr 24 '14 at 5:06
• Because I use enumitem (with more adjustments than in the above minimal example), just not with options in the main text. I'm sorry if this has led to confusion. I thought it is clear in which direction I'm looking due to the 'history' of the problem I mentioned. – Marius Hofert Apr 24 '14 at 5:14
• @MariusHofert If your coworkers don't have up-to-date TeX distributions, trying what you ask is hopeless; just use the standard macros for writing the document, the refinements will be done at the end. – egreg Apr 24 '14 at 7:44
• @egreg: So there is no easy fix based on the above idea (or maybe a new one)? Hmmm... that's a bit sad. I wish I would know more about the 'techniques' behind, but if you don't see a solution, then there most likely is indeed none... – Marius Hofert Apr 24 '14 at 14:19