3

The following code:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\begin{cases}
   Af &=g \quad \text{if} \ c,\\
   f&=0 \quad \text{if} \ d.
\end{cases}$
\end{document}

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)?

wondering
  • 741

2 Answers2

7

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?.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\left\{\!\begin{aligned}
   Af &=g && \text{if} \ c,\\
   f &=0 && \text{if} \ d.
\end{aligned}\right.$
\end{document}

enter image description here

Henri Menke
  • 109,596
5
\documentclass{scrartcl}
\usepackage{mathtools}
\begin{document}
\[
  \begin{cases}
    Af=g & \text{if} \ c, \\
    \phantom{A}f = 0 & \text{if} \ d.
  \end{cases}
\]
\end{document}

Altough I tend to prefer

\begin{cases*}
  Af=g & if $c$, \\
  \phantom{A}f = 0 & if $d$.
\end{cases*}
Manuel
  • 27,118