难点在于既要使用 alignat
环境(包含编号),又要有大括号,又要跨括号对齐。任意两点其实都不算难,但是三点都要实现就比较麻烦了。这里提供两种并不优雅的解决方案。
一个是使用 array
环境。
% \usepackage{array,multirow}
{\renewcommand\arraystretch{1.3}\[
\begin{array}{r@{} *{2}{r@{}>{{}}c<{{}}@{}} l@{\qquad}r} %% @{} 为了去除间距
\multirow{2}*{$\biggl\{\biggr.$}& x & + & 3y & = & 11 & (1) \\
& 2x & - & y & = & -9 & (2) \\
\multirow{2}*{result$\biggl\{\biggr.$} & x & = & x_1 &&& (1') \\
& y & = & y_1 &&& (2')
\end{array}
\]}
效果如下:
这里的大括号是对齐的
不过编号的位置需要设置,这里使用一个 \quad
。
另一个就是使用 empheq
宏包的 empheq
环境,该宏包属于 mathtools
的一部分,(详细用法查看其参考文档)。
实际上,不要求括号处对齐是比较容易实现的:
% \usepackage{amsmath,empheq}
\begin{empheq}[left={ }\empheqlbrace]{alignat*=2}
x &+{}& 3y &= 11, \tag{1} \\
2x &-{}& y &= -9 \tag{2}
\end{empheq}
\begin{empheq}[left=\llap{result}\empheqlbrace]{align*}
x&=x_1, \tag{1'} \\
y&=y_1 \tag{2'}
\end{empheq}
如果在括号处对齐则需要半手动调整间距了:
% \usepackage{amsmath,empheq}
\newdimen\tmpadim
\newdimen\tmpbdim
%% 这两个是为了计算宽度
\settowidth\tmpadim{$
\begin{alignedat}{2}
x &+{}& 3y &= 11, \\
2x &-{}& y &= -9
\end{alignedat}
$}
\settowidth\tmpbdim{$
\begin{aligned}
x &= x_1, \\
y &= y_1
\end{aligned}
$}
\begin{empheq}[left={ }\empheqlbrace]{alignat*=2}
x &+{}& 3y &= 11, \tag{1}\label{eq:1} \\
2x &-{}& y &= -9 \tag{2}
\end{empheq}
\begin{empheq}[left=\llap{result}\empheqlbrace]{align*}
x&=x_1, \hspace{\dimexpr\tmpadim-\tmpbdim} \tag{1'}\label{eq:1'} \\ % 插入一个间距
y&=y_1 \tag{2'}
\end{empheq}
\eqref{eq:1} and \eqref{eq:1'}
括号处是对齐的:
问 如实实现将不同行的方程组编号垂直对齐?