# Vertically aligning multiple elements in piecewise equation using cases

I have the following LaTeX code. It produced output aligned along the commas that divide the equations from their respective areas of validity, as shown below.

$$\begin{cases} i_0-\sqrt{2\ln{2}}\sigma\leq i_k\leq i_0+2\sigma, & i_0>0\\ i_0-3\sigma\leq i_k\leq i_0+\sqrt{2\ln{2}}\sigma, & i_0<0 \end{cases},$$


I would like to have the i_k vertically aligned as well as the commas. When I try to insert extra alignment markers I get a compilation error. Is there a simple way to have multiple points of vertical alignment in the cases environment, or is there a different environment that I can use for this purpose which would allow for this?

Use alignedat. I'll show a version with commas next to the formula and a version with aligned commas.

In general, I'd avoid commas hanging from nowhere, like the one you put after cases. If you want full punctuation, add commas after i_0>0 and i_0<0

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{cases} \begin{alignedat}{3} i_0-\sqrt{2\ln 2}\,\sigma &\leq i_k &&\leq i_0+2\sigma, &\qquad& i_0>0\\ i_0-3\sigma &\leq i_k &&\leq i_0+\sqrt{2\ln 2}\,\sigma, &\qquad& i_0<0 \end{alignedat} \end{cases}

\begin{cases} \begin{alignedat}{3} i_0-\sqrt{2\ln 2}\,\sigma &\leq i_k &&\leq i_0+2\sigma &,\qquad& i_0>0\\ i_0-3\sigma &\leq i_k &&\leq i_0+\sqrt{2\ln 2}\,\sigma &,\qquad& i_0<0 \end{alignedat} \end{cases}

\end{document}


I also introduced a couple of refinements.

1. \log{2} is wrong: try \log{\sin{x}} and \log\sin x to realize why.1
2. After a square root, a \, can help in better clarifying the meaning.

1 \ln is no different; it's just I can't bear that notation for the logarithm. ;-)