0

A have some equations that I would like to align. Some of these equations are very similar and are grouped together in a cases environment. Now, I can't manage to align all these equations to have their = sign above each other.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\begin{document}
\begin{align}
    a = 1 \\
    \begin{cases}
        b = 2 \\
        cc = 3 
    \end{cases} \\
    ddd = 4
\end{align}
\end{document}

enter image description here

1 Answer 1

2

(Even equations (1) and (3) are not aligned at the = sign, they are right-aligned.)

The following solution re-uses ideas from https://tex.stackexchange.com/a/633624/255231:

{\offinterlineskip
\setbox0=\vbox{\halign{\hfil$\strut#$&${}#$\hfil\cr
  \noalign{\penalty0} %first \vsplit here
  a&=1\cr %second \vsplit here
  b&=2\cr\noalign{\nobreak}
  cc&=3\cr %third \vsplit here
  ddd&=4\cr}}
\setbox1=\vsplit0 to0pt %insert \splittopskip at the top of \box0
\setbox1=\vsplit0 to12pt %split off first group
\setbox1=\vbox{\unvbox1} %give \box1 its natural height
\setbox2=\vsplit0 to12pt %split off second group
\setbox2=\vbox{\unvbox2} %give \box2 its natural height
\tabskip 0pt plus1fill
\halign to\hsize{\hfil$#$&\hfil(#)\tabskip 0pt\cr
  \left.\vcenter{\box1}\right.&1\cr
  \left\{\vcenter{\box2}\right.&2\cr
  \left.\vcenter{\box0}\right.&3\cr}}

enter image description here

You must log in to answer this question.

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