The following code:

   Af &=g \quad \text{if} \ c,\\
   f&=0 \quad \text{if} \ d.

gives enter image description here

How to align the two f's vertically (so that they are both in the same distance from the '=' sign)?

  • I don't see the reason for \quad there. In the second line, write \phantom{A}f to get the fs aligned.
    – Manuel
    Mar 23 '16 at 9:02
  • @Manuel Yes, that is what I wanted. But is there not any other solution, like specifying the alignment requirements in the options of 'cases'?
    – wondering
    Mar 23 '16 at 9:05
  • Ah, I see, in {cases}, the & is there to separate columns, not before the equal.
    – Manuel
    Mar 23 '16 at 9:06
  • @Manuel Sorry, I don't get what you mean and how it can help me.
    – wondering
    Mar 23 '16 at 9:11
  • You are not supposed to write &= inside a {cases} environment.
    – Manuel
    Mar 23 '16 at 10:22

Use aligned instead of cases. If you wonder, why there is \! after \left\{, see Why is there a \, space at the beginning of the “aligned” environment?.

   Af &=g && \text{if} \ c,\\
   f &=0 && \text{if} \ d.

enter image description here

    Af=g & \text{if} \ c, \\
    \phantom{A}f = 0 & \text{if} \ d.

Altough I tend to prefer

  Af=g & if $c$, \\
  \phantom{A}f = 0 & if $d$.

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.