# Display large equation

I have a very very long equation that should display in more than one page. Can anybody help me with an example.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{mathtools}
\allowdisplaybreaks
\begin{document}
\maketitle
\begin{align}
\prescript{}{1}{\mathbf{S}}{_n} &=    \\
&\quad  -   \frac{1947668202757}{20975236690836812443870764252458461271984580392386560000000000} n ^ {49}   \\
&\quad  +  \frac{173625951409}{1573572771268357544791771966963287493791543459840000000000} n ^ {48}    \\
&\quad  -   \frac{197798399223926869}{3103478898134018167715572261843343759630371588669440000000000} n ^ {47}   \\
&\quad  +  \frac{314924169824435533}{13206293183549013479640733029120611743107964207104000000000} n ^ {46}    \\
&\quad  -   \frac{1130580613771947097}{173995957622516646635582780357320312820921794560000000000} n ^ {45}   \\
&\quad  +  \frac{2630653616573010809251}{1913955533847683112991410583930523441030139740160000000000} n ^ {44}    \\
&\quad  -   \frac{3001645233974042351471}{12775926958296676850864469886376666326011740160000000000} n ^ {43}   \\
\displaybreak
\frac{736246043163381374579}{22071368831608876951659549305368327207727923200000000} n ^ {42}    \\
\displaybreak
\frac{97424066272545357614655119}{24278505714769764646825504235905159928500715520000000000} n ^ {41}   \\
\displaybreak
\frac{245843301578913020260242487}{592158675969994259678670835022077071426846720000000000} n ^ {40}    \\
\displaybreak
\frac{147005286180100396637854087}{3933421156805517425401799024905101319864320000000000} n ^ {39}   \\
\displaybreak
\frac{6167940827924749744445252383}{2087738921689082325790185636295784546697216000000000} n ^ {38}    \\
\displaybreak
\frac{123951982355236058010521773336213}{599950237495915236779705977588157032892989440000000000} n ^ {37}   \\
\displaybreak
\frac{29786261318478507989447361606631}{2316410183381912111118555898023772327772160000000000} n ^ {36}    \\
\displaybreak
\frac{75368138911059597067052864346383}{105291371971905095959934359001080560353280000000000} n ^ {35}   \\
\displaybreak
\frac{8288984145414865647532133762502221}{231641018338191211111855589802377232777216000000000} n ^ {34}    \\
\displaybreak
\frac{452569874292977515363784469939628211}{280776991925080255893158290669548160942080000000000} n ^ {33}   \\
\displaybreak
\frac{558142785377707657591673832750437491}{8508393694699401693732069414228732149760000000000} n ^ {32}    \\
\displaybreak
\frac{400642231285343444946524254655523443587}{165724881328560683581908517717677094993920000000000} n ^ {31}   \\
\displaybreak
\frac{2086161587972927545028723447642306292497}{25813368612467055783725842851877814796288000000000} n ^ {30}    \\
\displaybreak
\frac{6968316512550516897831344740727007544628249}{2839470547371376136209842713706559627591680000000000} n ^ {29}   \\
\displaybreak
\frac{6634391490839891566548557805968134330249693}{97912777495564694352063541851950331985920000000000} n ^ {28}    \\
\displaybreak
\frac{638876452046590517913969540782801724305228689}{375332313732997995016243577099142939279360000000000} n ^ {27}   \\
\displaybreak
\frac{9770758193986442945571576041421336527085299}{251058403834781267569393697056282902528000000000} n ^ {26}    \\
\displaybreak
\frac{2321315449716031965248554830377049140799651662167}{2866174032142893780124041861484364263587840000000000} n ^ {25}   \\
\displaybreak
\frac{69073887071613661852822627489767413020701225552923}{4503987764795975940194922925189715271352320000000000} n ^ {24}    \\
\displaybreak
\frac{293843574443425563547924888546328984601594794221}{1112645198813235163091631157408526499840000000000} n ^ {23}   \\
\displaybreak
\frac{276341450104995360404383429529322373246710823}{66875744481636974490856868965200691200000000} n ^ {22}    \\
\displaybreak
\frac{7253762351434568115032308932899765660820927464653}{123627244312581684787959017489836277760000000000} n ^ {21}   \\
\displaybreak
\frac{8119700608682973856508002234424627921690029433005223}{10755570255194606576552434521615756165120000000000} n ^ {20}    \\
\displaybreak
\frac{342407614582603740698355652459020248717628033265506463}{38978055970368713408244930976361553592320000000000} n ^ {19}   \\
\displaybreak
\frac{333836923723664366803612335033850338973534812842123543}{3619390911534237673622743590662144262144000000000} n ^ {18}    \\
\displaybreak
\frac{1371345850733360361974386504600087239562200476149781669}{1573648222406190292879453735070497505280000000000} n ^ {17}   \\
\displaybreak
\frac{267279718051786309905555249314313840675024093620411638771}{36193909115342376736227435906621442621440000000000} n ^ {16}    \\
\displaybreak
\frac{1916356062437549563309206454845184606064021810541231011}{34274535147104523424457799153997578240000000000} n ^ {15}   \\
\displaybreak
\frac{2911965466669760606798209702262328512765029539814267507}{7733741263962046311159708527055863808000000000} n ^ {14}    \\
\displaybreak
\frac{84081236706658998864221574245378034484546328114466349789921}{37481108324200302171501517697071573893120000000000} n ^ {13}   \\
\displaybreak
\frac{1906448729839253262299050819427787295414764787851082570843}{162255880191343299443729513840136683520000000000} n ^ {12}    \\
\displaybreak
\frac{3993092442468326328657029626306222596017587724042993684567}{74367278421032345578376027176729313280000000000} n ^ {11}   \\
\displaybreak
\frac{525894035396167910594024743559941930977986267052758382641}{2478909280701078185945867572557643776000000000} n ^ {10}    \\
\displaybreak
\frac{33384834092129688322256134901138201826613069298653933720079}{46582836899841094244232761467645722624000000000} n ^ {9}   \\
\displaybreak
\frac{15851127334275160064915267992498122428265863375715591314873}{7763806149973515707372126911274287104000000000} n ^ {8}    \\
\displaybreak
\frac{50538934074177688733211334667788072574421208851426518948233}{10486115101278331791944276539778796748800000000} n ^ {7}   \\
\displaybreak
\frac{170894805765161569346471187451388881761268438098053078167}{18546870247158954189833414288044130304000000} n ^ {6}    \\
\displaybreak
\frac{3192408546072970731291307147976412013932009436842771259}{230832259569619018596411541463752704000000} n ^ {5}   \\
\displaybreak
\frac{682785685569175939978290827147694681548837466658067}{43808744914869033895109160733286400000} n ^ {4}    \\
\displaybreak
\frac{21015503269476416810456661877556471960448004111363}{1708414619515635845620959695262720000} n ^ {3}   \\
\displaybreak
\frac{10163688265586121873833740853031800777359}{1693162610718285529570587840} n ^ {2}    \\
\displaybreak
\frac{1389515712257356886384784650416477}{1033014834748665568800} n
\end{align}
\end{document}

