# Tabs in cases environment in an equation

I would like to have a few tabs in a cases environment so that the "for"s and the "u"s in my example (and in the best case the "j"s as well) are on one line, respectively. I tried different environments for equations but I haven't found a solution. The quad-distances don't satisfy me...

\begin{align*}
\phi_{C}(u)=
\begin{cases}
(j-1)\cdot \lambda & \text{for } d_{j-1}\leq u \leq d_{j}-\lambda \qquad j=1,\ldots ,r\\
j\cdot \lambda +u-d_{j} & \text{for } d_{j}-\lambda\leq u\leq d_{j} \qquad \qquad j=1,\ldots ,r-1 \qquad  \text{with } r\geq 2 \\
r\cdot \lambda +u-d_{r} & \text{for } d_{r}-\lambda\leq u
\end{cases}
\end{align*}

• – moewe May 10 '15 at 16:56

We can define a multicases environment modeled on cases that accepts as argument the number of conditions:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newenvironment{multicases}[1]
{\let\@ifnextchar\new@ifnextchar
\left\lbrace\def\arraystretch{1.2}%
{\endarray\right.\kern-\nulldelimiterspace}
\makeatother

\begin{document}
\begin{equation*}
\phi_{C}(u)=
\begin{multicases}{2}
(j-1)\cdot \lambda      & \text{for } d_{j-1}\leq u \leq d_{j}-\lambda & j=1,\dots ,r\\
j\cdot \lambda +u-d_{j} & \text{for } d_{j}-\lambda\leq u\leq d_{j}    & j=1,\dots ,r-1 \text{ with } r\geq 2 \\
r\cdot \lambda +u-d_{r} & \text{for } d_{r}-\lambda\leq u
\end{multicases}
\end{equation*}
\end{document}


Use \dots and not \ldots. It's possibly improved by adding parentheses around the additional conditions:

Easy with alignat and empheq to replace the cases environment. Empheq loads mathtools, hence amsmath:

\documentclass[a4paper, 11pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}
\usepackage{fourier}

\begin{document}

\begin{alignat*}{4}[left = {ϕ_{C}(u)=\empheqlbrace}]
& (j-1) · λ & \quad & \text{for\enspace } & d_{j-1} & \leq u \leq d_{j}-λ & \qquad & j=1,\ldots ,r \\
& j · λ +u-d_{j} & & \text{for } & d_{j}-λ & \leq u\leq d_{j} & & j=1,\ldots ,r-1 \quad \text{with } r\geq 2 \\
& r · λ +u-d_{r} & & \text{for } & d_{r}-λ & \leq u
\end{alignat*}

\end{document}


Isn't an elegant response, but it works.

\begin{align*}
\phi_{C}(u)=
\begin{cases}
(j-1)\cdot \lambda & \text{for } \;\,d_{j-1}\;\leq u \leq    d_{j}-\lambda \qquad j=1,\ldots ,r\\
j\cdot \lambda +u-d_{j} & \text{for } d_{j}-\lambda\leq u\leq d_{j} \qquad \quad\;\;\, j=1,\ldots ,r-1 \qquad  \text{with } r\geq 2 \\
r\cdot \lambda +u-d_{r} & \text{for } d_{r}-\lambda\leq u
\end{cases}
\end{align*}