# Help formatting really long equations

I have some really long differential equations and I'm having trouble figuring out how to format them the way I want. I want them to look liek this: dx/dt = blah blah blah blah dx/dt = blah blah blah blah and so on. I'm having trouble with them not being left justified and running off the page. Thanks for any help!

\documentclass{article}
\title{Equations}
\usepackage{amsmath}
\begin{document}
\begin{multline}
\frac{dx_{1}}{dt}= - c_{1}*x_{2}*x_{1} + c_{2}*x_{3} - c_{3}*x_{25}*x_{1}\\ + c_{4}*x_{5} - c_{5}*x_{1}*x_{26} + c_{6}*x_{4} - c_{7}*x_{1}*x_{13}\\ + c_{8}*x_{12} - c_{9}*x_{1}*x_{18} + c_{10}*x_{17} - c_{11}*x_{1}*x_{24} + c_{12}*x_{23} - c_{13}*x_{1}*x_{19}\\ + c_{14}*x_{20}\
\frac{dx_{2}}{dt}= - c_{1}*x_{1}*x_{2} + c_{2}*x_{3} - c_{1}*x_{2}*(x_{4}\\ + x_{5} + x_{7} + x_{12} + x_{14} + x_{17} + x_{20} + x_{23}) - c_{15}*(x_{6}\\ + x_{8} + x_{9} + x_{11} + x_{15} + x_{16} + x_{21} + x_{22})\
\frac{dx_{3}}{dt}= - c_{16}*x_{3}*x_{26} + c_{17}*x_{6}\\ - c_{18}*x_{3}*x_{25} + c_{19}*x_{8} + c_{1}*x_{1}*x_{2} - c_{2}*x_{3} - c_{7}*x_{3}*x_{13}\\ + c_{8}*x_{11} - c_{9}*x_{3}*x_{18} + c_{10}*x_{16} - c_{11}*x_{3}*x_{24} + c_{12}*x_{22}\
\frac{dx_{4}}{dt}= c_{5}*x_{1}*x_{26} - c_{6}*x_{4} - c_{3}*x_{4}*x_{25}\\ + c_{4}*x_{7} - c_{1}*x_{4}*x_{2} + c_{15}*x_{6}\
\frac{dx_{5}}{dt}= c_{3}*x_{1}*x_{25} - c_{4}*x_{5} - c_{5}*x_{5}*x_{26}\\ + c_{6}*x_{7} - c_{1}*x_{2}*x_{5} + c_{15}*x_{8}\
\frac{dx_{6}}{dt}= c_{16}*x_{3}*x_{26} - c_{17}*x_{6} - c_{18}*x_{6}*x_{25}\\ + c_{19}*x_{9} - c_{15}*x_{6} + c_{1}*x_{2}*x_{4}\
\frac{dx_{7}}{dt}= c_{5}*x_{5}*x_{26} - c_{6}*x_{7} + c_{3}*x_{4}*x_{25}\\ - c_{4}*x_{7} - c_{1}*x_{7}*x_{2} + c_{15}*x_{9} - c_{22}*x_{7}\
\frac{dx_{8}}{dt}= c_{18}*x_{3}*x_{25} - c_{19}*x_{8} - c_{16}*x_{8}*x_{26}\\ + c_{17}*x_{9} - c_{15}*x_{8} + c_{1}*x_{2}*x_{5}\
\frac{dx_{9}}{dt}= c_{16}*x_{8}*x_{26} - c_{17}*x_{9} + c_{18}*x_{6}*x_{25}\\ - c_{19}*x_{9} + c_{1}*x_{2}*x_{7} - c_{15}*x_{9} - c_{20}*x_{9}\
\frac{dx_{10}}{dt}= (c_{20}*x_{9}*(1 - c_{23})\\ + c_{22}*x_{7}*(1 - c_{24}))*c_{25}^{c_{26}} - x_{10}\
\frac{dx_{11}}{dt}= c_{20}*c_{23}*x_{9} - c_{15}*x_{11}\\ + c_{1}*x_{2}*x_{12} - c_{13}*x_{11}*x_{19} + c_{14}*x_{15} + c_{7}*x_{3}*x_{13}\\ - c_{8}*x_{11}\
\frac{dx_{12}}{dt}= c_{22}*x_{7}*c_{24} + c_{7}*x_{1}*x_{13}\\ - c_{8}*x_{12} - c_{1}*x_{12}*x_{2} + c_{15}*x_{11} - c_{13}*x_{12}*x_{19}\\ + c_{14}*x_{14}\
\frac{dx_{13}}{dt}= - c_{7}*x_{13}*(x_{1} + x_{3} + x_{20} + x_{21})\\ + c_{8}*(x_{11} + x_{12} + x_{14} + x_{15})\
\frac{dx_{14}}{dt}= c_{13}*x_{12}*x_{19} - c_{14}*x_{14}\\ - c_{1}*x_{2}*x_{14} + c_{15}*x_{15} + c_{7}*x_{20}*x_{13} - c_{8}*x_{14}\
\frac{dx_{15}}{dt}= c_{1}*x_{2}*x_{14} - c_{15}*x_{15}\\ + c_{13}*x_{11}*x_{19} - c_{14}*x_{15} - c_{21}*x_{15} + c_{7}*x_{21}*x_{13} - c_{8}*x_{15}\
\frac{dx_{16}}{dt}= c_{20}*(1 - c_{23})*x_{9} - c_{15}*x_{16}\\ + c_{1}*x_{2}*x_{17} + c_{9}*x_{3}*x_{18} - c_{10}*x_{16}\
\frac{dx_{17}}{dt}= c_{22}*(1 - c_{24})*x_{7} + c_{15}*x_{16}\\ - c_{1}*x_{2}*x_{17} + c_{9}*x_{1}*x_{18} - c_{10}*x_{17}\
\frac{dx_{18}}{dt}= - c_{9}*x_{18}*(x_{1} + x_{3})\\ + c_{10}*(x_{17} + x_{16})\
\frac{dx_{19}}{dt}= c_{20}*(1 - c_{23})*x_{9}\\ - c_{13}*x_{19}*(x_{12} + x_{1}) + c_{14}*(x_{14} + x_{20}) + c_{22}*(1 - c_{24})*x_{7}\
\frac{dx_{20}}{dt}= c_{13}*x_{1}*x_{19} - c_{14}*x_{20}\\ - c_{1}*x_{2}*x_{20} + c_{15}*x_{21} - c_{7}*x_{20}*x_{13} + c_{8}*x_{14}\
\frac{dx_{21}}{dt}= c_{1}*x_{2}*x_{20} - c_{15}*x_{21}\\ - c_{7}*x_{21}*x_{13} + x_{8}*x_{15}\
\frac{dx_{22}}{dt}= c_{21}*x_{15} - c_{15}*x_{22} + c_{1}*x_{2}*x_{23}\\ + c_{11}*x_{3}*x_{24} - c_{12}*x_{22}\
\frac{dx_{23}}{dt}= c_{11}*x_{1}*x_{24} - c_{12}*x_{23}\\ - c_{1}*x_{2}*x_{23} + c_{15}*x_{22}\
\frac{dx_{24}}{dt}= - c_{11}*x_{24}*(x_{1} + x_{3})\\ + c_{12}*(x_{23} + x_{22})\
\frac{dx_{25}}{dt}= - c_{3}*x_{25}*(x_{1} + x_{4})\\ + c_{4}*(x_{5} + x_{7}) - c_{18}*x_{25}*(x_{3} + x_{6}) + c_{19}*(x_{8} + x_{9})\
\frac{dx_{26}}{dt}= - c_{5}*x_{26}*(x_{1} + x_{5})\\ + c_{6}*(x_{4} + x_{7}) - c_{16}*x_{26}*(x_{3} + x_{8}) + c_{17}*(x_{6} + x_{9})\
\end{multline}
\end{document}

