0

enter image description here

I thought maybe fractions without fraction bar, but seems inconvenient. Also, how would I extend this for more than 2 lines?

3 Answers3

6

You can do this with \aligned:

enter image description here

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

[ \left[\begin{aligned}&x^2+2x-3(x+1)+3=0,&x+1\ge0\ &x^2+2x-3(-x-1)+3=0,&x+1<0\end{aligned}\right.\Rightarrow \left[\begin{aligned}&x^2-x=0,&x\ge-1\ &x^2+5x+6=0,&x<-1\end{aligned}\right.\Rightarrow \left[\begin{aligned}&x=1,x=0\&x=-2,x=-3\end{aligned}\right. ]

\end{document}

Sandy G
  • 42,558
  • LaTeX commands are OK, but in book writing avoid such writing. For readability, it is preferably to write step-by-step calculations.. equations placed below each other better, I feel. – Dr. Sundar Mar 29 '22 at 07:57
2

The plain TeX's \eqalign macro allows only two aligned columns, but OpTeX's \eqalign macro is more flexible and it allows arbitrary number of columns, see Typesetting Math with OpTeX, page 27. So, something like this is working:

\def\ralign#1{\left[\eqalign{#1}\right.}
$$
  \ralign{&x^2+2x-3(x+1)+3=0,&x+1\ge0\cr &x^2+2x-3(-x-1)+3=0,&x+1<0} \Rightarrow
  \ralign{&x^2-x=0,&x\ge-1\cr &x^2+5x+6=0,&x<-1} \Rightarrow
  \ralign{&x=1,x=0\cr &x=-2,x=-3}
$$

\bye

In pure Plain TeX, you must to define such extended \eqalign macro yourself using combination of \vcenter and \halign primitives.

wipet
  • 74,238
2

You can define your own environment modelled on cases:

\documentclass{article}
\usepackage{amsmath}

\newenvironment{orcases} {% \left\lbrack \renewcommand{\arraystretch}{1.2}% \array{@{}l@{\quad}l@{}} } {\endarray\right.}

\begin{document}

[ \begin{aligned} \begin{orcases} x^2+2x-3(x+1)+3=0, & x+1\ge0 \ x^2+2x-3(-x-1)+3=0, & x+1<0 \end{orcases} & \Rightarrow \begin{orcases} x^2-x=0, & x\ge-1 \ x^2+5x+6=0, & x<-1 \end{orcases} \ & \Rightarrow \begin{orcases} x=1, x=0 \ x=-2, x=-3 \end{orcases} \end{aligned} ]

\end{document}

I added a wrapping aligned, because the whole thing is too long for a single line.

enter image description here

egreg
  • 1,121,712