# Splitting a long equation with numerator and denominator over more lines

I tried to split a long equation with numerator and denominator over more lines in different ways (How can I split an equation over two (or more) lines and How to wrap a long equation in Latex), but they do not work (latex gives me error). How can I solve the problem?

The expression (produced by Mathematica) is the following (the splits should occur where there are exponential terms):

y(t) = h(t) = \frac{e^{t
\left(-\frac{k_1}{2}-\frac{k_2}{2}-\frac{k_{12}}{2}-\frac{k_{21}}{2}-\frac{1}{2
} \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1
k_{12}\right)}\right)} k_1 -e^{t
\left(-\frac{k_1}{2}-\frac{k_2}{2}-\frac{k_{12}}{2}-\frac{k_{21}}{2}+\frac{1}{2
} \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1
k_{12}\right)}\right)} k_1-e^{t
\left(-\frac{k_1}{2}-\frac{k_2}{2}-\frac{k_{12}}{2}-\frac{k_{21}}{2}-\frac{1}{2
} \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1
k_{12}\right)}\right)} k_2+e^{t
\left(-\frac{k_1}{2}-\frac{k_2}{2}-\frac{k_{12}}{2}-\frac{k_{21}}{2}+\frac{1}{2
} \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1
k_{12}\right)}\right)} k_2-e^{t
\left(-\frac{k_1}{2}-\frac{k_2}{2}-\frac{k_{12}}{2}-\frac{k_{21}}{2}-\frac{1}{2
} \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1
k_{12}\right)}\right)} k_{12}+e^{t
\left(-\frac{k_1}{2}-\frac{k_2}{2}-\frac{k_{12}}{2}-\frac{k_{21}}{2}+\frac{1}{2
} \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1
k_{12}\right)}\right)} k_{12}+e^{t
\left(-\frac{k_1}{2}-\frac{k_2}{2}-\frac{k_{12}}{2}-\frac{k_{21}}{2}-\frac{1}{2
} \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1
k_{12}\right)}\right)} k_{21}-e^{t
\left(-\frac{k_1}{2}-\frac{k_2}{2}-\frac{k_{12}}{2}-\frac{k_{21}}{2}+\frac{1}{2
} \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1
k_{12}\right)}\right)} k_{21}+e^{t
\left(-\frac{k_1}{2}-\frac{k_2}{2}-\frac{k_{12}}{2}-\frac{k_{21}}{2}-\frac{1}{2
} \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1
k_{12}\right)}\right)} \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1
k_2+k_{21} k_2+k_1 k_{12}\right)}+e^{t
\left(-\frac{k_1}{2}-\frac{k_2}{2}-\frac{k_{12}}{2}-\frac{k_{21}}{2}+\frac{1}{2
} \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1
k_{12}\right)}\right)} \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1
k_2+k_{21} k_2+k_1 k_{12}\right)}}{2
\sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1
k_{12}\right)} V_1}


• When you want to split equations you shouldn't use \left and \right. But \big (or some other form of the parenthesis resizing. To have the fraction work, you should just split it into multiple fractions of appropriate sizes. Commented Dec 7, 2017 at 15:11

I hope I counted well:)

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
A&:=\sqrt{(k_1+k_2+k_{12}+k_{21})^2-4(k_1k_2+k_{21}k_2+k_1k_{12})}\\
B&:=k_1+k_2+k_{12}\\
C&:=k_1-k_2-k_{12}\\
a(t)&:=\exp\left(-\frac{A+B}{2}t\right)\\
b(t)&:=\exp\left(\frac{A-B}{2}t\right)\\
y(t)&=h(t)=\frac{a(t)(A+C+k_{21})+b(t)(A-C)-k_{21}}{2AV_1}
\end{align*}
\end{document}


• It was elementary mathematics and not LaTeX:)
– user91669
Commented Dec 7, 2017 at 17:02
• Hello @tomacs, my goal is to write the whole expression avoiding new definitions. Thank you anyway. Commented Dec 7, 2017 at 18:28
• @Gennaro Arguzzi -- I'm afraid it is not too good idea.
– user91669
Commented Dec 7, 2017 at 18:44