# Vertical spacing around theorem environment

\documentclass[danish]{article}

\usepackage{babel}
\usepackage{color}
\usepackage{amsthm,thmtools}

% Colors.
\definecolor{section_color}{rgb}{0.35,0.0,0}
\definecolor{MyGray}{rgb}{0.96,0.97,0.98}

% Defining common style.
\declaretheoremstyle[
spaceabove = 6pt,
spacebelow = 6pt,
notefont = \mdseries,
notebraces = {(}{)},
bodyfont = \normalfont,
qed = ,
]{mystyle}

% Defining theorem environment.
\declaretheorem[
style = mystyle,
name = S{\ae}tning,
bgcolor = MyGray,
textwidth = 0.98\textwidth
}
]{theorem}

% Defining claim environment.
\declaretheorem[
sibling = theorem,
style = mystyle,
bgcolor = MyGray,
textwidth = 0.98\textwidth
}
]{claim}

\makeatletter
\renewenvironment{proof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\list{}{\leftmargin=1.25mm\itemindent=20pt\linewidth=0.975\textwidth%
\item[\hskip\labelsep
\color{section_color}\sffamily\bfseries
}{%
\popQED\endlist\@endpefalse
}
\makeatother

\begin{document}

\begin{theorem}[Eulers identitet]
$e^{i\pi} + 1 = 0$.
\end{theorem}

\begin{proof}
Brug Eulers formul; $e^{ix} = \cos x + i\sin x$.
\end{proof}

\begin{proof}[Bevis for Fermats sidste S{\ae}tning]
Sp{\o}rg Sir Andrew John Wiles.
\end{proof}

\end{document}


As can be seen in the screenshot, the vertical spacing around the theorem environment is bigger than the spacing around the proof environment; how do I change it to be the same?

-

We can create an mdframed environment which simulates the one created for theorems:

\newmdenv[
leftmargin = -2pt,
rightmargin = -2pt,
innerleftmargin = 2mm,
innerrightmargin = 2mm,
innertopmargin = 6pt,
innerbottommargin = 6pt,
skipabove = 1pt,
skipbelow = 10pt,
linewidth = 0pt,
backgroundcolor = white
]{proofbox}


and then apply it to the redefinition of proof

\makeatletter
\renewenvironment{proof}[1][\proofname]{\proofbox\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item[\hskip\labelsep
\color{section_color}\sffamily\bfseries
}{%
\popQED\endtrivlist\@endpefalse\endproofbox
}
\makeatother


Complete code:

\documentclass[danish]{article}

\usepackage{babel}
\usepackage{color}
\usepackage{amsthm,thmtools}
\usepackage{mdframed}

% Colors.
\definecolor{section_color}{rgb}{0.35,0.0,0}
\definecolor{MyGray}{rgb}{0.96,0.97,0.98}

% Defining common style.
\declaretheoremstyle[
spaceabove = 6pt,
spacebelow = 6pt,
notefont = \mdseries,
notebraces = {(}{)},
bodyfont = \normalfont,
qed = ,
]{mystyle}

% Defining theorem environment.
\declaretheorem[
style = mystyle,
name = S{\ae}tning,
bgcolor = MyGray,
textwidth = 0.98\textwidth
}
]{theorem}

% Defining claim environment.
\declaretheorem[
sibling = theorem,
style = mystyle,
bgcolor = MyGray,
textwidth = 0.98\textwidth
}
]{claim}

\newmdenv[
leftmargin = -2pt,
rightmargin = -2pt,
innerleftmargin = 2mm,
innerrightmargin = 2mm,
innertopmargin = 6pt,
innerbottommargin = 6pt,
skipabove = 1pt,
skipbelow = 10pt,
linewidth = 0pt,
backgroundcolor = white
]{proofbox}

\makeatletter
\renewenvironment{proof}[1][\proofname]{\proofbox\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item[\hskip\labelsep
\color{section_color}\sffamily\bfseries
}{%
\popQED\endtrivlist\@endpefalse\endproofbox
}
\makeatother

\begin{document}

\begin{theorem}[Eulers identitet]
$e^{i\pi} + 1 = 0$.
\end{theorem}

\begin{proof}
Brug Eulers formul; $e^{ix} = \cos x + i\sin x$.
\end{proof}

\begin{proof}[Bevis for Fermats sidste S{\ae}tning]
Sp{\o}rg Sir Andrew John Wiles.
\end{proof}

\end{document}


Output:

If you change the background color to

backgroundcolor = MyGray


you can appreciate the result:

-