LaTeX Split up a horrible equation

SeM

Hi, how do I split up this horrible equation into several lines?

given in latex code:

\Psi_2= -2.018\,{10}^{-122}\,C_{2}\,{\mathrm{e}}^{-x\,1.014{}{10}^7{}\mathrm{i}}\,\left(1.398\,{10}^{121}\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}-1.398\,{10}^{121}\,x^2\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}+1.398\,{10}^{121}\,x^2-1.436\,{10}^{135}+x^3\,1.396{}{10}^{60}{}\mathrm{i}+x\,2.833{}{10}^{128}{}\mathrm{i}\right)

and shown in latex form:

\Psi_2= -2.018\,{10}^{-122}\,C_{2}\,{\mathrm{e}}^{-x\,1.014{}{10}^7{}\mathrm{i}}\,\left(1.398\,{10}^{121}\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}-1.398\,{10}^{121}\,x^2\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}+1.398\,{10}^{121}\,x^2-1.436\,{10}^{135}+x^3\,1.396{}{10}^{60}{}\mathrm{i}+x\,2.833{}{10}^{128}{}\mathrm{i}\right)

it shows beautifully here, but in my latex document it stretches beyond the right margin of the page, and does not split up no matter what I have tried.

Related MATLAB, Maple, Mathematica, LaTeX, Etc News on Phys.org

Mentor

SeM

What have you tried?
I managed, I used

\begin{equation*}
\begin{split*}
\begin{align*}
& Text to split //
& second part to split //
& and so on //

\end{equation*}
\end{split*}
\end{align*}

DrClaude

Mentor
It is strange to see an align within a split. Normally, it should be inside the align. From the AMS math documentation:
Like multiline, the split environment is for single equations that are too long to fit on one line and hence must be split into multiple lines. Unlike multline, however, the split environment provides for alignment among the split lines, using & to mark alignment points. Unlike the other amsmath equation structures, the split environment provides no numbering, because it is intended to be used only inside some other displayed equation structure, usually an equation, align, or gather environment, which provides the numbering.

SeM

It is strange to see an align within a split. Normally, it should be inside the align. From the AMS math documentation:

It worked well as given.

Thanks!

wle

Hi, how do I split up this horrible equation into several lines?

given in latex code:

\Psi_2= -2.018\,{10}^{-122}\,C_{2}\,{\mathrm{e}}^{-x\,1.014{}{10}^7{}\mathrm{i}}\,\left(1.398\,{10}^{121}\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}-1.398\,{10}^{121}\,x^2\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}+1.398\,{10}^{121}\,x^2-1.436\,{10}^{135}+x^3\,1.396{}{10}^{60}{}\mathrm{i}+x\,2.833{}{10}^{128}{}\mathrm{i}\right)

and shown in latex form:

\Psi_2= -2.018\,{10}^{-122}\,C_{2}\,{\mathrm{e}}^{-x\,1.014{}{10}^7{}\mathrm{i}}\,\left(1.398\,{10}^{121}\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}-1.398\,{10}^{121}\,x^2\,{\mathrm{e}}^{x\,1.014{}{10}^7{}\mathrm{i}}+1.398\,{10}^{121}\,x^2-1.436\,{10}^{135}+x^3\,1.396{}{10}^{60}{}\mathrm{i}+x\,2.833{}{10}^{128}{}\mathrm{i}\right)

it shows beautifully here, but in my latex document it stretches beyond the right margin of the page, and does not split up no matter what I have tried.
Well there are various environments like align and IEEEeqnarray that you could use to produce output like this: \begin{align} \Psi_2 = -2.018 \, {10}^{-122} \, C_{2} \, {\mathrm{e}}^{-x\,1.014 \cdot {10}^7{}\mathrm{i}}\, \Bigl( & 1.398 \, {10}^{121} \, {\mathrm{e}}^{x\,1.014 \cdot {10}^7{}\mathrm{i}} \nonumber \\ &-\> 1.398 \, {10}^{121} \, x^2 \, {\mathrm{e}}^{x \, 1.014 \cdot {10}^7{}\mathrm{i}} \nonumber \\ &+\> 1.398\,{10}^{121}\,x^2 - 1.436\,{10}^{135} \nonumber \\ &+\> x^3\,1.396{}{10}^{60}{}\mathrm{i} + x\,2.833{}{10}^{128}{}\mathrm{i} \Bigr) \,. \end{align}

But why not just use a few variables: $$\Psi_{2} = - \lambda \, C_{2} \, \mathrm{e}^{-\mathrm{i} \phi x} \, \Bigl( \alpha \mathrm{e}^{\mathrm{i} \phi x} - \alpha x^{2} \mathrm{e}^{\mathrm{i} \phi x} + \alpha x^{2} - \beta + \mathrm{i} \gamma x^{3} + \mathrm{i} \delta x \Bigr) \,,$$ where $$\begin{eqnarray} \lambda &=& 2.018 \cdot 10^{-122} \,, &\qquad& \phi &=& 1.014 \cdot 10^{7} \,, \\ \alpha &=& 1.398 \cdot 10^{121} \,, && \beta &=& 1.436 \cdot 10^{135} \,, \\ \gamma &=& 1.396 \cdot 10^{60} \,, && \delta &=& 2.833 \cdot 10^{128} \,. \end{eqnarray}$$ This makes the structure of the equation so much clearer.

You can produce the second set of equations in a paper with, e.g.,
Code:
\begin{IEEEeqnarray}{rCl+rCl}
\lambda &=& 2.018 \cdot 10^{-122} \,, &
\phi &=& 1.014 \cdot 10^{7} \,, \\
\alpha &=& 1.398 \cdot 10^{121} \,, &
\beta &=& 1.436 \cdot 10^{135} \,, \\
\gamma &=& 1.396 \cdot 10^{60} \,, &
\delta &=& 2.833 \cdot 10^{128} \,.
\end{IEEEeqnarray}
(If you want to use the IEEEeqnarray environment like here then install IEEEtrantools and put \usepackage[retainorgcmds]{IEEEtrantools} in the document preamble.)

SeM

wle said:
(If you want to use the IEEEeqnarray environment like here then install IEEEtrantools and put \usepackage[retainorgcmds]{IEEEtrantools} in the document preamble.)

Thanks WLE! I ended up using texlabel because these expressions become too long.

Last edited by a moderator:

"Split up a horrible equation"

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving