但当我这样做时,我得到了这个:
这是我的代码:
\begin{align*}&\begin{matrix*}[l]%
x_8 = 93 & y_8 = 64 & z_8 = 61\\
x_7 = 186 & y_7 = 32 & z_7 = 61\\
x_6 = 231 & y_6 = 32 & z_6 = 29\\
x_5 = 462 & y_5 = 16 & z_5 = 29\\
x_4 = 483 & y_4 = 16 & z_4 = 13\\
x_3 = 966 & y_3 = 8 & z_3 = 13\\
x_2 = 975 & y_2 = 8 & z_2 = 5\\
x_1 = 1950 & y_1 = 4 & z_1 = 5\\
x_0 = 1953 & y_0 = 4 & z_1 = 1
\end{matrix*}
\quad
&\begin{matrix*}[l]%
x_5 = 65 & y_5 = 128 & z_5 = 1\\
x_4 = 130 & y_4 = 64 & z_4 = 1\\
x_3 = 260 & y_3 = 32 & z_3 = 1\\
x_2 = 520 & y_2 = 16 & z_2 = 1\\
x_1 = 1040 & y_1 = 8 & z_1 = 1\\
x_0 = 2080 & y_0 = 4 & z_0 = 1
\end{matrix*}
\end{align*}
答案1
这是一个使用两种array
环境的解决方案。请注意,我已将每个符号右侧的数字设置=
为右对齐;如果您更喜欢左对齐,只需更改
\begin{array}[t]{*{2}{r@{{}={}}r @{\quad}} r@{{}={}}r}
到
\begin{array}[t]{*{2}{r@{{}={}}l @{\quad}} r@{{}={}}l}
或者,如果您愿意,可以aligned
使用定位说明符并排使用两个环境[t]
。这种方法需要对您在查询中发布的代码进行较少的修改。但是,它不提供将数字右对齐到符号右侧的选项=
。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[ % Solution 1: Use two side-by-side 'array' environments
\renewcommand\arraystretch{1.25}
\begin{array}[t]{*{2}{r@{{}={}}r @{\quad}} r@{{}={}}r}
x_8 & 93 & y_8 & 64 & z_8 & 61\\
x_7 & 186 & y_7 & 32 & z_7 & 61\\
x_6 & 231 & y_6 & 32 & z_6 & 29\\
x_5 & 462 & y_5 & 16 & z_5 & 29\\
x_4 & 483 & y_4 & 16 & z_4 & 13\\
x_3 & 966 & y_3 & 8 & z_3 & 13\\
x_2 & 975 & y_2 & 8 & z_2 & 5\\
x_1 & 1950 & y_1 & 4 & z_1 & 5\\
x_0 & 1953 & y_0 & 4 & z_1 & 1
\end{array}
\quad
\begin{array}[t]{*{2}{r@{{}={}}r @{\quad}} r@{{}={}}r}
x_5 & 65 & y_5 & 128 & z_5 & 1\\
x_4 & 130 & y_4 & 64 & z_4 & 1\\
x_3 & 260 & y_3 & 32 & z_3 & 1\\
x_2 & 520 & y_2 & 16 & z_2 & 1\\
x_1 & 1040 & y_1 & 8 & z_1 & 1\\
x_0 & 2080 & y_0 & 4 & z_0 & 1
\end{array}
\]
\[ % Solution 2: Use two side-by-side 'aligned' environments
\begin{aligned}[t]
x_8 &= 93 & y_8 &= 64 & z_8 &= 61\\
x_7 &= 186 & y_7 &= 32 & z_7 &= 61\\
x_6 &= 231 & y_6 &= 32 & z_6 &= 29\\
x_5 &= 462 & y_5 &= 16 & z_5 &= 29\\
x_4 &= 483 & y_4 &= 16 & z_4 &= 13\\
x_3 &= 966 & y_3 &= 8 & z_3 &= 13\\
x_2 &= 975 & y_2 &= 8 & z_2 &= 5\\
x_1 &= 1950 & y_1 &= 4 & z_1 &= 5\\
x_0 &= 1953 & y_0 &= 4 & z_1 &= 1
\end{aligned}
\qquad
\begin{aligned}[t]
x_5 &= 65 & y_5 &= 128 & z_5 &= 1\\
x_4 &= 130 & y_4 &= 64 & z_4 &= 1\\
x_3 &= 260 & y_3 &= 32 & z_3 &= 1\\
x_2 &= 520 & y_2 &= 16 & z_2 &= 1\\
x_1 &= 1040 & y_1 &= 8 & z_1 &= 1\\
x_0 &= 2080 & y_0 &= 4 & z_0 &= 1
\end{aligned}
\]
\end{document}
答案2
以下是两种可能的代码:
\documentclass[12pt]{article}
\usepackage{fourier, erewhon}
\usepackage{mathtools}
\begin{document}
\[ \begin{array}{lll@{\hskip 3em}lll}%
x_8 = 93 & y_8 = 64 & z_8 = 61 & x_5 = 65 & y_5 = 128 & z_5 = 1 \\
x_7 = 186 & y_7 = 32 & z_7 = 61 & x_4 = 130 & y_4 = 64 & z_4 = 1 \\
x_6 = 231 & y_6 = 32 & z_6 = 29 & x_3 = 260 & y_3 = 32 & z_3 = 1 \\
x_5 = 462 & y_5 = 16 & z_5 = 29 & x_2 = 520 & y_2 = 16 & z_2 = 1 \\
x_4 = 483 & y_4 = 16 & z_4 = 13 &x_1 = 1040 & y_1 = 8 & z_1 = 1 \\
x_3 = 966 & y_3 = 8 & z_3 = 13 & x_0 = 2080 & y_0 = 4 & z_0 = 1\\
x_2 = 975 & y_2 = 8 & z_2 = 5 \\
x_1 = 1950 & y_1 = 4 & z_1 = 5 \\
x_0 = 1953 & y_0 = 4 & z_0 = 1
\end{array}\]%
\begin{alignat*}{6}
x_8 &= 93 &\hskip 1.2em y_8 & = 64 &\hskip 1.2em z_8 &= 61 &\hskip 3em x_5 &= 65 &\hskip 1.2em y_5 &= 128 & \hskip 1.2em d z_5 &= 1 \\
x_7 &= 186 & y_7 &= 32 & z_7 &= 61 & x_4 &= 130 & y_4 &= 64 & z_4 &= 1 \\
x_6 &= 231 & y_6 &= 32 & z_6 &= 29 & x_3 &= 260 & y_3 &= 32 & z_3 &= 1 \\
x_5 &= 462 & y_5 &= 16 & z_5 &= 29 & x_2 &= 520 & y_2 &= 16 & z_2 &= 1 \\
x_4 &= 483 & y_4 &= 16 & z_4 &= 13 &x_1 &= 1040 & y_1 &= 8 & z_1 &= 1 \\
x_3 &= 966 & y_3 &= 8 & z_3 &= 13 & x_0 &= 2080 & y_0 &= 4 & z_0 &= 1\\
x_2 &= 975 & y_2 &= 8 & z_2 &= 5 \\
x_1 &= 1950 & y_1 &= 4 & z_1 &= 5 \\
x_0 &= 1953 & y_0 &= 4 & z_0 &= 1
\end{alignat*}
\end{document}
要从代码开始进行顶部对齐,您可以向较小的矩阵中添加空行,或者更改matrix*
为array
并使用[t]
可选参数:
\begin{align*}
&\begin{matrix*}[l]%
x_8 = 93 & y_8 = 64 & z_8 = 61\\
x_7 = 186 & y_7 = 32 & z_7 = 61\\
x_6 = 231 & y_6 = 32 & z_6 = 29\\
x_5 = 462 & y_5 = 16 & z_5 = 29\\
x_4 = 483 & y_4 = 16 & z_4 = 13\\
x_3 = 966 & y_3 = 8 & z_3 = 13\\
x_2 = 975 & y_2 = 8 & z_2 = 5\\
x_1 = 1950 & y_1 = 4 & z_1 = 5\\
x_0 = 1953 & y_0 = 4 & z_1 = 1
\end{matrix*}
&\begin{matrix*}[l]%
x_5 = 65 & y_5 = 128 & z_5 = 1\\
x_4 = 130 & y_4 = 64 & z_4 = 1\\
x_3 = 260 & y_3 = 32 & z_3 = 1\\
x_2 = 520 & y_2 = 16 & z_2 = 1\\
x_1 = 1040 & y_1 = 8 & z_1 = 1\\
x_0 = 2080 & y_0 = 4 & z_0 = 1\\
\\
\\
\\
\end{matrix*}
\end{align*}\\
\[ %
\begin{array}[t]{lll}%
x_8 = 93 & y_8 = 64 & z_8 = 61\\
x_7 = 186 & y_7 = 32 & z_7 = 61\\
x_6 = 231 & y_6 = 32 & z_6 = 29\\
x_5 = 462 & y_5 = 16 & z_5 = 29\\
x_4 = 483 & y_4 = 16 & z_4 = 13\\
x_3 = 966 & y_3 = 8 & z_3 = 13\\
x_2 = 975 & y_2 = 8 & z_2 = 5\\
x_1 = 1950 & y_1 = 4 & z_1 = 5\\
x_0 = 1953 & y_0 = 4 & z_1 = 1
\end{array}
\qquad%
\begin{array}[t]{lll}
x_5 = 65 & y_5 = 128 & z_5 = 1\\
x_4 = 130 & y_4 = 64 & z_4 = 1\\
x_3 = 260 & y_3 = 32 & z_3 = 1\\
x_2 = 520 & y_2 = 16 & z_2 = 1\\
x_1 = 1040 & y_1 = 8 & z_1 = 1\\
x_0 = 2080 & y_0 = 4 & z_0 = 1
\end{array}
\]