I thought maybe fractions without fraction bar, but seems inconvenient. Also, how would I extend this for more than 2 lines?
-
2Please add a compilable code that produces the unwanted result, including the packages used. – Simon Dispa Mar 28 '22 at 19:19
-
1See e.g. https://tex.stackexchange.com/q/12157/82917 – campa Mar 28 '22 at 19:44
-
1I'd suggest editing the title of this question so it is more useful when searched, or just informative to the reader. – frabjous Mar 29 '22 at 02:57
3 Answers
You can do this with \aligned:
\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}
- 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
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.
- 74,238
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.
- 1,121,712


