# Long equation doesn't fit within text block

Question:

I have been typing a very long equation but it doesn't fit on the page. What I have provided for the following MWE is for the document class article for the landscape page. My original page is an A4 paper article in portrait. Can anyone help me with this issue? How can I put this lengthy equation on my page?

MWE:

\documentclass[a4paper,landscape]{article}
\usepackage[a4paper,margin=1in,landscape]{geometry}
\usepackage{amsmath}

\begin{document}
\begin{flalign}
\begin{aligned}
f_{1}\left(y\,,\,t\right) & = L^{-1}\left(\frac{1}{s-a}\,e^{-\sqrt{\frac{s+a_{0}}{a_{1}}}\,y}\right) =\dfrac{e^{-at}}{2}\left[e^{-y\sqrt{\frac{1}{a_{1}}\left(a_{0}-a\right)}}\,erf_{c}\left(\dfrac{y}{2\sqrt{a_{1}\,t}}-\sqrt{\left(a_{0}-a\right)t}\right)+e^{y\sqrt{\frac{1}{a_{1}}\left(a_{0}-a\right)}}\,erf_{c}\left(\dfrac{y}{2\sqrt{a_{1}\,t}}+\sqrt{\left(a_{0}-a\right)t}\right)\right]
\end{aligned}&&
\end{flalign}
\end{document}

• I've taken the liberty of adding a screenshot; feel free to revert.
– Mico
Commented Apr 14 at 12:13

Here are two solutions that employ the same approach to line breaking as in @nplatis's answer. In the first solution, I use \exp notation instead of e^{...} notation. In the second, I additionally switch from \frac notation to inline-fraction notation. Note that landscape mode is not needed for either solution.

\documentclass{article}
\usepackage{amsmath} % for 'align' and 'aligned' environments and \DeclareMathOperator macro
\DeclareMathOperator{\erf}{erf}

\begin{document}
\begin{align}
f_1(y,t)
&= L^{-1}\biggl(\frac{1}{s-a}
\exp\biggl( -\sqrt{\frac{s+a_{0}}{a_1}}y\biggr) \biggr) \notag \\[\jot]
&\begin{aligned}[b]
{}=\frac12 e^{-at} \biggl[
&\exp \biggl(-y\sqrt{\frac{1}{a_1}(a_{0}-a)}\,\biggr)
\erf_{c}\biggl(\frac{y}{2\sqrt{a_1t}}-\sqrt{(a_{0}-a)t}\biggr) \\
{}+&\exp\biggl(+y\sqrt{\frac{1}{a_1}(a_{0}-a)}\,\biggr)
\erf_{c}\biggl(\frac{y}{2\sqrt{a_1t}}+\sqrt{(a_{0}-a)t}\biggr)
\biggr]
\end{aligned}
\end{align}

\begin{align}
f_1(y,t)
&= L^{-1}\bigl((s-a)^{-1}
\exp\bigl( -\sqrt{(s+a_{0})/a_1}y\bigr) \bigr) \notag \\[\jot]
&\begin{aligned}[b]
{}=\tfrac12 e^{-at} \bigl[
&\exp \bigl(-y\sqrt{(a_{0}-a)/a_1}\,\bigr)
\erf_{c}\bigl(y/(2\sqrt{a_1t}\,)-\sqrt{(a_{0}-a)t}\,\bigr) \\
{}+&\exp\bigl(+y\sqrt{(a_{0}-a)/a_1}\,\bigr)
\erf_{c}\bigl(y/(2\sqrt{a_1t}\,)+\sqrt{(a_{0}-a)t}\,\bigr)
\bigr]
\end{aligned}
\end{align}
\end{document}

• Thanks to everyone. For providing variety of answers. Commented Apr 14 at 12:06

Based on @Sebastiano answer, I would split differently (notice the \quad for better alignment):

\documentclass[a4paper,12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath}
\DeclareMathOperator{\erf}{erf}
\begin{document}
\begin{flalign}
\begin{aligned}
f_{1}(y,t) & = L^{-1}\left(\frac{1}{s-a}\,e^{-\sqrt{\frac{s+a_{0}}{a_{1}}}\,y}\right)\\
&=\dfrac{e^{-at}}{2}\biggl[e^{-y\sqrt{\frac{1}{a_{1}}\left(a_{0}-a\right)}}\erf_{c}\biggl(\dfrac{y}{2\sqrt{a_{1}\,t}}-\sqrt{\left(a_{0}-a\right)t}\biggr)\\
\end{aligned}
\end{flalign}
\end{document}


I have modificated your MWE. It can be a solution.

\documentclass[a4paper,12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath}
\DeclareMathOperator{\erf}{erf}
\begin{document}
\begin{flalign}
\begin{aligned}
f_{1}(y,t) & = L^{-1}\left(\frac{1}{s-a}\,e^{-\sqrt{\frac{s+a_{0}}{a_{1}}}\,y}\right)=\dfrac{e^{-at}}{2}\biggl[e^{-y\sqrt{\frac{1}{a_{1}}\left(a_{0}-a\right)}}\erf_{c}\biggl(\dfrac{y}{2\sqrt{a_{1}\,t}}\\
&-\sqrt{\left(a_{0}-a\right)t}\biggr)+e^{y\sqrt{\frac{1}{a_{1}}\left(a_{0}-a\right)}}\erf_{c}\left(\dfrac{y}{2\sqrt{a_{1}\,t}}+\sqrt{\left(a_{0}-a\right)t}\right)\biggr]
\end{aligned}
\end{flalign}
\end{document}


You should declare “erf” as a math operator. Also the \, you use are badly placed. You need just one and in a different place.

Use alignat but hide the width of the first row. You can set a further alignment point after the big square bracket.

\documentclass[a4paper]{article}
\usepackage{amsmath}

\DeclareMathOperator{\erf}{erf}

\begin{document}

\begin{alignat}{2}
f_{1}(y,t)
& = L^{-1}\left(\frac{1}{s-a} e^{-y\sqrt{\frac{1}{a_1}(s+a_{0})}}\,\right)\hidewidth
\notag\\
&=\frac{e^{-at}}{2}\biggl[&&
e^{-y\sqrt{\frac{1}{a_{1}}(a_{0}-a)}}
\erf_{c}\left(\frac{y}{2\sqrt{a_{1}t}}-\sqrt{(a_{0}-a)t}\right)
\notag\\
&&&+e^{y\sqrt{\frac{1}{a_{1}}(a_{0}-a)}}
\erf_{c}\left(\frac{y}{2\sqrt{a_{1}t}}+\sqrt{(a_{0}-a)t}\right)
\biggr]
\end{alignat}

\end{document}


• Thank you so much once again. Commented Apr 15 at 11:56