# size of framed environment in memoir

I am using the memoir package and the 'framed' environment. It seems that the vertical white spacing differs depending whether it is a single equation or the 'multiline' environment. Please, compare these two snapshots:

In the second case the vertical distance from the upmost character ("1" in this example) to the frame is larger. Therefore, my question is how to make the vertical white area in both cases to have exactly the same height?

Here is my code:

\documentclass[11pt,a4paper,onecolumn,openright,final]{memoir}
%===============================================
\settrims{0.cm}{0.cm}
\setbinding{1cm} % space for binding
\setlrmarginsandblock{*}{3cm}{1} % spine = edge. Edge=3cm
\setulmarginsandblock{3cm}{*}{1} % upper=lower. Upper=3cm
\checkandfixthelayout
\pagestyle{empty}
%===============================================
\usepackage[]{stix,amsmath}
\renewcommand{\vec}[1]{\mathbf{#1}}
%===============================================
\begin{document}
Compare different spacing here
\begin{framed}
$$\xi^{(1)}(\vec r)=\frac1{\omega^2}\Big(\vec\nabla n(\vec r)\cdot\vec \nabla\varphi^{(0)}(\vec r) -n(\vec r)\Delta\varphi^{(0)}(\vec r)\Big)\label{eq:xi1}$$
\end{framed}
\noindent and  here
\begin{framed}
\begin{multline}
\xi^{(2)}(\vec r)=\frac1{2\omega^4}\vec\nabla\cdot
\Big(\vec\nabla\varphi^{(1)}(\vec r)\left[n(\vec r)\Delta \varphi^{(1)}(\vec r)
+\big(\nabla\varphi^{(1)}(\vec r)\cdot\nabla n(\vec r)\big)\right]\\
+\frac14 n(\vec r)\vec\nabla\big(\vec\nabla\varphi^{(1)}(\vec  r)\big)^2\Big).\label{eq:xi2}
\end{multline}
\end{framed}
\end{document}


• Full minimal example please. Also note that in general the spacing around equation vs multline is different. equation have a space saving feature (that might be a play here), I don't think multline has a similar feature. – daleif Feb 5 '15 at 9:11
• I'd say there isn't much you can do, many of the amsmath envs just take up more space vertically. Some more than others. – daleif Feb 5 '15 at 9:36
• Will changing the environment help? – yarchik Feb 5 '15 at 9:38
• See my longer comment below – daleif Feb 5 '15 at 9:40

Longer comment. It seems if you add control of \abovedisplayskip, then it is actually multline that is the worst. I hardly ever use it anyway, I tend to use align for most and combine it with \MoveEqLeft from mathtools. Here is the comparison.

\documentclass[11pt,a4paper,onecolumn,openright,final]{memoir}
%===============================================
\settrims{0.cm}{0.cm}
\setbinding{1cm} % space for binding
\setlrmarginsandblock{*}{3cm}{1} % spine = edge. Edge=3cm
\setulmarginsandblock{3cm}{*}{1} % upper=lower. Upper=3cm
\checkandfixthelayout
\pagestyle{empty}
%===============================================
\usepackage[]{stix,amsmath}
\renewcommand{\vec}[1]{\mathbf{#1}}
%===============================================

\newenvironment{mytest}{%
\framed%
\abovedisplayskip=\abovedisplayshortskip%
\belowdisplayskip=\belowdisplayshortskip%
}{\endframed}

\FrameSep=0pt

\begin{document}
Compare different spacing here
\begin{mytest}
$$\xi^{(1)}(\vec r)=\frac1{\omega^2}\Big(\vec\nabla n(\vec r)\cdot\vec \nabla\varphi^{(0)}(\vec r) -n(\vec r)\Delta\varphi^{(0)}(\vec r)\Big)\label{eq:xi1}$$
\end{mytest}
align
\begin{mytest}
\begin{align}$$\xi^{(1)}(\vec r)=\frac1{\omega^2}\Big(\vec\nabla n(\vec r)\cdot\vec \nabla\varphi^{(0)}(\vec r) -n(\vec r)\Delta\varphi^{(0)}(\vec r)\Big)\label{eq:xi1}$$\\
\text{second}
\end{align}
\end{mytest}
gather
\begin{mytest}
\begin{gather}$$\xi^{(1)}(\vec r)=\frac1{\omega^2}\Big(\vec\nabla n(\vec r)\cdot\vec \nabla\varphi^{(0)}(\vec r) -n(\vec r)\Delta\varphi^{(0)}(\vec r)\Big)\label{eq:xi1}$$\\
\text{second}
\end{gather}
\end{mytest}
multline
\begin{mytest}
\begin{multline}$$\xi^{(1)}(\vec r)=\frac1{\omega^2}\Big(\vec\nabla n(\vec r)\cdot\vec \nabla\varphi^{(0)}(\vec r) -n(\vec r)\Delta\varphi^{(0)}(\vec r)\Big)\label{eq:xi1}$$\\
\text{second}
\end{multline}
\end{mytest}

\end{document}
`

• Thank you, so the right variable is 'abovedisplayskip'. I will wait little bit for more answers and then accept. – yarchik Feb 5 '15 at 9:50
• @yarchik Remember, only mess with it inside the wrapping env, or the rest of the document may look odd (unless you are framing all displayed math, in which case, you might want to reconsider) – daleif Feb 5 '15 at 10:24