0

So I'm trying to do a simple thing with cases:

$
\begin{cases}
-x+5y&=6\\
x-3y&=-4\\
\end{cases}
\\
\begin{cases}
-x+5y&=6\\
x&=3y-4\\
\end{cases}
$

And of course, LaTeX doesn't do what it should. For some reason, the "x" is far to the left.

enter image description here

How to make it look centered around the equal sign?

6
  • The alignment point in cases is for the “conditions”, not for aligning equals signs.
    – egreg
    Nov 14, 2020 at 15:48
  • .... So how do I write the system of equations like people do?! Nov 14, 2020 at 15:49
  • 2
    'LaTeX doesn't do what it should' --- It did what your code told it to do. Also you don't have to dig through a mountain of websites. Try starting with the Not So Short Guide and the Short Math Guide. Nov 14, 2020 at 16:15
  • I dug through the first one years ago. My point is that it's not intuitive, unlike regular word processors. Nov 14, 2020 at 16:28
  • It's intuitive once you get to grips with it. It's like a programming language: it does what you tell it to. Nov 14, 2020 at 16:31

2 Answers 2

2

The cases environment is not meant for systems of equations as the name itself hints.

You want a proper alignment environment, most likely aligned:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align*}
&\left\{
  \begin{aligned}
  -x+5y&=6\\
  x-3y&=-4\\
  \end{aligned}
\right.
\\
&\left\{
  \begin{aligned}
  -x+5y&=6\\
  x&=3y-4\\
  \end{aligned}
\right.
\end{align*}

\end{document}

enter image description here

2
  • Well, okay, that works, Cases automatically added the curly brackets, so I wouldn't have to reinvent the wheel. One more problem, now the whole thing is in the center of the page, previously it was to the left of the oage like I wanted. Nov 14, 2020 at 16:02
  • Also, what about the columns? What if I'd like to insert second system of equations next to it? Nov 14, 2020 at 16:25
1

For the first ‘cases’, thez systeme package yields a nicer layout (and a simpler code). For the second “cases’, you can use the aligned environment inside cases:

\documentclass[12pt,a4paper]{article}

\usepackage{systeme}
\usepackage{mathtools}

\begin{document}

\noindent$
\systeme{-x+5y=6, x-3y=-4}
\\[1ex]
\begin{cases}
\begin{aligned}
-x+5y & =6,\\ x & =3y-4
\end{aligned}
\end{cases}
$

\end{document}

enter image description here

2
  • Oh, cool, aligned inside cases. That simplifies things. Thanks! Nov 14, 2020 at 16:19
  • 1
    Don't forget that cases adds unwanted space on the right.
    – egreg
    Nov 14, 2020 at 16:20

You must log in to answer this question.

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