[Tex/LaTex] Break Large Equation Between Parenthesis Using Multline

alignamsmathequationsmath-modemultline

I have a very large equation that I need to write in multiple lines, but multiline is not working between parenthesis.

This is my LaTeX code:

\begin{multline}
  e^{-y \lambda_n} 
  \left( 
  -\frac{1}{2} \cosh\left(y \lambda_n\right) \text{csch}\left(H \lambda_n\right) e^{(H  +  y) \lambda_n} \int_0^H \frac{\rho  e^{  -  K_2 \lambda_n}}{\lambda_n}\left(\hb_n(K_2,t)  -  \gb_n(K_2,t)\right) \, \dd K_2  +  \\
  \frac{1}{4} \left(e^{2 y \lambda_n}  +  1\right) \left(\coth \left(H \lambda_n\right)  -  1\right) \int_0^H \frac{\rho  e^{K_1 \lambda_n}}{\lambda_n}\left(\gb_n(K_1,t)  -  \hb_n(K_1,t)\right) \, \dd K_1  +  \\
  \frac{1}{2} \int_0^y \frac{\rho  e^{K_1 \lambda_n}}{\lambda_n}\left(\gb_n(K_1,t)  -  \hb_n(K_1,t)\right) \, \dd K_1  +  \\
  \frac{1}{2} e^{2 y \lambda_n} \int_0^y \frac{\rho  e^{  -  K_2 \lambda_n}}{\lambda_n}\left(\hb_n(K_2,t)  -  \gb_n(K_2,t)\right) \, \dd K_2
  \right)
\end{multline}

Best Answer

\ļeft and \right need to be balanced before changing line. You can balance a \left( with \right. and a \left. balances a \right) (notice the dot), as in Boris' answer.

However, I would suggest you to use the \bigl, \bigr family of commands; they don't have to be balanced, they produce more consistent spacing, and they don't require eventual trickery as the use of phantoms to adjust the size.

In the example below I provided some fake definitions for some of the commands you were using without providing the definitions, and suppresses some of the superfluous \left, \right pairs, but in fact, you can dispense the use of all of them with the family I mentioned.

\documentclass{article}
\usepackage{amsmath}

\newcommand\hb{HB}
\newcommand\gb{GB}
\newcommand\dd{DD}

\DeclareMathOperator{\csch}{csch}

\begin{document}

\begin{multline}
  e^{-y \lambda_n} 
  \Biggl( 
  -\frac{1}{2} \cosh (y \lambda_n) \csch (H \lambda_n) e^{(H  +  y) \lambda_n} \int_0^H \frac{\rho  e^{  -  K_2 \lambda_n}}{\lambda_n}\left(\hb_n(K_2,t)  -  \gb_n(K_2,t)\right) \, \dd K_2  \\
   {} + \frac{1}{4} (e^{2 y \lambda_n}  +  1) \bigl(\coth \left(H \lambda_n\bigr)  -  1\right) \int_0^H \frac{\rho  e^{K_1 \lambda_n}}{\lambda_n}\left(\gb_n(K_1,t)  -  \hb_n(K_1,t)\right) \, \dd K_1  \\
  {}+\frac{1}{2} \int_0^y \frac{\rho  e^{K_1 \lambda_n}}{\lambda_n}\left(\gb_n(K_1,t)  -  \hb_n(K_1,t)\right) \, \dd K_1  \\
 {}+ \frac{1}{2} e^{2 y \lambda_n} \int_0^y \frac{\rho  e^{  -  K_2 \lambda_n}}{\lambda_n}\left(\hb_n(K_2,t)  -  \gb_n(K_2,t)\right) \, \dd K_2
  \Biggr)
\end{multline}

\end{document}

Notice also than when breaking an expression at a binary operator, the operator usually goes in the new line (as in my example) and not in the old line (as in your code), but there are exceptions to this (Russian use, I think).

Notice also the use of

\DeclareMathOperator{\csch}{csch}

instead of \text{csch} to obtain right font and spacing.