TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For example, the following is not very nice:

f(x)  \text{       if } f(x) \le N, \\
\newline N  \text{     if } f(x) \gt N.

How can I make it nicer?

share|improve this question
Welcome to tex.sx! A tip: If you indent lines by 4 spaces, then they are marked as a code sample. You can also highlight the code and click the "code" button (with "101010" on it). – Caramdir Apr 15 '11 at 22:46
Thanks, Caramdir. – Qiang Li Apr 15 '11 at 23:08
up vote 2 down vote accepted

Insert ampersands & as alignment symbols:

    f(x) &\text{ if } f(x) \le N, \\
    \newline N &\text{ if } f(x) > N.


enter image description here

share|improve this answer
I would delete the \newline in the answer; if more vertical space is needed, there's \\[3ex] (or any other dimension). – egreg Apr 16 '11 at 9:42
@egreg: good tip! I just modified the code in the question for the desired horizontal alignment. \newline shouldn't be there. – Stefan Kottwitz Apr 16 '11 at 9:58

Your Answer


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.