align long equation

In my opinion, in order to preserve some semblance of readability of this polynomial expression, you should have only one term per line for virtually all terms. For sure, don't introduce line breaks in the long integer terms.

enter image description here

\documentclass[12pt,a4paper,twoside]{report}
\usepackage{amsmath}
\allowdisplaybreaks % allow page breaks
\begin{document}
\begin{align*}
f_{32} &=x^{32} +12198x^{31} \\
&\quad+2314465x^{30} \\
&\quad-12105775188x^{29} \\
&\quad+5363823023298x^{28} \\
&\quad+1122558153237468x^{27} \\
&\quad -1190957568896565522x^{26} \\
&\quad+209082600175304589984x^{25}\\ 
&\quad+22989403151925296937003x^{24} \\
&\quad-4914900851027091491992374x^{23}\\ 
&\quad+187314971305181007593402091x^{22} \\
&\quad+1851435573081259757991725916x^{21}\\ 
&\quad-177112654221172660874138268072x^{20} \\
&\quad+43926953348772854958076288336008x^{19}\\ 
&\quad-8069925182155695353376402378426972x^{18} \\
&\quad+689585428817365840411341429649636128x^{17}\\ 
&\quad-23740614034450231197314286171021009177x^{16} \\
&\quad-1553249919261394918300632995703368436966x^{15}\\ 
&\quad+258709406067702606326021220112526188966887x^{14}\\ 
&\quad-14511399786110161424357109505278330297341724x^{13}\\ 
&\quad+146353788522640898741319428949250465719024858x^{12}\\ 
&\quad+32750278659384832647975670671061051222933180188x^{11}\\ 
&\quad-2286974864798158343157856729712480557839267556386x^{10}\\ 
&\quad+59326319758119486145828221766889960355126201846912x^9\\ 
&\quad+657514680221875470162434668796674493045075336579853x^8\\ 
&\quad-105521419234945522100651241454885243895292286754573898x^7\\ 
&\quad+4011238165200337244745440754326620606602486694989793197x^6\\ 
&\quad-88606708108365160576968913022740501751611649852083140204x^5 \\
&\quad+1275064459467673569769713705475370419199754537492781650348x^4 \\
&\quad-12161035278122430054818848726808537446643676687311798879424x^3\\
&\quad+74518442436178190616718411536731834197503633925706662198320x^2 \\
&\quad-266884801883836189911937468492568061745225307284731520442304x \\
&\quad+426657021984772608506438415602232517825896105800369395838016
\end{align*}
\end{document}

Addendum to address a comment left by the OP: If it's known that the equation has to (and will) fit on a single page, you may want to use an array environment instead of an align* environment. The former has an advantage in terms of more tighter line spacing, making it more likely that the full polynomial expression will indeed fit on a single page.

enter image description here

\documentclass[12pt,a4paper,twoside]{report}
\begin{document}
\appendix
\section*{Appendix: More information on \boldmath $ f_{32}$}

The function $f_{32}$ is given by the following 32nd-degree polynomial in $x$:
\[
\begin{array}{@{}r@{}l@{}}
f_{32} ={} &x^{32}\\
&{}+12198\,x^{31}\\
&{}+2314465\,x^{30}\\
&{}-12105775188\,x^{29}\\
&{}+5363823023298\,x^{28}\\
&{}+1122558153237468\,x^{27}\\
&{}-1190957568896565522\,x^{26}\\
&{}+209082600175304589984\,x^{25}\\ 
&{}+22989403151925296937003\,x^{24}\\
&{}-4914900851027091491992374\,x^{23}\\ 
&{}+187314971305181007593402091\,x^{22}\\
&{}+1851435573081259757991725916\,x^{21}\\ 
&{}-177112654221172660874138268072\,x^{20}\\
&{}+43926953348772854958076288336008\,x^{19}\\ 
&{}-8069925182155695353376402378426972\,x^{18}\\
&{}+689585428817365840411341429649636128\,x^{17}\\ 
&{}-23740614034450231197314286171021009177\,x^{16}\\
&{}-1553249919261394918300632995703368436966\,x^{15}\\ 
&{}+258709406067702606326021220112526188966887\,x^{14}\\ 
&{}-14511399786110161424357109505278330297341724\,x^{13}\\ 
&{}+146353788522640898741319428949250465719024858\,x^{12}\\ 
&{}+32750278659384832647975670671061051222933180188\,x^{11}\\ 
&{}-2286974864798158343157856729712480557839267556386\,x^{10}\\ 
&{}+59326319758119486145828221766889960355126201846912\,x^9\\ 
&{}+657514680221875470162434668796674493045075336579853\,x^8\\ 
&{}-105521419234945522100651241454885243895292286754573898\,x^7\\ 
&{}+4011238165200337244745440754326620606602486694989793197\,x^6\\ 
&{}-88606708108365160576968913022740501751611649852083140204\,x^5\\
&{}+1275064459467673569769713705475370419199754537492781650348\,x^4\\
&{}-12161035278122430054818848726808537446643676687311798879424\,x^3\\
&{}+74518442436178190616718411536731834197503633925706662198320\,x^2\\
&{}-266884801883836189911937468492568061745225307284731520442304\,x\\
&{}+426657021984772608506438415602232517825896105800369395838016
\end{array}
\]
\end{document}

