3

I'm working with a long equation in case environment, the problem is that the equation overlaps the equation number... any ideas on how to solve that problem.

I've thought on aligning it all to the left, tried flushleft but i can't manage it to work.

  \begin{numcases}{\phi(x) =}
       -\frac{e^{-\frac{x}{k}}T_0\Big(-ke^{\frac{L}{2k}}-e^{\frac{x}{k}}(k+x)+ke^{\frac{2x}{k}}+e^{\frac{L+2x}{2k}}(k-x)\Big)}{2\Big(1+e^{\frac{L}{2k}}\Big)GJ_t}\text{,} &  $x \in [0,\frac{L}{2}],$   \\
       \frac{e^{-\frac{L+2x}{2k}}T_0\Big(-ke^{\frac{3L}{2k}}+ke^{\frac{2x}{k}}+e^{\frac{L+2x}{2k}}(k+L-x)+e^{\frac{L+x}{k}}(-k+L-x)\Big)}{2\Big(1+e^{\frac{L}{2k}}\Big)GJ_t}\text{,} &  $x \in [\frac{L}{2},L].$
  \end{numcases}
Sebas
  • 31
  • 1

2 Answers2

3

Here is one possibility.

\documentclass{article}
\usepackage{mathtools}
\usepackage{empheq}

\begin{document}
    \begin{empheq}[left={\phi(x) =\empheqlbrace}]{align}
       &-\frac{e^{-\frac{x}{k}}T_0(A)}{2\Big(1+e^{\frac{L}{2k}}\Big)GJ_t}\text{,} &  x \in \biggl[0,\frac{L}{2}\biggr],   \\
       &\frac{e^{-\frac{L+2x}{2k}}T_0(B)}{2\Big(1+e^{\frac{L}{2k}}\Big)GJ_t}\text{,} &  x \in \biggl[\frac{L}{2},L\biggr].
  \end{empheq}
  where
  \begin{align*}
A &= -ke^{\frac{L}{2k}}-e^{\frac{x}{k}}(k+x)+ke^{\frac{2x}{k}}+e^{\frac{L+2x}{2k}}(k-x) \\
B &=  -ke^{\frac{3L}{2k}}+ke^{\frac{2x}{k}}+e^{\frac{L+2x}{2k}}(k+L-x)+e^{\frac{L+x}{k}}(-k+L-x)
  \end{align*}
\end{document}

enter image description here

2

There's no hope of having those long formulas in one line.

  1. The denominator is the same, so you can move it in front of \phi(x)
  2. The denominators can be split across two or three lines
  3. numcases should not be used

Example

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

\begin{document}

\begin{empheq}[
  left={2\bigl(1+e^{\frac{L}{2k}}\bigr)GJ_t\phi(x)=\empheqlbrace}
]{align}
&\begin{aligned}
  &-e^{-\frac{x}{k}}T_0\Bigl(-ke^{\frac{L}{2k}}-e^{\frac{x}{k}}(k+x) \\
  &\qquad+ke^{\frac{2x}{k}}+e^{\frac{L+2x}{2k}}(k-x)\Bigr),
\end{aligned}
  &  x \in \biggl[0,\frac{L}{2}\biggr],   \\[2ex]
&\begin{aligned}
  &e^{-\frac{L+2x}{2k}}T_0\Bigl(-ke^{\frac{3L}{2k}} \\
  &\qquad+ke^{\frac{2x}{k}}+e^{\frac{L+2x}{2k}}(k+L-x) \\
  &\qquad+e^{\frac{L+x}{k}}(-k+L-x)\Bigr),
\end{aligned}
  &  x \in \biggl[\frac{L}{2},L\biggr].
\end{empheq}

\end{document}

enter image description here

egreg
  • 1,121,712