Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
2  
Could 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 '13 at 5:29

1 Answer 1

up vote 10 down vote accepted

You can cascade two cases on the same line as follows:

enter image description here

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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.