@Mico's solution is more appropriate, but for the sake of founding the reason behind the misaligment I'm giving this answer. The problem was that your equation is completely off the margins, if you load \usepackage[showframe]{geometry} you will see this:

enter image description here

So, the real problem is the linebreaking. By using the align environment you must properly break lines. An alternative to this issue would be to use the breqn package which provides automatic linebreaking. See MWE below and compilation result.

\documentclass[12pt,a4paper,twoside]{report}
\usepackage{amsmath,amsthm,mathtools,breqn}
\usepackage[showframe]{geometry}
\begin{document}
\begin{dmath*}
f_{32} = x^{32} +12198x^{31} +2314465x^{30} -12105775188x^{29} +5363823023298x^    {28} +112255815323746
8x^{27} -1190957568896565522x^{26} +209082600175304589984x^{25}     +22989403151925296937
003x^{24} -4914900851027091491992374x^{23} +187314971305181007593402091x^{22}     +185143
5573081259757991725916x^{21} -177112654221172660874138268072x^{20}     +43926953348772
854958076288336008x^{19} -8069925182155695353376402378426972x^{18}     +68958542881736
5840411341429649636128x^{17} -23740614034450231197314286171021009177x^{16}     -155324
9919261394918300632995703368436966x^{15} +25870940606770260632602122011252618896
6887x^{14} -14511399786110161424357109505278330297341724x^{13}     +1463537885226408987
41319428949250465719024858x^{12}     +32750278659384832647975670671061051222933180188
x^{11} -2286974864798158343157856729712480557839267556386x^{10}     +5932631975811948614
5828221766889960355126201846912x^9 +6575146802218754701624346687966744930450753
36579853x^8 -105521419234945522100651241454885243895292286754573898x^7 +40112381
65200337244745440754326620606602486694989793197x^6 -886067081083651605769689130
22740501751611649852083140204x^5 +127506445946767356976971370547537041919975453
7492781650348x^4 -12161035278122430054818848726808537446643676687311798879424x^3
 +74518442436178190616718411536731834197503633925706662198320x^2 -2668848018838
36189911937468492568061745225307284731520442304x +4266570219847726085064384156
02232517825896105800369395838016
\end{dmath*}
\end{document}

enter image description here

This result begin pretty similar to what Mico advised.


You can use a more natural input by defining a suitable environment; in addition this environment can take an optional argument for a font size command, in case at \normalsize the terms are too wide.

\documentclass[12pt,a4paper,twoside]{report}
\usepackage{amsmath,amsthm,mathtools}

\usepackage{lipsum} % just for the example

\makeatletter
\newenvironment{longpoly}[2][\normalsize]
 {\par\nopagebreak\vspace{\abovedisplayskip}% end a par and emulate a display
  \setlength{\parindent}{0pt}%
  #1% a font size declaration
  \raggedright
  \sbox\z@{\quad$#2={}$}% measure the left-hand side
  \setlength{\leftskip}{\wd\z@}%
  \setplusandminus
  $% start math mode
  \hspace*{-\wd\z@}%
  \quad#2=}
 {$\par\vspace{\belowdisplayskip}}
\mathchardef\std@plus=\mathcode`+
\def\setplusandminus{%
  \begingroup\lccode`~=`- \lowercase{\endgroup\def~}{\penalty-\@M\std@minus\nobreak}
  \begingroup\lccode`~=`+ \lowercase{\endgroup\def~}{\penalty-\@M\std@plus\nobreak}
  \mathcode`+="8000
  \mathcode`-="8000
}
\makeatother

\begin{document}

\lipsum*[1-2]
\begin{longpoly}[\footnotesize]{f_{32}}
x^{32} 
+12198x^{31} 
+2314465x^{30} 
-12105775188x^{29} 
+5363823023298x^{28} 
+1122558153237468x^{27} 
-1190957568896565522x^{26} 
+209082600175304589984x^{25} 
+22989403151925296937003x^{24} 
-4914900851027091491992374x^{23}
+187314971305181007593402091x^{22} 
+1851435573081259757991725916x^{21} 
-177112654221172660874138268072x^{20} 
+43926953348772854958076288336008x^{19} 
-8069925182155695353376402378426972x^{18} 
+689585428817365840411341429649636128x^{17} 
-23740614034450231197314286171021009177x^{16} 
-1553249919261394918300632995703368436966x^{15} 
+258709406067702606326021220112526188966887x^{14} 
-14511399786110161424357109505278330297341724x^{13} 
+146353788522640898741319428949250465719024858x^{12} 
+32750278659384832647975670671061051222933180188x^{11} 
-2286974864798158343157856729712480557839267556386x^{10} 
+59326319758119486145828221766889960355126201846912x^9 
+657514680221875470162434668796674493045075336579853x^8 
-105521419234945522100651241454885243895292286754573898x^7 
+4011238165200337244745440754326620606602486694989793197x^6 
-88606708108365160576968913022740501751611649852083140204x^5 
+1275064459467673569769713705475370419199754537492781650348x^4 
-12161035278122430054818848726808537446643676687311798879424x^3
+74518442436178190616718411536731834197503633925706662198320x^2 
-266884801883836189911937468492568061745225307284731520442304x 
+426657021984772608506438415602232517825896105800369395838016
\end{longpoly}
\lipsum[4]

\end{document}

enter image description here

Tags:

Align