代码

代码

我的文档需要 1.5 倍的行距,如果我使用setspace's\onehalfspacing命令或使用 来设置此行距\linespread{1.5},则方程式环境也会受到影响。当在方程式内部布置类似数组的元素时,可以看到此行距的影响,如下所示:

在此处输入图片描述

此外,如果我使用双倍行距,行距的效果就会增加,这太糟糕了!基本上我需要方程式环境单倍行距

按照解决方案方程式和双倍行距作者 Gonzalo Medina矩阵看起来不错!但是我注意到,当方程式环境位于文本段落之后(纯文本中它们之间没有行)时,解决方案也会通过将其行距更改为单倍行距来影响前面的文本,如下所示:

![在此处输入图片描述

请注意,第三段不受影响,因为它位于公式之后。还请注意,文本和公式之间的空格已更改,并且不正确。

为什么会发生这种情况?我该如何解决?

代码

\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{setspace}
%\onehalfspacing
\linespread{1.5}
\usepackage{etoolbox}
\BeforeBeginEnvironment{equation}{\begin{singlespacing}}
\AfterEndEnvironment{equation}{\end{singlespacing}\noindent\ignorespaces}

\begin{document}
Remote sensing is the acquisition of information about an object or phenomenon without making physical contact with the object and thus in contrast to on site observation. Remote sensing is a sub-field of geography.
    \begin{equation}
        \begin{bmatrix}
            X & Y & Z \\
            \vdots & \vdots & \vdots\\
            W & Q & V
        \end{bmatrix}
    \end{equation}

In modern usage, the term generally refers to the use of aerial sensor technologies to detect and classify objects on Earth (both on the surface, and in the atmosphere and oceans) by means of propagated signals (e.g. electromagnetic radiation).
\begin{equation}
    \left[
    \begin{array}{ccc}
    1 & 2 & 3\\
    4 & 5 & 6\\
    \end{array}\right]
\end{equation}

Remote sensing is a sub-field of geography. In modern usage, the term generally refers to the use of aerial sensor technologies to detect and classify objects on Earth (both on the surface, and in the atmosphere and oceans) by means of propagated signals (e.g. electromagnetic radiation).
\end{document}

答案1

我稍微修改了你的代码。诀窍是添加一个\leavevmode。请注意,没有singlespacing环境,只有一个singlespace

\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{setspace}
%\onehalfspacing
\linespread{1.5}
\usepackage{etoolbox}
\AtBeginEnvironment{equation}{\leavevmode\singlespace}
\AfterEndEnvironment{equation}{\endsinglespace\vskip0.5\baselineskip\noindent\ignorespaces}

\begin{document}

Remote sensing is the acquisition of information about an object or phenomenon without making physical contact with the object and thus in contrast to on site observation. Remote sensing is a sub-field of geography.
\begin{equation}
  \begin{bmatrix}
    X & Y & Z \\
    \vdots & \vdots & \vdots \\
    W & Q & V
  \end{bmatrix}
\end{equation}
In modern usage, the term generally refers to the use of aerial sensor technologies to detect and classify objects on Earth (both on the surface, and in the atmosphere and oceans) by means of propagated signals (e.g. electromagnetic radiation).
\begin{equation}
  \left[
    \begin{array}{ccc}
      1 & 2 & 3 \\
      4 & 5 & 6 
  \end{array}\right] 
\end{equation}
Remote sensing is a sub-field of geography. In modern usage, the term generally refers to the use of aerial sensor technologies to detect and classify objects on Earth (both on the surface, and in the atmosphere and oceans) by means of propagated signals (e.g. electromagnetic radiation).

\end{document} 

在此处输入图片描述

相关内容