# how to write a piecewise function in one line

I have a piecewise function $$f(x)$$, it takes up too much space, I want to conserve space when writing it. Is there a practical and professional way to write it in a single line, so I save some space? $$f(x) = \begin{cases} a, & x = 0 \\ b, & x = 1 \\ c, & x \neq 0,1 \end{cases}$$

• I have voted to close this question as off-topic, because it is not about mathematics (it is about typesetting, really). You might be better off asking at TeX - LaTeX. – Xander Henderson Feb 11 at 17:40
• @XanderHenderson It has more to do with formalism of math expression, but math nonetheless I think. – updraft Feb 11 at 18:03

It's common to use $$1_A(x)$$ to denote $$1_A(x) = 1$$ for $$x\in A$$ and $$=0$$ everywhere else. Hence, we can rewrite $$f$$ as $$f(x) = a1_{0} +b1_{1} + c1_{\{0,1\}^c}$$