I tried using the cases to code this, but I only can put them in two separate lines, not along the same line.
Asked
Active
Viewed 114 times
1
2 Answers
5
cases can be normally concatenated horizontally:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
p_n =
\begin{cases}
x_n, & \text{ if } x_n \ge 0 \\
0, & \text{ if } x_n < 0
\end{cases} \qquad \text{and} \qquad
m_n =
\begin{cases}
-x_n, & \text{ if } x_n \le 0 \\
0, & \text{ if } x_n > 0
\end{cases}
\end{equation}
\end{document}
AboAmmar
- 46,352
- 4
- 58
- 127
2
I'm not very keen to answer on question of type do-it-for-me ... but since AboAmmar was good soul :) and provide MWE, I will exploit his solution to show an alternative available with mathools package:
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation}
p_n =
\begin{cases*}
x_n, & if $x_n \ge 0$ \\
0, & if $x_n < 0$
\end{cases*}
\qquad \text{and} \qquad
m_n =
\begin{cases*}
-x_n, & if $x_n \le 0$ \\
0, & if $x_n > 0$
\end{cases*}
\end{equation}
\end{document}
Zarko
- 296,517



casesenvironments formamsmathpackage ... – Zarko Feb 20 '17 at 19:08