I want to write an equation with one curly brace ({) on the right hand side and, next to the curly, two statements in two different lines. How can i do it using TeX or Latex? Thanks.
Asked
Active
Viewed 1,917 times
3
Moshe Gueta
- 435
- 1
- 4
- 15
Sevdije
- 139
2 Answers
3
I don't know about Noodle but, using the amsmath package you can simply use
\[
f(x) =
\begin{cases}
(x+2)^{2}\,, & x<-2 \\
4-x^{2}\,, & x\ge -2
\end{cases}
\]
samcarter_is_at_topanswers.xyz
- 158,329
Herb Schulz
- 3,410
-
-
That adds a small amount of space before the comm to give some separation from the expressions. – Herb Schulz Jan 16 '17 at 18:22
1
I'll add a few other possibilities, defined by mathtools, an extension of amsmath which it loads, by empheq (which loads mathtools) or by the cases package. Some of them can be individually numbered:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{empheq}
\usepackage{cases} %
\begin{document}
\begin{align*}
\shortintertext{With \texttt{cases} and \texttt{dcases}:}
& f(x) = \begin{cases}
(2x +1)^2& \text{if } x < - \frac{1}{2}\\
1-4x^2 & \text{if } x \ge -\frac{1}{2}
\end{cases}
& & f(x) = \begin{dcases}
(2x +1)^2& \text{if } x < - \frac{1}{2}\\
1-4x^2 & \text{if } x \ge -\frac{1}{2}
\end{dcases}
\end{align*}
\begin{align*}
\shortintertext{With \texttt{rcases} and \texttt{drcases}:}
& f(x) = \begin{rcases}
(2x +1)^2& \text{if } x < - \frac{1}{2}\\
1-4x^2 & \text{if } x \ge -\frac{1}{2}
\end{rcases}
& & f(x) = \begin{drcases}
(2x +1)^2& \text{if } x < - \frac{1}{2}\\
1-4x^2 & \text{if } x \ge -\frac{1}{2}
\end{drcases}
\end{align*}
With \texttt{numcases}:
\begin{subnumcases}{f(x) = }
(2x +1)^2& if $ x < - \frac{1}{2} $\\
1-4x^2 & if $ x \ge -\frac{1}{2} $
\end{subnumcases}
With \texttt{empheq};
\begin{subequations}
\begin{empheq}[left = {f(x) = \empheqlbrace}]{alignat = 2}
& (2x +1)^2 & \quad & \text{if } x < - \frac{1}{2}\\[1ex]
& 1-4x^2 & & \text{if } x \ge -\frac{1}{2}
\end{empheq}
\end{subequations}
\end{document}
Bernard
- 271,350

caseenvironment. – Sigur Jan 16 '17 at 16:44plain TeXin the backend. therefore you might try if$$...$$works. – naphaneal Jan 16 '17 at 17:07casespackage, but onlyarrayone! The solution is:\[ f(x) = \left\lbrace \begin{array}{cc} (x+2)^{2} & x<-2 \\ 4-x^{2} & x\ge -2 \end{array}\right. \]– Moshe Gueta Nov 15 '20 at 09:44