3

I'm trying to typeset a system of linear equations which has multiple place to be aligned. Below is what I have achieved so far:

\documentclass{article}
\usepackage{mathtools}
\begin{document}

[ \left{ \begin{alignedat}{5} &x &+& &&y &=& &&0\ 2&x &+& 3&&y &=& &&0 \end{alignedat} \right. ]

\end{document}

enter image description here

As you can see from the above picture, the spacing seems to be a little bit strange (though I cannot tell exactly where is wrong). Is there some way to improve this result? (I'm using alignat in the MWE, but you may also use array or other methods if better result can be gained.)

Jinwen
  • 8,518

3 Answers3

5

Here's a systeme-based solution.

enter image description here

\documentclass{article}
\usepackage{systeme}
\begin{document}
\[
\systeme{x+y=0,2x+3y=0}
\]
\end{document}
Mico
  • 506,678
3

Two examples:

  • use of array
  • use of a bit simplified your code:
\documentclass{article}
\usepackage{amsmath}

\begin{document}

[\setlength\arraycolsep{1pt} \left{ \begin{array}{rcrl} x & + & y & = 0\ 2x & + & 3y & = 0 \end{array} \right. ] or [ \left{ \begin{alignedat}{3} x & + {} & y & = 0\ 2x & + {} & 3y & = 0 \end{alignedat} \right. ]

\end{document}

enter image description here

Edit: Considered is @David Carlisle comment.

Zarko
  • 296,517
  • Thank you for this. Would you mind explaining a little regarding how does your alignedat work? I used to think that each line of the content of alignedat start with a single &, and then has two &s each time. – Jinwen Sep 17 '22 at 17:37
  • @DavidCarlisle, you are right. Corrected now. – Zarko Sep 17 '22 at 18:09
  • @Jinwen, good explanation about alinedat you can find in https://tex.stackexchange.com/questions/96124/what-is-the-mandatory-argument-of-alignedat-for – Zarko Sep 17 '22 at 18:28
3

enter image description here

I would probably use this form, with alignment points between the coefficients and the variables.

\documentclass{article}
\usepackage{mathtools}
\begin{document}

[ \left{ \begin{alignedat}{3} &x +{}& &y &&=0\ 2&x +{}& 3&y &&=0 \end{alignedat} \right. ]

\end{document}

David Carlisle
  • 757,742