Cases environment with angle brackets
The following code updates cases
to take an optional argument. The optional argument is used as the left delimiter instead of the traditional (default) \lbrace
:
\documentclass{article}
\usepackage{amsmath,etoolbox}
\makeatletter
\renewenvironment{cases}[1][\lbrace]{%
\def\@ldelim{#1}
\matrix@check\cases\env@cases
}{%
\endarray\right.%
}
\patchcmd{\env@cases}{\lbrace}{\@ldelim}{}{}
\makeatother
\begin{document}
\[
f(x) = \begin{cases}
a & \text{if $x < 0$} \\
b & \text{otherwise}
\end{cases}
\]
\[
f(x) = \begin{cases}[\langle]
a & \text{if $x < 0$} \\
b & \text{otherwise}
\end{cases}
\]
\end{document}
It should function as expected, even if nested:
\[
f(x) = \begin{cases}
a & \text{if $x < 0$} \\
b & \begin{cases}[\langle]
{} + c & \text{if $x < 7$} \\
{} + d & \text{otherwise}
\end{cases}
\end{cases}
\]
However, you may be better off using a regular array
. It depends on how you nest the content.
If I understand well, what you want, you can, with some limitations, with the empheq
package (don't load amsmath
: it loads mathtools
, which loads it). The limitation is due to the \langle
not being extensible as much as you please. Actually, it works with two-line cases, possiblt three lines playing with the vertical spacing.
Here's an example:
\documentclass{article}
\usepackage{empheq}
\begin{document}
\begin{empheq}[left={f(x) = \empheqlangle}]{alignat*= 2}
& \smash{x^2} + 1&\quad & \text{if }x > 0 \\
& 1-x && \text{if }x < 0
\end{empheq}
\end{document}