# How to put a newline in a long equation automatically

How to format lines automatically in latex?

I wrote:

$$\begin{split} \Lambda^{'}(pq-2)=4p^4q^4 - 4p^4q^3 - 4p^3q^4 - 2p^3q^3 + 4p^3q^2 + 4p^2q^3 -\\4(6pq - p - q - 5)(pq - 2)^3 + 5(pq - 2)^4 - 12p^2q^2 +3(13p^2q^2 - 5p^2q - 5pq^2 - 18pq + p + q + 10)(pq - 2)^2 +\\ 10p^2q + 10pq^2 - 2(12p^3q^3 - 8p^3q^2 - 8p^2q^3 - 17p^2q^2 \\+ 5p^2q + 5pq^2 + 12pq + 6p + 6q - 8)(pq - 2) + 4pq - 4p -4q - 8 \end{split}$$


I tried experimenting by putting \\ to get a newline. But the equation is not fitting in my page. Its going outside of page.

Does there exist any command so that texmaker can automatically put the equation within the page?

• Off topic: don't use \Lambda^{'} but simply \Lambda'. – Sigur Jan 20 '20 at 15:20
• I'm almost sure that automatic is not possible. You have to adjust by hand, inserting another new line, for example, at \\ 12p^2q^2. – Sigur Jan 20 '20 at 15:22
• @Sigur; thanks a lot – Math_Freak Jan 21 '20 at 2:20

For automatic breaking of long output from computer algebra and similar systems it often helps to use inline math. As you want an equation number I wrapped that in a \parbox and equation here.
\documentclass{article}
$$\Lambda'(pq-2)=\parbox[t]{.75\textwidth}{\displaystyle 4p^4q^4 - 4p^4q^3 - 4p^3q^4 - 2p^3q^3 + 4p^3q^2 + 4p^2q^3 - 4(6pq - p - q - 5)(pq - 2)^3 + 5(pq - 2)^4 - 12p^2q^2 +3(13p^2q^2 - 5p^2q - 5pq^2 - 18pq + p + q + 10)(pq - 2)^2 + 10p^2q + 10pq^2 - 2(12p^3q^3 - 8p^3q^2 - 8p^2q^3 - 17p^2q^2 + 5p^2q + 5pq^2 + 12pq + 6p + 6q - 8)(pq - 2) + 4pq - 4p -4q - 8 }$$

• Suppose I want to write $\implies$ in the new line, how can i go to a new line – Math_Freak Jan 21 '20 at 3:00