文本和公式之间的空格

文本和公式之间的空格

我正在尝试增加文本和方程式之间的空间,并按照其他线程使用以下命令:

\usepackage{amsmath}

\makeatletter
\g@addto@macro\normalsize{%
    \setlength\abovedisplayskip{15pt}
    \setlength\belowdisplayskip{15pt}
    \setlength\abovedisplayshortskip{15pt}
    \setlength\belowdisplayshortskip{15pt}
}
\makeatother

但是,当我有两个连续的方程式时,此代码会使两个方程式之间的间距比方程式和文本(上方和下方)之间的间距更大。我想获得相反的效果,即方程式之间的间距更小,文本和方程式之间的间距更大(上方和下方)。你对此有什么建议吗?(在我的代码下方)。

多谢

Here I have some text....
\begin{equation}
    \frac{\partial J_{i t}}{\partial n_{i t}}=\varphi_{t}a_{t} h_{i t}-\frac{W_{i t}}{P_{t}} - \frac{\chi}{(1+\psi)} \left[z_{i t}^{1+\psi} - (1+\psi) z_{i t}^{1+\psi}\right]+(1-\delta) E_{t} \beta_{t, t+1} \frac{\partial J_{i t+1}}{\partial n_{i t+1}}
\end{equation}
\begin{equation} 
    \frac{\partial J_{i t}}{\partial n_{i t}}=\varphi_{t}a_{t} h_{i t}-\frac{W_{i t}}{P_{t}} +\frac{\psi \chi}{(1+\psi)} z_{i t}^{1+\psi}+(1-\delta) E_{t} \beta_{t, t+1} \frac{\partial J_{i t+1}}{\partial n_{i t+1}}
\end{equation}
Here I have more text..

答案1

既然你正在加载该amsmath包,你不妨利用它的多行显示方程式环境,例如gatheralign环境。这将自动解决方程式之间的间距问题。

鉴于下面的方程似乎是上面方程的简单变换,align这里的环境可能是合适的,并对=符号进行对齐。

下图中的水平线用于标记相应显示方程材料的开始和结束。

在此处输入图片描述

\documentclass{article}
\usepackage{geometry} % set page parameters suitably
\usepackage{amsmath,xcolor}
\DeclareMathOperator{\E}{E} % expectations operator
\makeatletter
\g@addto@macro\normalsize{%
    \setlength\abovedisplayskip{15pt}
    \setlength\belowdisplayskip{15pt}
    \setlength\abovedisplayshortskip{15pt}
    \setlength\belowdisplayshortskip{15pt}
}
\makeatother

\begin{document}

\noindent\textcolor{red}{two consecutive \texttt{equation} environments}
\hrule
\begin{equation}
    \frac{\partial J_{i t}}{\partial n_{i t}}=\varphi_{t}a_{t} h_{i t}-\frac{W_{i t}}{P_{t}} - \frac{\chi}{(1+\psi)} \left[z_{i t}^{1+\psi} - (1+\psi) z_{i t}^{1+\psi}\right]+(1-\delta) \E_{t} \beta_{t, t+1} \frac{\partial J_{i t+1}}{\partial n_{i t+1}}
\end{equation}
\begin{equation} 
    \frac{\partial J_{i t}}{\partial n_{i t}}=\varphi_{t}a_{t} h_{i t}-\frac{W_{i t}}{P_{t}} +\frac{\psi \chi}{(1+\psi)} z_{i t}^{1+\psi}+(1-\delta) \E_{t} \beta_{t, t+1} \frac{\partial J_{i t+1}}{\partial n_{i t+1}}
\end{equation}
\hrule

\bigskip
\noindent\textcolor{red}{single \texttt{gather} environment}
\hrule
\begin{gather}
    \frac{\partial J_{i t}}{\partial n_{i t}}=\varphi_{t}a_{t} h_{i t}-\frac{W_{i t}}{P_{t}} - \frac{\chi}{(1+\psi)} \left[z_{i t}^{1+\psi} - (1+\psi) z_{i t}^{1+\psi}\right]+(1-\delta) \E_{t} \beta_{t, t+1} \frac{\partial J_{i t+1}}{\partial n_{i t+1}} \\ 
    \frac{\partial J_{i t}}{\partial n_{i t}}=\varphi_{t}a_{t} h_{i t}-\frac{W_{i t}}{P_{t}} +\frac{\psi \chi}{(1+\psi)} z_{i t}^{1+\psi}+(1-\delta) \E_{t} \beta_{t, t+1} \frac{\partial J_{i t+1}}{\partial n_{i t+1}}
\end{gather}
\hrule

\bigskip
\noindent\textcolor{red}{single \texttt{align} environment}
\hrule
\begin{align}
    \frac{\partial J_{i t}}{\partial n_{i t}}
      &=\varphi_{t}a_{t} h_{i t}-\frac{W_{i t}}{P_{t}} - \frac{\chi}{(1+\psi)} \left[z_{i t}^{1+\psi} - (1+\psi) z_{i t}^{1+\psi}\right]+(1-\delta) \E_{t} \beta_{t, t+1} \frac{\partial J_{i t+1}}{\partial n_{i t+1}} \\ 
    %\frac{\partial J_{i t}}{\partial n_{i t}}
      &=\varphi_{t}a_{t} h_{i t}-\frac{W_{i t}}{P_{t}} +\frac{\psi \chi}{(1+\psi)} z_{i t}^{1+\psi}+(1-\delta) \E_{t} \beta_{t, t+1} \frac{\partial J_{i t+1}}{\partial n_{i t+1}}
\end{align}
\hrule

\end{document}

相关内容