LaTeX forum ⇒ Math & ScienceProper 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?

Postby Phillip » Tue Dec 30, 2014 9:06 pm

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
Clipboard02.jpg
Example
Clipboard02.jpg (6.6 KiB) Viewed 10722 times

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Tue Dec 30, 2014 10:03 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

Postby Phillip » Tue Dec 30, 2014 11:25 pm

Thanks for your quick response!

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
Clipboard09.jpg
photo montage of desired outcome
Clipboard09.jpg (5.96 KiB) Viewed 10701 times

User avatar
Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Tue Jan 06, 2015 5:22 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.
  1. \documentclass{article}
  2. \usepackage{mathtools}
  3. \begin{document}
  4. \begin{align}
  5. a_i &=
  6. \begin{dcases}
  7. b_i & i \leq 0 \\
  8. c_i & i < 0
  9. \end{dcases} \\
  10. d_i &= e_i \quad\quad\forall i
  11. \end{align}
  12. \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.


Return to “Math & Science”

Who is online

Users browsing this forum: No registered users and 2 guests