我想要实现这张图中的效果:
可以使用“数组”来生成,但是公式中会用到太多的{}。
我想使用“对齐”环境,但它会在等式中给出更长的空间。
那么,有什么建议可以使用“对齐”环境来实现图片中的结果吗?谢谢。
这是原始代码(它会生成我不熟悉“alignat”的警告):
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{enumerate}
\item using array, the results I prefer, however it adds so many \{\} and I seek for a more elegant way:
\begin{equation}
\left\{
\begin{array}{@{}l@{}l@{}l@{}l@{}l@{}}
y_{1} &{}= a_{11} x_{1}&{}+ &{} \cdots &{}+a_{1 n} x_{n}\\
& & &{} \cdots & \\
y_{m} &{}= a_{m 1} x_{1}&{}+ &{} \cdots&{}+a_{m v} x_{n}
\end{array}
\right.
\end{equation}
\item using aligned, so how to avoid the large space before ``+":
\begin{equation}
\left\{
\begin{aligned}
y_{1} &= a_{11} x_{1} &+ &\cdots & + a_{1 n} x_{n}\\
& & &\cdots & \\
y_{m} &= a_{m 1} x_{1} &+ &\cdots & + a_{m v} x_{n}
\end{aligned}
\right.
\end{equation}
\item using alignat, I am not familiar with it,
but it can only use in paragraph environment
and I donnot know how to add a brace in the left.
So I will not use it , just give it as reference:
\begin{alignat}{2}
y_{1} &= a_{11} x_{1} &+ &\cdots &+a_{1 n} x_{n}\\
& & &\cdots & \\
y_{m} &= a_{m 1} x_{1}&+ &\cdots &+a_{m v} x_{n}
\end{alignat}
\end{enumerate}
\end{document}
答案1
您需要alignedat
表达式内的版本alingat
,并注意所有 AMS 对齐都在右对齐和左对齐之间交替,并且在第一列之后您只需要左对齐,因此其他每一列都需要为空。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\left\{
\begin{alignedat}{3}
y_{1} &= a_{11} x_{1} &&+ &&\cdots + a_{1 n} x_{n}\\
& && &&\cdots \\
y_{m} &= a_{m 1} x_{1} &&+ &&\cdots + a_{m v} x_{n}
\end{alignedat}
\right.
\end{equation}
\end{document}
答案2
Alignat
让您控制对齐列之间的间距。以下是三种变体:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{enumerate}
\item With three alignment columns:
\begin{equation}
\begin{cases}
\begin{alignedat}{3}
y_{1} &= a_{11} x_{1} & & +{} &\cdots & + a_{1 n} x_{n}\\
& & & & \cdots & \\
y_{m} &= a_{m 1} x_{1} & & +{}& \cdots & + a_{m v} x_{n}
\end{alignedat}
\end{cases}
\end{equation}
\item With two alignment columns:
\begin{equation}
\begin{cases}
\begin{alignedat}{2}
y_{1} &= a_{11} x_{1} && +\cdots + a_{1 n} x_{n}\\
& & & \phantom{{}+{}}{\cdots} \\
y_{m} &= a_{m 1} x_{1} & & + \cdots + a_{m v} x_{n}
\end{alignedat}
\end{cases}
\end{equation}
\item With two alignment columns and verticals dots:
\begin{equation}
\begin{cases}
\begin{alignedat}{2}
y_{1} &= a_{11} x_{1} && +\cdots + a_{1 n} x_{n}\\[-1ex]
\vdotswithin{y_m }& & & \vdotswithin{ + } \\[-1ex]
y_{m} &= a_{m 1} x_{1} & & + \cdots + a_{m v} x_{n}
\end{alignedat}
\end{cases}
\end{equation}
\end{enumerate}
\end{document}