目前,当我想在单个环境中写下几个数学方程式时,我会使用收集和对齐环境。当我有几个方程式时,如果它们之间有文本,它会正常工作,但是如果它们之间没有文本,间距就会太大:
\usepackage{mathtools}
\newcommand\algn[1]{\begin{align*}#1\end{align*}}
\newcommand\gthr[1]{\begin{gather*}#1\end{gather*}}
\newcommand{\ind}[1]{\mathbbold{#1}}
\DeclareMathOperator{\rank}{rank}
\newcommand{\trp}{\text{t}}
\DeclarePairedDelimiter\norm{\lVert}{\rVert}
\gthr{
\sum_{n\in\ind{n}}m_n
= \rank\langle \Lambda \rangle
= \rank\langle T\Lambda T^{\trp} \rangle
= \rank \langle \Delta^{1/2}A\Delta^{1/2} \rangle
= \rank \langle A \rangle
}
\algn{
f^{\trp}Af
& = f^{\trp}\Delta^{-1/2}(\Delta^{1/2}A\Delta^{1/2})\Delta^{-1/2}f\\
&= (T^{\trp}\Delta^{-1/2}f)^{\trp}\Lambda (T^{\trp}\Delta^{-1/2}f)\\
& = \sum_{r\in\ind{r}}\lambda_r (T_{,r}^{\trp}\Delta^{-1/2}f)^2\\
& = \sum_{n\in\ind{n}}\lambda_n \norm{P_n^{\trp}\Delta^{-1/2}f}^2
}
顶部是聚集环境,下面是对齐环境,它们之间没有文本。我无法将顶部方程式合并到对齐环境中,因为我无法正确居中。我想减少间距而不每次都使用 vspace。我在这里发现了类似的问题避免方程式环境组之间有多余的垂直空间,但对我来说没用;使用 align* 时,它破坏了方程的水平定位。任何帮助都将不胜感激。
答案1
\documentclass{article}
\usepackage{amsmath}
\def\ind{?????}
\def\rank{???}
\def\trp{???}
\def\norm{???}
\begin{document}
aligned in gather
\begin{gather*}
\sum_{n\in\ind{n}}m_n
= \rank\langle \Lambda \rangle
= \rank\langle T\Lambda T^{\trp} \rangle
= \rank \langle \Delta^{1/2}A\Delta^{1/2} \rangle
= \rank \langle A \rangle
\\
\begin{aligned}
f^{\trp}Af
& = f^{\trp}\Delta^{-1/2}(\Delta^{1/2}A\Delta^{1/2})\Delta^{-1/2}f\\
&= (T^{\trp}\Delta^{-1/2}f)^{\trp}\Lambda (T^{\trp}\Delta^{-1/2}f)\\
& = \sum_{r\in\ind{r}}\lambda_r (T_{,r}^{\trp}\Delta^{-1/2}f)^2\\
& = \sum_{n\in\ind{n}}\lambda_n \norm{P_n^{\trp}\Delta^{-1/2}f}^2
\end{aligned}
\end{gather*}
\end{document}