# Braces and alignment

\begin{align}
\begin{cases}
2x + y &= 5 \\
2x - 3y &= 1
\end{cases} \\
\hline
0x + 4y &= 4
\end{align}


Is there any way to keep all equal signs aligned both inside and outside the cases?

• Welcome to TeX.SE. Just out of idle curiosity: What's the purpose of the curly brace to the left of the first two rows? (Hint: Without that curly brace, a solution would be very simple...) – Mico Dec 6 '18 at 14:50
• Yes, without it the alignment becomes easy. The braces are used to represent the linear system, while the last line simply represents the answer. – Lean P Dec 6 '18 at 15:18

You can get something like this with blkarray.

\documentclass[fleqn]{article}
\usepackage{blkarray}
\begin{document}
$\begin{blockarray}{r@{\,}l} \begin{block}{\{r@{\,}l} 2x+y &=5\\ 2x-3y &=1\\ \BAhline \end{block} 0x+4y&=4 \end{blockarray}$
\end{document}


Without additional packages it becomes less straightforward/elegant.

\documentclass[fleqn]{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\left\{
\begin{array}{@{}r@{\,}l}
2x + y \,&= 5 \\
2x - 3y \,&= 1\\
\end{array} \right.&\\
\hline
0x + 4y = 4~~&
\end{align*}
\end{document}


• Sadly, I'm writing to a wiki that doesn't contain this package (and I can't call it as well) and couldn't make it work. However, I appreciate the effort. – Lean P Dec 6 '18 at 15:20
• @LeanP Could you perhaps append the information which packages you are using/loading? – marmot Dec 6 '18 at 15:23
• I'm working in an article for wikiHow and unfortunately don't know which packages their platform preloads by default. Even so, given that there might not be an obvious solution, I'll do my best to align them manually and move on. I'll definitely suggest adding 'blkarray' to their packages, though! – Lean P Dec 6 '18 at 15:32
• @LeanP I added a version without additional packages but of course it is less elegant. – marmot Dec 6 '18 at 15:35
• No success until I've manually added some spaces ('\') to align them as much as possible. The result can be seen in [ imgur.com/a/mfgNCX6 ]. Not elegant, I know, but it'll have to do for now. Thank you for the effort! – Lean P Dec 6 '18 at 16:11