• \begin{multline} \maketitle \raggedright \[ multline is a display math environment so it can not contain \maketitle or \raggedright or \[ Jan 23, 2015 at 20:12
• Welcome to TeX.SX! Please make your document compilable. Jan 23, 2015 at 20:13
• "fixed errors?" not really: cut and paste the code from the question and try it locally. You need \\  not \  at the end of each line for example. Jan 23, 2015 at 20:37

If I remove the obvious errors such as starting math mode with \[ inside the multline math environment then it mostly fitted on a page except for the first three long equations. iused gathered here for those, but split or aligned are alternatives. I also used align for the main list rather than multline and used juxtaposition rather than * for multiplication.

\documentclass{article}
\title{Equations}
\usepackage{amsmath}
\allowdisplaybreaks
\begin{document}
\begin{align*}
\frac{dx_{1}}{dt}&= \begin{gathered}- c_{1}x_{2}x_{1} + c_{2}x_{3} - c_{3}x_{25}x_{1} + c_{4}x_{5} - c_{5}x_{1}x_{26} + c_{6}x_{4}  - c_{7}x_{1}x_{13}\\
+ c_{8}x_{12} - c_{9}x_{1}x_{18} + c_{10}x_{17} - c_{11}x_{1}x_{24} + c_{12}x_{23} - c_{13}x_{1}x_{19} + c_{14}x_{20}\end{gathered}\\
\frac{dx_{2}}{dt}&= \begin{gathered}-- c_{1}x_{1}x_{2} + c_{2}x_{3} - c_{1}x_{2}(x_{4} + x_{5} + x_{7} + x_{12} + x_{14} + x_{17}\\
+ x_{20} + x_{23}) - c_{15}(x_{6} + x_{8} + x_{9} + x_{11} + x_{15} + x_{16} + x_{21} + x_{22})\end{gathered}\\
\frac{dx_{3}}{dt}&=\begin{gathered} - c_{16}x_{3}x_{26} + c_{17}x_{6} - c_{18}x_{3}x_{25} + c_{19}x_{8} + c_{1}x_{1}x_{2} - c_{2}x_{3}\\
- c_{7}x_{3}x_{13} + c_{8}x_{11} - c_{9}x_{3}x_{18} + c_{10}x_{16} - c_{11}x_{3}x_{24} + c_{12}x_{22}\end{gathered}\\
\frac{dx_{4}}{dt}&= c_{5}x_{1}x_{26} - c_{6}x_{4} - c_{3}x_{4}x_{25} + c_{4}x_{7} - c_{1}x_{4}x_{2} + c_{15}x_{6}\\
\frac{dx_{5}}{dt}&= c_{3}x_{1}x_{25} - c_{4}x_{5} - c_{5}x_{5}x_{26} + c_{6}x_{7} - c_{1}x_{2}x_{5} + c_{15}x_{8}\\
\frac{dx_{6}}{dt}&= c_{16}x_{3}x_{26} - c_{17}x_{6} - c_{18}x_{6}x_{25} + c_{19}x_{9} - c_{15}x_{6} + c_{1}x_{2}x_{4}\\
\frac{dx_{7}}{dt}&= c_{5}x_{5}x_{26} - c_{6}x_{7} + c_{3}x_{4}x_{25} - c_{4}x_{7} - c_{1}x_{7}x_{2} + c_{15}x_{9} - c_{22}x_{7}\\
\frac{dx_{8}}{dt}&= c_{18}x_{3}x_{25} - c_{19}x_{8} - c_{16}x_{8}x_{26} + c_{17}x_{9} - c_{15}x_{8} + c_{1}x_{2}x_{5}\\
\frac{dx_{9}}{dt}&= c_{16}x_{8}x_{26} - c_{17}x_{9} + c_{18}x_{6}x_{25} - c_{19}x_{9} + c_{1}x_{2}x_{7} - c_{15}x_{9} - c_{20}x_{9}\\
\frac{dx_{10}}{dt}&= (c_{20}x_{9}(1 - c_{23}) + c_{22}x_{7}(1 - c_{24}))c_{25}c_{26} - x_{10}\\
\frac{dx_{11}}{dt}&= c_{20}c_{23}x_{9} - c_{15}x_{11} + c_{1}x_{2}x_{12} - c_{13}x_{11}x_{19} + c_{14}x_{15} + c_{7}x_{3}x_{13} - c_{8}x_{11}\\
\frac{dx_{12}}{dt}&= c_{22}x_{7}c_{24} + c_{7}x_{1}x_{13} - c_{8}x_{12} - c_{1}x_{12}x_{2} + c_{15}x_{11} - c_{13}x_{12}x_{19} + c_{14}x_{14}\\
\frac{dx_{13}}{dt}&= - c_{7}x_{13}(x_{1} + x_{3} + x_{20} + x_{21}) + c_{8}(x_{11} + x_{12} + x_{14} + x_{15})\\
\frac{dx_{14}}{dt}&= c_{13}x_{12}x_{19} - c_{14}x_{14} - c_{1}x_{2}x_{14} + c_{15}x_{15} + c_{7}x_{20}x_{13} - c_{8}x_{14}\\
\frac{dx_{15}}{dt}&= c_{1}x_{2}x_{14} - c_{15}x_{15} + c_{13}x_{11}x_{19} - c_{14}x_{15} - c_{21}x_{15} + c_{7}x_{21}x_{13} - c_{8}x_{15}\\
\frac{dx_{16}}{dt}&= c_{20}(1 - c_{23})x_{9} - c_{15}x_{16} + c_{1}x_{2}x_{17} + c_{9}x_{3}x_{18} - c_{10}x_{16}\\
\frac{dx_{17}}{dt}&= c_{22}(1 - c_{24})x_{7} + c_{15}x_{16} - c_{1}x_{2}x_{17} + c_{9}x_{1}x_{18} - c_{10}x_{17}\\
\frac{dx_{18}}{dt}&= - c_{9}x_{18}(x_{1} + x_{3}) + c_{10}(x_{17} + x_{16})\\
\frac{dx_{19}}{dt}&= c_{20}(1 - c_{23})x_{9} - c_{13}x_{19}(x_{12} + x_{1}) + c_{14}(x_{14} + x_{20}) + c_{22}(1 - c_{24})x_{7}\\
\frac{dx_{20}}{dt}&= c_{13}x_{1}x_{19} - c_{14}x_{20} - c_{1}x_{2}x_{20} + c_{15}x_{21} - c_{7}x_{20}x_{13} + c_{8}x_{14}\\
\frac{dx_{21}}{dt}&= c_{1}x_{2}x_{20} - c_{15}x_{21} - c_{7}x_{21}x_{13} + x_{8}x_{15}\\
\frac{dx_{22}}{dt}&= c_{21}x_{15} - c_{15}x_{22} + c_{1}x_{2}x_{23} + c_{11}x_{3}x_{24} - c_{12}x_{22}\\
\frac{dx_{23}}{dt}&= c_{11}x_{1}x_{24} - c_{12}x_{23} - c_{1}x_{2}x_{23} + c_{15}x_{22}\\
\frac{dx_{24}}{dt}&= - c_{11}x_{24}(x_{1} + x_{3}) + c_{12}(x_{23} + x_{22})\\
\frac{dx_{25}}{dt}&= - c_{3}x_{25}(x_{1} + x_{4}) + c_{4}(x_{5} + x_{7}) - c_{18}x_{25}(x_{3} + x_{6}) + c_{19}(x_{8} + x_{9})\\
\frac{dx_{26}}{dt}&= - c_{5}x_{26}(x_{1} + x_{5}) + c_{6}(x_{4} + x_{7}) - c_{16}x_{26}(x_{3} + x_{8}) + c_{17}(x_{6} + x_{9})
\end{align*}
\end{document}

• Thank you so much!! I didn't even realize those were errors. Jan 23, 2015 at 20:38
• @rdale1 LaTeX must have screamed multiple error messages. Do not ignore them! If tex makes an error message the typeset result is essentially arbitrary TeX recovers to try to let processing carry on to find more errors, it does not try to generate reasonable pdf after an error. Jan 23, 2015 at 20:38