2

I am trying to find a way to break long equations in a cases environment, I tried finding an answer to my question but no question was raised in this regards. Therefore, I decided to put it here.

I have the following equation

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{amsmath}

\begin{document}


\section{Introduction}

\begin{equation*}
    P_{t}^{h}= 
    \begin{cases}
            P_{t-1}^{h}  & \text{ if }A_{t}\leq \sum_{j=1}^{h-1}P_{t-1}^{j}(1+r_{g}) \\ 
            A_{t}-\sum_{j=1}^{h-1}P_{t-1}^{j}(1+r_{g}) &\text{ if } 
            \begin{split}
             & \sum_{j=1}^{h-1}P_{t-1}^{j}(1+r_{g})<A_{t} \\ 
             & \leq \sum_{j=1}^{h}P_{t-1}^{j}(1+r_{g}) \\
            \end{split} \\
            P_{t-1}^{h}(1+r_{g})  & \text{ if } \sum_{j=1}^{h}P_{t-1}^{j}(1+r_{g})<A_{t} \leq (P_{t-1}+C_{t-1})(1+r_{g})+B_{t-1} \\
            \begin{split}
                & P_{t-1}^{h}(1+r_{g})+\frac{P_{t-1}^{h}}{P_{t-1}}\alpha \delta  \\  & \quad \left(1-b\right)[A_{t}-(P_{t-1}+C_{t-1})(1+r_{g})-B_{t-1}]   
            \end{split}
            & \text{ if } (P_{t-1}+C_{t-1})(1+r_{g})+B_{t-1}<A_{t} \\
        \end{cases}
\end{equation*}

\end{document}

Which prints out as so enter image description here

Where as you can see this looks very bad. Can someone help me to sort things out?

Thank you in advance

  • try aligned instead of split, remember it takes an optional arg [c|t|b] that tells aligned how to vertically align, default is c. That being said, I'd probably rewrite this as it will probably never be readable in this form. BTW: please always post full minimal examples instead of just sniplets. That makes it easy for others to just copy your code and mess with it immediately. – daleif Apr 3 '18 at 13:32
  • @daleif thank you so much just did your recommendation. – rsc05 Apr 3 '18 at 13:37
  • @daleif tried aligned same problem stays – rsc05 Apr 3 '18 at 13:39
2

I don't think there's a decent way to split the last case, so I suggest a different way to set the display: the condition is added in the line below the formula, at 4em distance from the brace.

The first case is dealt with a box 4em wide, as the formula is too short.

\documentclass{article}
\usepackage{amsmath,mathtools}

\begin{document}

\begin{equation*}
\label{DonkelandEquation}
P_{t}^{h}= 
\begin{dcases}
\mathmakebox[4em][l]{P_{t-1}^{h}}
  \text{if }
  A_{t}\leq \sum_{j=1}^{h-1}P_{t-1}^{j}(1+r_{g})
\\[1ex]
A_{t}-\sum_{j=1}^{h-1}P_{t-1}^{j}(1+r_{g}) \\
  \qquad\qquad\text{if } 
    \sum_{j=1}^{h-1}P_{t-1}^{j}(1+r_{g})<A_{t}
    \leq \sum_{j=1}^{h}P_{t-1}^{j}(1+r_{g})
\\[1ex]
P_{t-1}^{h}(1+r_{g}) \\
  \qquad\qquad\text{if }
  \sum_{j=1}^{h}P_{t-1}^{j}(1+r_{g})<A_{t}
  \leq (P_{t-1}+C_{t-1})(1+r_{g})+B_{t-1}
\\[1ex]
P_{t-1}^{h}(1+r_{g})+\frac{P_{t-1}^{h}}{P_{t-1}}\alpha \delta
  (1-b)[A_{t}-(P_{t-1}+C_{t-1})(1+r_{g})-B_{t-1}] \\
  \qquad\qquad\text{if }
  (P_{t-1}+C_{t-1})(1+r_{g})+B_{t-1}<A_{t}
\end{dcases}
\end{equation*}

\end{document}

With dcases everything is typeset in display style.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.