我想显示一组分为子集的方程式,其中两个子集之间的间距与第一行和上方文本之间的间距相同(以及最后一行和下方文本之间的间距相同)。如果我多次使用对齐环境,则方程式会按照我想要的方式在每个子集中对齐,但方程式子集之间的间距太大。如果我在同一个环境中编写所有方程式,对齐或聚集或类似,则间距太小,并且子集的划分和每个子集内的对齐会丢失。有人有解决这个问题的方法吗?
\documentclass[a4paper,11pt]{article}
\usepackage{amsmath}
\begin{document}
I would like this, but with the spacing between (2) and (3) equal to the spacing between (1) and this line of text.
\begin{align}
1+1&=2 & 2+2&=4 & 3+3&=6\\
4+4&=8 & 5+5&=10 & 6+6&=12
\end{align}
\begin{align}
1-1=2-2=3-3=4-4=5-5=6-6=0
\end{align}
Or between (3) and this line of text.
\end{document}
答案1
您可以局部删除上方的垂直空间(3)(应该是equation
)
\documentclass[a4paper,11pt]{article}
\usepackage{amsmath}
\begin{document}
I would like this, but with the spacing between (2) and (3) equal to
the spacing between (1) and this line of text.
\begin{align}
1+1&=2 & 2+2&=4 & 3+3&=6\\
4+4&=8 & 5+5&=10 & 6+6&=12
\end{align}
\begingroup
\setlength{\abovedisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}
\begin{equation}
1-1=2-2=3-3=4-4=5-5=6-6=0
\end{equation}
\endgroup
Or between (3) and this line of text.
\end{document}
或者,但要注意\label
在内部使用align
会被破坏,嵌套align
在`gather 中;从好的方面来说,这不会允许在两个部分之间分页。
\documentclass[a4paper,11pt]{article}
\usepackage{amsmath}
\begin{document}
I would like this, but with the spacing between (2) and (3) equal to
the spacing between (1) and this line of text.
\begin{gather}
\begin{align}
1+1&=2 & 2+2&=4 & 3+3&=6\\
4+4&=8 & 5+5&=10 & 6+6&=12
\end{align}
\\[\dimexpr\abovedisplayskip-\jot\relax]
1-1=2-2=3-3=4-4=5-5=6-6=0
\end{gather}
Or between (3) and this line of text.
\end{document}
答案2
您可以使用\mathclap
(mathtools 包)来重叠其他“列”,尽管从技术上讲它将相对于中间居中&=
。您可以使用它\\[...]
来更改垂直间距。
\documentclass[a4paper,11pt]{article}
\usepackage{mathtools}
\begin{document}
I would like this, but with the spacing between (2) and (3) equal to the spacing between (1) and this line of text.
\begin{align}
1+1&=2 & 2+2&=4 & 3+3&=6\\
4+4&=8 & 5+5&=10 & 6+6&=12\\[\abovedisplayskip]
&&& \mathclap{1-1=2-2=3-3=4-4=5-5=6-6=0} &&
\end{align}
Or between (3) and this line of text.
\end{document}
答案3
编辑:第一次尝试时,我似乎误解了问题。现在更正如下:
\documentclass[a4paper,11pt]{article}
\usepackage{amsmath}
\begin{document}
I would like this, but with the spacing between (2) and (3) equal to the spacing between (1) and this line of text.
\begin{align}
1+1&=2 & 2+2&=4 & 3+3&=6\\
4+4&=8 & 5+5&=10 & 6+6&=12
\end{align}\vspace{-\abovedisplayskip}%
\begin{equation}
1-1=2-2=3-3=4-4=5-5=6-6=0
\end{equation}
Or between (3) and this line of text.
\end{document}