如何在对齐环境中删除等式后的多余空格?

如何在对齐环境中删除等式后的多余空格?

我有以下示例:

\documentclass[journal=jacsat,manuscript=article]{achemso}

\usepackage{amsmath,amssymb}

\makeatletter

\newcommand*\bsse{%
    \begin{singlespace}%
    \vspace*{-\abovedisplayshortskip}
    \vspace*{-\abovedisplayskip}
    \noindent\ignorespaces
}

\newcommand*\esse{%
    \vspace*{-\belowdisplayskip}
    \end{singlespace}%
    \noindent\ignorespaces
}

\newcommand*\bssag{%
    \vspace*{-\abovedisplayskip}
    \begin{singlespace}%
    \noindent\ignorespaces
}

\newcommand*\essag{%
    \vspace*{-\belowdisplayskip}
    \end{singlespace}%
    \noindent\ignorespaces
}

\makeatother

\BeforeBeginEnvironment{equation}{\bsse}
\AfterEndEnvironment{equation}{\esse}
\BeforeBeginEnvironment{gather}{\bssag}
\AfterEndEnvironment{gather}{\essag}
\BeforeBeginEnvironment{align}{\bssag}
\AfterEndEnvironment{align}{\essag}

\title{Title}

\begin{document}

Consider the following equations:
%
\begin{align}\label{xm_nuc}
E&=mc^2, \\
F&=ma, \\
v&=\frac{s}{t},
\end{align}
%
where the symbols are familiar to all of us.

\end{document}

此代码在最后一个方程 (v=s/t) 后创建了一个较大的垂直空间。您能帮我看看如何精确(而不是近似)删除 所放置的空间align吗?

编辑:

在页面上删除对齐周围的垂直空间,David Carlisle 提供了一个解决方案,我可以使用该解决方案删除等式后面的空格。

\documentclass[journal=jacsat,manuscript=article]{achemso}

\usepackage{amsmath}
\usepackage{etoolbox}
\newcommand{\zerodisplayskips}{%
  \setlength{\abovedisplayskip}{0pt}%
  \setlength{\belowdisplayskip}{0pt}%
  \setlength{\abovedisplayshortskip}{0pt}%
  \setlength{\belowdisplayshortskip}{0pt}}
\appto{\normalsize}{\zerodisplayskips}
\appto{\small}{\zerodisplayskips}
\appto{\footnotesize}{\zerodisplayskips}


\title{Title}

\begin{document}

Consider the following set of well-known equations:
%
\begin{align}\label{xm_nuc}
E&=mc^2, \\
F&=ma, \\
v&=\frac{s}{t},
\end{align}
%
where the symbols are familiar to all of us.

\end{document}

然而,这个解决方案并没有使方程式成为单倍行距。

答案1

可能最简单的方法是将显示空间设置为 0pt,然后通过将数学显示间距减少 9pt 来补偿双倍间距。

在此处输入图片描述

\documentclass[journal=jacsat,manuscript=article]{achemso}

\usepackage{amsmath,amssymb}

\AddToHook{env/align/begin}{\openup-9pt}

\title{Title}

\begin{document}
\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}
\setlength{\belowdisplayshortskip}{0pt}




Consider the following equations:
%
\begin{align}\label{xm_nuc}
E&=mc^2, \\
F&=ma, \\
v&=\frac{s}{t},
\end{align}
%
where the symbols are familiar to all of us.

\end{document}

相关内容