Align equations using \begin{cases}

I'm looking to have the beginning of the bottom equation aligned with the beginning of the top equation. Similarly, I would like to have all the "for"s aligned, so the bottom ones aligned with the top ones too. What's the best way to do this?

\documentclass[a4paper,12pt,default,numbered,print,index]{article}
\usepackage{lipsum}
\usepackage{enumitem}
\usepackage{graphicx} % Required for the inclusion of images
\usepackage{setspace} % for use of \singlespacing and \doublespacing
\usepackage{pdfpages}
\usepackage{cite}
\usepackage[section]{placeins}
\usepackage{comment}
\usepackage{siunitx}
\usepackage{color}
\usepackage{ragged2e}
\usepackage{esvect}
\usepackage{mathtools}
\usepackage{lscape}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{array}
\usepackage{soul}
\usepackage{bm}
\usepackage{url}
\usepackage{xparse}
\usepackage{hyperref}

\begin{document}

$$\frac{p'}{\gamma \bar{p}}\Bigg|_d(x,t) \approx \begin{cases} (P_d^+ + P_d^-R_1e^{-2\alpha(L_1 + x)})(1 + R_2e^{-2\alpha(L_2 - x)})\\ \times \dfrac{1- (R_1R_2e^{-2\alpha L})^{\lfloor (t + T)/T\rfloor}}{1-R_1R_2e^{-2\alpha L}} & \text{for}\enspace t \in [0,t_p] \\ 2P_D(R_1R_2e^{-2\alpha L})^{\lfloor (t - t_p + T)/T\rfloor} & \text{for}\enspace t \in ] t_p, +\infty[. \end{cases}$$

$$\frac{p'}{\gamma \bar{p}}\Bigg|_i(x,t) \approx \begin{cases} P_i^+(1 + ^-R_1e^{-2\alpha(L_1 + x)}) \\ \times \dfrac{1- (R_1R_2e^{-2\alpha L})^{\lfloor (t - \tau_c + T)/T\rfloor}}{1-R_1R_2e^{-2\alpha L}} & \text{for}\enspace t \in [0,t_p] \\ 2P_I(R_1R_2e^{-2\alpha L})^{\lfloor (t - t_p - \tau_c + T)/T\rfloor} & \text{for}\enspace t \in ] t_p, +\infty[. \end{cases}$$
\end{document}

• a couple of things somewhat off-topic: (1) the page width in the output you show is larger than what's allowed in the code, or your use of [12pt] in the code example doesn't match the original, since the output from the example doesn't have enough space for the equation number on the first equation to fit where it's shown in the output example; and (2) the spacing between \in and the "open" ] is bad -- this is a case where \left] ... \right[ is necessary. – barbara beeton Aug 25 '17 at 21:10
• would you find a layout where there's an overlap of the first line with the "for" expressions acceptable? (i understand that it's not "usual".) – barbara beeton Aug 25 '17 at 21:13
• hi @barbara beeton - thanks for your comments. I have fixed the space, thanks for pointing it out! Regarding the page width - it's because I'm using a thesis document class. Maybe next time I should upload the document class file along with the code? Is that doable? – jrjrjr Aug 25 '17 at 21:41
• if the document class is an "uncommon" one, it would help if you identify it, but in this case, setting the page width to be the same (maybe with geometry) should be sufficient if you explain what you've done. also, for this example, most of those packages aren't necessary, so omitting them would be appreciated. – barbara beeton Aug 25 '17 at 23:37
• more on the matter of ]...[. if i remember correctly (it's been a long time), that indicates an "open interval", so maybe creating a command \openinterval that puts in the \left] and \right[ around an argument would even make the input easier to read (if a bit longer to type). – barbara beeton Aug 25 '17 at 23:42

Group the two equation environments in a single align and use \mathrlap since the first line is too long.

Note you don't have to load array if you load tabularx.

\documentclass[a4paper,12pt,default,numbered,print,index]{article}
\usepackage{lipsum}
\usepackage{enumitem}
\usepackage{graphicx} % Required for the inclusion of images
\usepackage{setspace} % for use of \singlespacing and \doublespacing
\usepackage{pdfpages}
\usepackage{cite}
\usepackage[section]{placeins}
\usepackage{comment}
\usepackage{siunitx}
\usepackage{xcolor}
\usepackage{ragged2e}
\usepackage{esvect}
\usepackage{mathtools, bm}
\usepackage{lscape}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{soul}
\usepackage{url}
\usepackage{xparse}
\usepackage{hyperref}

\begin{document}

\setcounter{section}{2}
\renewcommand\theequation{\thesection.\arabic{equation}}
\setcounter{equation}{39}
\begin{align}
\frac{p'}{\gamma \bar{p}}\Bigg|_d(x,t) & \approx
\begin{cases}
(P_d^+ + P_d^-R_1e^{-2\alpha(L_1 + x)})(1 + R_2\mathrlap{e^{-2\alpha(L_2 - x)})}\\ \times \dfrac{1- (R_1R_2e^{-2\alpha L})^{\lfloor (t + T)/T\rfloor}}{1-R_1R_2e^{-2\alpha L}}
& \text{for}\enspace t \in [0,t_p]
\\
2P_D(R_1R_2e^{-2\alpha L})^{\lfloor (t - t_p + T)/T\rfloor}
& \text{for}\enspace t \in {] t_p, +\infty[}.
\end{cases} \\[1.5ex]
\frac{p'}{\gamma \bar{p}}\Bigg|_i(x,t) & \approx
\begin{cases}
P_i^+(1 + ^-R_1e^{-2\alpha(L_1 + x)}) \\ \times \dfrac{1- (R_1R_2e^{-2\alpha L})^{\lfloor (t - \tau_c + T)/T\rfloor}}{1-R_1R_2e^{-2\alpha L}}
& \text{for}\enspace t \in [0,t_p]
\\
2P_I(R_1R_2e^{-2\alpha L})^{\lfloor (t - t_p - \tau_c + T)/T\rfloor}
& \text{for}\enspace t \in {] t_p, +\infty[}.
\end{cases}
\end{align}

\end{document}


• please fix the spacing after the \in in the third row of each case. my comment above says how to do that. – barbara beeton Aug 25 '17 at 21:29
• hi @Bernard. Thanks for your comments - the p' side is aligned but the "for" for equation 2.41 isn't aligned with the "for" for 2.40. any way of doing that too? – jrjrjr Aug 25 '17 at 21:40
• @jrjrjr: It's more complex (except adding some space by trial and error). I'll try to find a neater solution, but I can't guarantee. – Bernard Aug 25 '17 at 21:59
• @barbarabeeton: I didn't even notice, but you're right. Not so good semantically, but an additional pair of braces does the job, and it's faster to type. – Bernard Aug 25 '17 at 22:01
• @Bernard -- i had created a test that was much the same as yours, and got a closer alignment of the "for"s. i chose to put the \mathrlap just before the R. then i added \qquad\mathstrut after the left-hand side of the last line in (2.49) and \quad\mathstrut after the left-hand side of the last line in (2.50). it was pretty much pure chance that the alignment was closer, but it looked close enough that further tinkering should be minimized. (the \mathstrut is needed, otherwise the end-of-segment space is gobbled.) – barbara beeton Aug 25 '17 at 23:31