## LaTeX forum ⇒ Math & Science ⇒ Proper alignment of cases within align environment possible?

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Phillip
Posts: 2
Joined: Tue Dec 30, 2014 8:39 pm

### Proper alignment of cases within align environment possible?

Dear community,

there are several equations with domains. Some of these equations include cases.

Do you know any way that allows a consistent horizontal alignment of the domains?

The environment cases inside align results in that domains are not aligned at the same position.

Example

\begin{align}a_i &= \begin{dcases}b_i & i \leq 0 \\c_i & i < 0 \end{dcases} \\d_i &= e_i &\forall i\end{align}

Thank you in advance and happy New Year!
Phillip
Attachments
Example
Clipboard02.jpg (6.6 KiB) Viewed 11807 times

Tags:

Johannes_B
Site Moderator
Posts: 4101
Joined: Thu Nov 01, 2012 4:08 pm
High and welcome, i did not test your example, because it is not compilable and my battery is low. But you are ending the line after the casses environment with a double backslash. If i understood you correctly, you need to write »for all i« just before ending the line, i.e. \end{cases} \forall i \\
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Phillip
Posts: 2
Joined: Tue Dec 30, 2014 8:39 pm

I think I did not clearly present the problem.

Please take a look at this picture. It is a photo montage. It shows what the result should look like. You can see that equality signs are aligned AND the domains are aligned.

Unfortunately, your suggestion does not result in such an output.
Attachments
photo montage of desired outcome
Clipboard09.jpg (5.96 KiB) Viewed 11786 times

Johannes_B
Site Moderator
Posts: 4101
Joined: Thu Nov 01, 2012 4:08 pm
Sorry for the late reply, your question somehow got lost within myy stack.

I am not sure if it is possible to align that properly, i would simply suggest to space this by hand. If you have to do this multiple times, this isn't a good solution though.
\documentclass{article}\usepackage{mathtools}\begin{document}\begin{align}	a_i &=	\begin{dcases}		b_i & i \leq 0 \\		c_i & i < 0	\end{dcases} \\	d_i &= e_i \quad\quad\forall i\end{align}\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.