equation
我想创建一个与中的环境完全相同的新环境amsmath
;但是,我希望这个新环境的上方和下方的空间更小。我不想覆盖或更改现有equation
环境。我想要两个环境。
我该怎么做呢?我一直都是软件包的最终用户,因此创建这样的东西超出了我的经验。
答案1
无需了解独立编号的细节,您可以对间距进行不同的设置参数。
\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum}
\newenvironment{equation-}
{%
\abovedisplayshortskip=0pt plus 1pt
\abovedisplayskip=2pt plus 1pt minus 1pt
\belowdisplayshortskip=\abovedisplayskip
\belowdisplayskip=\abovedisplayskip
\begin{equation}%
}
{\end{equation}\ignorespacesafterend}
\begin{document}
\lipsum*[2]
\begin{equation-}
1\quad 2\quad 3
\end{equation-}
Short short short short short short short short short short short short
short short
\begin{equation-}
1\quad 2\quad 3
\end{equation-}
\lipsum*[2]
\begin{equation}
1\quad 2\quad 3
\end{equation}
\lipsum[2]
\end{document}
我不确定你是否真的想要它。
对于独立编号:
\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum}
\newcounter{savedequation}
\newcounter{shortequation}
\newenvironment{equation-}
{%
\setcounter{savedequation}{\value{equation}}%
\setcounter{equation}{\value{shortequation}}%
\renewcommand\theequation{S\arabic{equation}}%
\abovedisplayshortskip=0pt plus 1pt
\abovedisplayskip=2pt plus 1pt minus 1pt
\belowdisplayshortskip=\abovedisplayskip
\belowdisplayskip=\abovedisplayskip
\begin{equation}%
}
{%
\end{equation}%
\setcounter{shortequation}{\value{equation}}%
\setcounter{equation}{\value{savedequation}}%
\ignorespacesafterend
}
\begin{document}
\lipsum*[2]
\begin{equation}
a=b
\end{equation}
\lipsum*[2]
\begin{equation-}
1\quad 2\quad 3
\end{equation-}
Short short short short short short short short short short short short
short short
\begin{equation-}
1\quad 2\quad 3
\end{equation-}
\lipsum*[2]
\begin{equation}
c=d
\end{equation}
\lipsum[2]
\end{document}