减少公式和文本之间的间距

减少公式和文本之间的间距

我正在写一些包含编号的句子显示中间的方程式,如下所示:

|  Consider the relationship:      |
|      EQUATION                 (1)|
|where x is ... and y is ...       |
|                                  |
|  This is a new paragraph which   |
|ends with the following:          |
|      EQUATION                 (2)|
|                                  |
|  And this is the last paragraph, |
|followed by some equations which  |
|are not part of it.               |
|                                  |
|      EQUATIONS                (3)|
|                                  |
|  The end.                        |

这是代码,段落之间有空行:

Consider the relationship:
\begin{equation} ... \end{equation}
where x is ... and y is ...

This is a new paragraph which ends with the following:
\begin{equation} ... \end{equation}

And this is the last paragraph, followed by some equations which are not part of it.

\begin{equation} ... \end{equation}

The end.

我想减少公式和文本之间的间距,但仅限于公式位于句子中间的情况(请注意上例中的垂直间距和段落缩进)。有没有办法做到这一点,而不改变全局间距,例如这里

理想的解决方案是识别公式是部分还是段落(即基于两个段落之间的空白行,如缩进)。或者,在公式之前、内部或之前+之后插入命令(以及聚集、对齐等)环境,或像这样的新环境,\begin{NoSpaceEquation} ... \end{NoSpaceEquation}也是可以的。

我并不寻求像全局空间缩减这样的解决方案,因为这种解决方案需要在孤立方程式前后手动添加空间。该解决方案应该只影响段落内的方程式。

PS:我正在使用mathtools。

谢谢你!

答案1

您可以使用\useshortskip命令 from nccmath(就在等式之前)或\SwapAboveDisplaySkip(在 的最开头amsmath environment):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools, nccmath}

\begin{document}

In the first place, consider the relationship:
\begin{equation}\textit{A first equation} \end{equation}
where x is ... and y is ...

This is a new paragraph which ends with the following equation:\useshortskip
\begin{equation}\textit{Another equation} \end{equation}

This is another paragraph which ends with an AmSmath environment:
\begin{gather}\SwapAboveDisplaySkip\textit{Another equation} \end{gather}

And this is the last paragraph, followed by some equations which are not part of it.

\begin{equation}\textit{Still another equation}.\end{equation}

The end.

\end{document} 

在此处输入图片描述

为了减少上面的间距在等式下方,我们可以修补的内部命令nccmath,但以下文本不能开始新的段落:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools, nccmath}

\usepackage{xpatch}
\xpatchcmd{\NCC@ignorepar}{%
\abovedisplayskip\abovedisplayshortskip}
{%
\abovedisplayskip\abovedisplayshortskip%
\belowdisplayskip\belowdisplayshortskip}
{}{}

\begin{document}

In the first place, consider the relationship:
\begin{equation}\textit{A first equation} \end{equation}
where x is ... and y is ...

This is a new paragraph which ends with the following equation:\useshortskip
\begin{equation}\textit{Another equation}\text{(spacing with \texttt{\textbackslash useshortskips})}\end{equation}

And this is the last paragraph, followed by some equations which are not part of it.

\begin{equation}\textit{Still another equation}.\end{equation}

The end of this very exhaustive test.

\end{document} 

在此处输入图片描述

相关内容