I can't seem to align variables properly since one of them leaves its sign behind on alignment.


    a\medspace{}\text{if \dots}\\
    -a\medspace{}\text{if \dots}

    &a\medspace{}\text{if \dots}\\
    -&a\medspace{}\text{if \dots}


I would like to avoid using \phantom as well as complicated macros.

This is what I'm looking for (from a book):

  • 3
    I don't understand why there is a ban on \phantom here? It seems like an ideal place to use it. All other options will just require more work-around and more code... – Werner Feb 17 at 5:59

Updated standaloneclass and aligned environment

| x | =
    &a\quad\text{if \dots}\\
    -&a\quad\text{if \dots}

enter image description here

  • 1
    @bp2017 answer updated – Hafid Boukhoulda Feb 17 at 3:43
  • 1
    @bp2017 answer updated using standalone class and aligned environment – Hafid Boukhoulda Feb 17 at 6:40

Since you banned \phantom ....


    a &\text{if \dots}\\
    - a &\text{if \dots}
    \end{array} \right.



  1. `standalone' is not for this purpose

  2. use [ ] for display math (or the equation environment if numbered)

  3. There is nothing wrong with \phantom

  • Why? Is this homework? – JPi Feb 17 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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