2

I want to achieve the results in this picture:

enter image description here

It can be generated by using "array". However, it will use so many {} in the equation.

I would like to use the "align" environment, but it gives a much longer space in the equation.

So are there any advices to achieve the results in the picture by using the "align" environment. Thanks.

This is the original code (it will generate warnings for that I am not familiar with "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}

2 Answers 2

4

You want alignedat the in-expression version of alingat and note that all AMS alignments alternate between right and left alignment, and after the first column you only want left alignment here so every other column needs to be empty.

enter image description here

\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}
5
  • Thanks for your answer and It really works. Could I ask another related question? If I use \vdots in the middle equation, how could I make it align to the center (with \cdots in the first and third equation)? I just find from your answer that there are only left and right align in the alignedat...
    – cwind
    Commented Jun 4, 2019 at 8:31
  • such as ` \begin{equation} \left\{ \begin{alignedat}{5} &y_{1} &&= a_{11} x_{1} &&+ &&\cdots &&+ a_{1 n} x_{n}\\ & && && &&\vdots &&\\ &y_{m} &&= a_{m 1} x_{1} &&+ &&\cdots &&+ a_{m v} x_{n} \end{alignedat} \right. \end{equation} `
    – cwind
    Commented Jun 4, 2019 at 8:36
  • there are extensions to allow center (I think an answer from me on this site somewhere) but to be honest I'd probably just do something like \>\vdots in the existing left aligned column it probably works best to tweak the centering "by eye" for such things anyway. Commented Jun 4, 2019 at 8:36
  • A very useful skill, and \hspace{0.6em} will be ok. Thanks for your help.
    – cwind
    Commented Jun 4, 2019 at 8:45
  • 1
    To have a centred ` \vdots` in the middle equation, you can use the \eqmakebox command from package eqparbox
    – Bernard
    Commented Jun 4, 2019 at 9:19
4

Alignat gives you control on the spacing between alignment columns. Here are three variants:

\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} 

enter image description here

3
  • Thanks for your help. Your answer works fine. However, it may not direct as the first answer. It seems the {} before the forth & in first group equations is meaningless.
    – cwind
    Commented Jun 4, 2019 at 9:05
  • Check the spacing of the previous $ with \cdots if you remove them.
    – Bernard
    Commented Jun 4, 2019 at 9:15
  • @cwind: I've added another solution with vertical dots for the middle equation.
    – Bernard
    Commented Jun 4, 2019 at 9:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .