Want to display two piecewise functions on the same line. Currently using 'cases' to define two piecewise functions on two separate lines. It looks ugly. They can fit on the same line, but how?
-
2Could you please create an image of the undesired and desired output you're after? It's not that clear from the question. Do so by including an image of both, if you cannot produce it in (La)TeX yourself. You can even create it in another editor (like MS Word), if need be.– Werner ♦Feb 9, 2013 at 5:29
1 Answer
You can cascade two cases
on the same line as follows:
Code:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
f(x) = \begin{cases}
0 & \text{if } x < 0 \\
1 & \text{if } x \ge 0
\end{cases} \quad
g(x) = \begin{cases}
f(x)+1 & \text{if } x < 0 \\
f(x)-1 & \text{if } x \ge 0
\end{cases}
\end{equation*}
\end{document}