• you should get an error already from \begin{align} remove the equation environment, align is an alternative to equation not something to go inside. – David Carlisle Jan 6 '17 at 15:42
• Welcome! You shouldn't have \displaybreak in each line to begin with. – egreg Jan 6 '17 at 15:51
• to allow breaks anywhere in an align display, the command \allowdisplaybreaks in the preamble will allow them anywhere in the document. (please check this in the amsmath documentation; i may not have given the correct spelling -- i'm away from my resources.) – barbara beeton Jan 6 '17 at 15:54
• Maybe this code is the result of an export function of an external software such like Matlab or Mathematica, @AliRezaGhadimi is that the case? – Dr. Manuel Kuehner Jan 6 '17 at 16:14
• Wouldn't it be better to define some notation for the coefficients of n^j? – Ian Thompson Jan 6 '17 at 16:45

Such a big formula is unreadable anyway, so I suggest \tfrac; but \displaybreak should be removed, as it forces a break.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{mathtools}
\allowdisplaybreaks
\begin{document}

\begingroup\openup2\jot
\begin{align}
\prescript{}{1}{\mathbf{S}}^{}_{n} =&{}
-\tfrac{1947668202757}{20975236690836812443870764252458461271984580392386560000000000}\,n^{49} \\
&+
\tfrac{173625951409}{1573572771268357544791771966963287493791543459840000000000}\,n^{48}\notag \\
&-
\tfrac{197798399223926869}{3103478898134018167715572261843343759630371588669440000000000}\,n^{47}\notag \\
&+
\tfrac{314924169824435533}{13206293183549013479640733029120611743107964207104000000000}\,n^{46}\notag \\
&-
\tfrac{1130580613771947097}{173995957622516646635582780357320312820921794560000000000}\,n^{45}\notag \\
&+
\tfrac{2630653616573010809251}{1913955533847683112991410583930523441030139740160000000000}\,n^{44}\notag \\
&-
\tfrac{3001645233974042351471}{12775926958296676850864469886376666326011740160000000000}\,n^{43}\notag \\
&+
\tfrac{736246043163381374579}{22071368831608876951659549305368327207727923200000000}\,n^{42}\notag \\
&-
\tfrac{97424066272545357614655119}{24278505714769764646825504235905159928500715520000000000}\,n^{41}   \notag \\
&+
\tfrac{245843301578913020260242487}{592158675969994259678670835022077071426846720000000000}\,n^{40}    \notag \\
&-
\tfrac{147005286180100396637854087}{3933421156805517425401799024905101319864320000000000}\,n^{39}   \notag \\
&+
\tfrac{6167940827924749744445252383}{2087738921689082325790185636295784546697216000000000}\,n^{38}    \notag \\
&-
\tfrac{123951982355236058010521773336213}{599950237495915236779705977588157032892989440000000000}\,n^{37}   \notag \\
&+
\tfrac{29786261318478507989447361606631}{2316410183381912111118555898023772327772160000000000}\,n^{36}    \notag \\
&-
\tfrac{75368138911059597067052864346383}{105291371971905095959934359001080560353280000000000}\,n^{35}   \notag \\
&+
\tfrac{8288984145414865647532133762502221}{231641018338191211111855589802377232777216000000000}\,n^{34}    \notag \\
&-
\tfrac{452569874292977515363784469939628211}{280776991925080255893158290669548160942080000000000}\,n^{33}   \notag \\
&+
\tfrac{558142785377707657591673832750437491}{8508393694699401693732069414228732149760000000000}\,n^{32}    \notag \\
&-
\tfrac{400642231285343444946524254655523443587}{165724881328560683581908517717677094993920000000000}\,n^{31}   \notag \\
&+
\tfrac{2086161587972927545028723447642306292497}{25813368612467055783725842851877814796288000000000}\,n^{30}    \notag \\
&-
\tfrac{6968316512550516897831344740727007544628249}{2839470547371376136209842713706559627591680000000000}\,n^{29}   \notag \\
&+
\tfrac{6634391490839891566548557805968134330249693}{97912777495564694352063541851950331985920000000000}\,n^{28}    \notag \\
&-
\tfrac{638876452046590517913969540782801724305228689}{375332313732997995016243577099142939279360000000000}\,n^{27}   \notag \\
&+
\tfrac{9770758193986442945571576041421336527085299}{251058403834781267569393697056282902528000000000}\,n^{26}    \notag \\
&-
\tfrac{2321315449716031965248554830377049140799651662167}{2866174032142893780124041861484364263587840000000000}\,n^{25}   \notag \\
&  +
\tfrac{69073887071613661852822627489767413020701225552923}{4503987764795975940194922925189715271352320000000000}\,n^{24}    \notag \\
&  -
\tfrac{293843574443425563547924888546328984601594794221}{1112645198813235163091631157408526499840000000000}\,n^{23}   \notag \\
&  +
\tfrac{276341450104995360404383429529322373246710823}{66875744481636974490856868965200691200000000}\,n^{22}    \notag \\
&  -
\tfrac{7253762351434568115032308932899765660820927464653}{123627244312581684787959017489836277760000000000}\,n^{21}   \notag \\
&  +
\tfrac{8119700608682973856508002234424627921690029433005223}{10755570255194606576552434521615756165120000000000}\,n^{20}    \notag \\
&  -
\tfrac{342407614582603740698355652459020248717628033265506463}{38978055970368713408244930976361553592320000000000}\,n^{19}   \notag \\
&  +
\tfrac{333836923723664366803612335033850338973534812842123543}{3619390911534237673622743590662144262144000000000}\,n^{18}    \notag \\
&  -
\tfrac{1371345850733360361974386504600087239562200476149781669}{1573648222406190292879453735070497505280000000000}\,n^{17}   \notag \\
&  +
\tfrac{267279718051786309905555249314313840675024093620411638771}{36193909115342376736227435906621442621440000000000}\,n^{16}    \notag \\
&  -
\tfrac{1916356062437549563309206454845184606064021810541231011}{34274535147104523424457799153997578240000000000}\,n^{15}   \notag \\
&  +
\tfrac{2911965466669760606798209702262328512765029539814267507}{7733741263962046311159708527055863808000000000}\,n^{14}    \notag \\
&  -
\tfrac{84081236706658998864221574245378034484546328114466349789921}{37481108324200302171501517697071573893120000000000}\,n^{13}   \notag \\
&  +
\tfrac{1906448729839253262299050819427787295414764787851082570843}{162255880191343299443729513840136683520000000000}\,n^{12}    \notag \\
&  -
\tfrac{3993092442468326328657029626306222596017587724042993684567}{74367278421032345578376027176729313280000000000}\,n^{11}   \notag \\
&  +
\tfrac{525894035396167910594024743559941930977986267052758382641}{2478909280701078185945867572557643776000000000}\,n^{10}    \notag \\
&  -
\tfrac{33384834092129688322256134901138201826613069298653933720079}{46582836899841094244232761467645722624000000000}\,n^{9}   \notag \\
&  +
\tfrac{15851127334275160064915267992498122428265863375715591314873}{7763806149973515707372126911274287104000000000}\,n^{8}    \notag \\
&  -
\tfrac{50538934074177688733211334667788072574421208851426518948233}{10486115101278331791944276539778796748800000000}\,n^{7}   \notag \\
&  +
\tfrac{170894805765161569346471187451388881761268438098053078167}{18546870247158954189833414288044130304000000}\,n^{6}    \notag \\
&  -
\tfrac{3192408546072970731291307147976412013932009436842771259}{230832259569619018596411541463752704000000}\,n^{5}   \notag \\
&  +
\tfrac{682785685569175939978290827147694681548837466658067}{43808744914869033895109160733286400000}\,n^{4}    \notag \\
&  -
\tfrac{21015503269476416810456661877556471960448004111363}{1708414619515635845620959695262720000}\,n^{3}   \notag \\
&  +
\tfrac{10163688265586121873833740853031800777359}{1693162610718285529570587840}\,n^{2}    \notag \\
&  -
\tfrac{1389515712257356886384784650416477}{1033014834748665568800}\,n
\end{align}
\endgroup
\end{document}


The trick with \openup2\jot allows for a bit more space between lines. If you want each line numbered, remove the \notag commands.

I'm not sure how anyone can read this but after fixing the main error of align inside equation it works if you just squeeze things up a bit.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{mathtools}
\allowdisplaybreaks
\begin{document}
\small
\begin{align}
\prescript{}{1}{\mathbf{S}}{_n} ={}&    \\
&  -   \frac{1947668202757}{2097523669083681244387076425245846127198458039238656\times10^{10}} n ^ {49}   \nonumber\\
&  +  \frac{173625951409}{157357277126835754479177196696328749379154345984\times10^{10}} n ^ {48}    \nonumber\\
&  -   \frac{197798399223926869}{310347889813401816771557226184334375963037158866944\times10^{10}} n ^ {47}   \nonumber\\
&  +  \frac{314924169824435533}{132062931835490134796407330291206117431079642071040\times10^{8}} n ^ {46}    \nonumber\\
&  -   \frac{1130580613771947097}{17399595762251664663558278035732031282092179456\times10^{10}} n ^ {45}   \nonumber\\
&  +  \frac{2630653616573010809251}{191395553384768311299141058393052344103013974016\times10^{10}} n ^ {44}    \nonumber\\
&  -   \frac{3001645233974042351471}{1277592695829667685086446988637666632601174016\times10^{10}} n ^ {43}   \nonumber\\
&  +
\frac{736246043163381374579}{220713688316088769516595493053683272077279232\times10^{8}} n ^ {42}    \nonumber\\
&  -
\frac{97424066272545357614655119}{2427850571476976464682550423590515992850071552\times10^{10}} n ^ {41}   \nonumber\\
&  +
\frac{245843301578913020260242487}{59215867596999425967867083502207707142684672\times10^{10}} n ^ {40}    \nonumber\\
&  -
\frac{147005286180100396637854087}{393342115680551742540179902490510131986432\times10^{10}} n ^ {39}   \nonumber\\
&  +
\frac{6167940827924749744445252383}{20877389216890823257901856362957845466972160\times10^{8}} n ^ {38}    \nonumber\\
&  -
\frac{123951982355236058010521773336213}{59995023749591523677970597758815703289298944\times10^{10}} n ^ {37}   \nonumber\\
&  +
\frac{29786261318478507989447361606631}{231641018338191211111855589802377232777216\times10^{10}} n ^ {36}    \nonumber\\
&  -
\frac{75368138911059597067052864346383}{10529137197190509595993435900108056035328\times10^{10}} n ^ {35}   \nonumber\\
&  +
\frac{8288984145414865647532133762502221}{2316410183381912111118555898023772327772160\times10^{8}} n ^ {34}    \nonumber\\
&  -
\frac{452569874292977515363784469939628211}{28077699192508025589315829066954816094208\times10^{10}} n ^ {33}   \nonumber\\
&  +
\frac{558142785377707657591673832750437491}{850839369469940169373206941422873214976\times10^{10}} n ^ {32}    \nonumber\\
&  -
\frac{400642231285343444946524254655523443587}{16572488132856068358190851771767709499392\times10^{10}} n ^ {31}   \nonumber\\
&  +
\frac{2086161587972927545028723447642306292497}{258133686124670557837258428518778147962880\times10^{8}} n ^ {30}    \nonumber\\
&  -
\frac{6968316512550516897831344740727007544628249}{283947054737137613620984271370655962759168\times10^{10}} n ^ {29}   \nonumber\\
&  +
\frac{6634391490839891566548557805968134330249693}{9791277749556469435206354185195033198592\times10^{10}} n ^ {28}    \nonumber\\
&  -
\frac{638876452046590517913969540782801724305228689}{37533231373299799501624357709914293927936\times10^{10}} n ^ {27}   \nonumber\\
&  +
\frac{9770758193986442945571576041421336527085299}{2510584038347812675693936970562829025280\times10^{8}} n ^ {26}    \nonumber\\
&  -
\frac{2321315449716031965248554830377049140799651662167}{286617403214289378012404186148436426358784\times10^{10}} n ^ {25}   \nonumber\\
&  +
\frac{69073887071613661852822627489767413020701225552923}{450398776479597594019492292518971527135232\times10^{10}} n ^ {24}    \nonumber\\
&  -
\frac{293843574443425563547924888546328984601594794221}{111264519881323516309163115740852649984\times10^{10}} n ^ {23}   \nonumber\\
&  +
\frac{276341450104995360404383429529322373246710823}{668757444816369744908568689652006912\times10^{8}} n ^ {22}    \nonumber\\
&  -
\frac{7253762351434568115032308932899765660820927464653}{12362724431258168478795901748983627776\times10^{10}} n ^ {21}   \nonumber\\
&  +
\frac{8119700608682973856508002234424627921690029433005223}{1075557025519460657655243452161575616512\times10^{10}} n ^ {20}    \nonumber\\
&  -
\frac{342407614582603740698355652459020248717628033265506463}{3897805597036871340824493097636155359232\times10^{10}} n ^ {19}   \nonumber\\
&  +
\frac{333836923723664366803612335033850338973534812842123543}{36193909115342376736227435906621442621440\times10^{8}} n ^ {18}    \nonumber\\
&  -
\frac{1371345850733360361974386504600087239562200476149781669}{157364822240619029287945373507049750528\times10^{10}} n ^ {17}   \nonumber\\
&  +
\frac{267279718051786309905555249314313840675024093620411638771}{3619390911534237673622743590662144262144\times10^{10}} n ^ {16}    \nonumber\\
&  -
\frac{1916356062437549563309206454845184606064021810541231011}{3427453514710452342445779915399757824\times10^{10}} n ^ {15}   \nonumber\\
&  +
\frac{2911965466669760606798209702262328512765029539814267507}{77337412639620463111597085270558638080\times10^{8}} n ^ {14}    \nonumber\\
&  -
\frac{84081236706658998864221574245378034484546328114466349789921}{3748110832420030217150151769707157389312\times10^{10}} n ^ {13}   \nonumber\\
&  +
\frac{1906448729839253262299050819427787295414764787851082570843}{16225588019134329944372951384013668352\times10^{10}} n ^ {12}    \nonumber\\
&  -
\frac{3993092442468326328657029626306222596017587724042993684567}{7436727842103234557837602717672931328\times10^{10}} n ^ {11}   \nonumber\\
&  +
\frac{525894035396167910594024743559941930977986267052758382641}{24789092807010781859458675725576437760\times10^{8}} n ^ {10}    \nonumber\\
&  -
\frac{33384834092129688322256134901138201826613069298653933720079}{465828368998410942442327614676457226240\times10^{8}} n ^ {9}   \nonumber\\
&  +
\frac{15851127334275160064915267992498122428265863375715591314873}{77638061499735157073721269112742871040\times10^{8}} n ^ {8}    \nonumber\\
&  -
\frac{50538934074177688733211334667788072574421208851426518948233}{104861151012783317919442765397787967488\times10^{8}} n ^ {7}   \nonumber\\
&  +
\frac{170894805765161569346471187451388881761268438098053078167}{18546870247158954189833414288044130304000000} n ^ {6}    \nonumber\\
&  -
\frac{3192408546072970731291307147976412013932009436842771259}{230832259569619018596411541463752704000000} n ^ {5}   \nonumber\\
&  +
\frac{682785685569175939978290827147694681548837466658067}{43808744914869033895109160733286400000} n ^ {4}    \nonumber\\
&  -
\frac{21015503269476416810456661877556471960448004111363}{1708414619515635845620959695262720000} n ^ {3}   \nonumber\\
&  +
\frac{10163688265586121873833740853031800777359}{1693162610718285529570587840} n ^ {2}    \nonumber\\
&  -
\frac{1389515712257356886384784650416477}{1033014834748665568800} n
\end{align}
\end{document}

• @Mico I suspect the 9 half way down page 2 should be an 8 – David Carlisle Jan 6 '17 at 15:56
• Wait a minute...this isn't secretly one of your holiday tree codes for Krampus, is it? Ref: tex.stackexchange.com/questions/149604/… – Steven B. Segletes Jan 6 '17 at 15:59
• Thank you, it worked. About "not sure how anyone can read this", it's better to know the full equation is 260 pages! – AliReza Ghadimi Jan 6 '17 at 16:05
• @AliRezaGhadimi And what exactly should be the purpose of it? – TheGeekGreek Jan 6 '17 at 23:09
• @AliRezaGhadimi - What purpose could possibly be served by typesetting an equation that spans 260 pages? Who on earth would read even 1 page of such material? – Mico Jan 7 '17 at 0:40