split equation in multiple lines

I am a new Latex user,I have loaded these two math equation in my Latex documents and i want to split an equation i have into multiple line

\usepackage{amssymb}
\usepackage{amsthm}


I am reading this topic for breaking the lines over multiple

How to break a long equation?

although what ever i do it does not allow me to compile

MWE

\documentclass[authoryear,preprint,review,12pt]{elsarticle}

\usepackage{amssymb}
\usepackage{amsthm}

\begin{document}

$$\label{xx} \begin{split} A&= 1 + 2 + \\ & 3 +4 +6 \end{split}$$

\end{document}

\endinput


So

$$A = 1 + 2 + 3 +4 +6$$


I want to place them/break the equation in two lines and retain the format of numbering and equal placing beneath.

i tried

$$A = 1 + 2 + \\ 3 +4 +6$$


Although it does not work

When i use \begin{multline}

\begin{multline}
A = 1 + 2 + \\
3 +4 +6
\end{multline}


and the following errors

! LaTeX Error: Environment multline undefined.See the LaTeX manual or LaTeX Companion for explanation.Type H <return> for immediate help.... \begin{multline}


! LaTeX Error: \begin{document} ended by \end{multline}.See the LaTeX manual or LaTeX Companion for explanation.Type H for immediate help.... \end{multline}

Though i get the equation broken it is not numbered, or has a one line distance from my text as the Also tried this example as kindly suggested

$$\label{xx} \begin{split} A&= 1 + 2 + \\ & 3 +4 +6 \end{split}$$


and obtaining these

! LaTeX Error: Environment split undefined.See the LaTeX manual or LaTeX Companion for explanation.Type H <return> for immediate help.... \begin{split}
! Misplaced alignment tab character &. A&
! Misplaced alignment tab character &.<recently read> & &
! LaTeX Error:  on input line 142 ended by \end{split}.See the LaTeX manual or LaTeX Companion for explanation.Type H <return> for immediate help.... \end{split}


Have i missed anything?

• multline is its own displayed math environment and should be used on its own, not inside equation. Lots of good introductory material is included in the Short Math Guide for LaTeX. Jul 7, 2014 at 12:22
• @PaulGessler I used it alone but it gave more errors in the compilers most of them saying ! Missing $inserted.<inserted text>$ ...l N(\sigma;\lambda;\theta;t)}{\partial t} over multiple lines Jul 7, 2014 at 12:25
• @PaulGessler although as far as I can see the give s me a better visual result, that is why i am keen of using that one Jul 7, 2014 at 12:28
• @PaulGessler I had a look in the document, thank you for the link. I copied and pasted their example exactly as is, but i still get errors, does it have to do with the package i am using? Jul 7, 2014 at 12:45
• (a) multiline is defined by the amsmath package, (b) it is a top level environment and can't be embedded in equation, use split instead (also from the amsmath package). Jul 7, 2014 at 13:04

I suggest you use a split environment, which in contrast to multline may be used a subenvironment of equation. You need to specify an alignment point on each line with & and separate lines with \\. In this case the first line should be move left relative to the others and the package mathtools provides a convenient command for this:

\documentclass{article}

\usepackage{mathtools}

\begin{document}

$$\label{wave kinematic} \begin{split} \MoveEqLeft \frac{\partial N(\sigma;\lambda;\theta;t)}{\partial t} + \frac{\partial C_{g,\lambda}N(\sigma;\lambda;\theta;t)} {\partial \lambda} \\ &+ \cos\phi^{-1} \cdot \frac{\partial C_{f,\phi}N(\sigma;\lambda;\theta;t)}{\partial \phi} \\ &+ \frac{\partial C_{f,\theta}N(\sigma;\lambda;\theta;t)}{\partial \theta} + \frac{\partial C_{f,\sigma}N(\sigma;\lambda;\theta;t)}{\partial \sigma} = \frac{S(\sigma;\theta;\lambda;\varphi;t)}{\sigma} \end{split}$$

\end{document}


I have split across three lines for clarity. If you wanted to just split in two parts, then multlined (notice the extra d) from the mathtools package would be a simpler solution:

\documentclass{article}

\usepackage{mathtools}

\begin{document}

$$\label{wave kinematic} \begin{multlined} \frac{\partial N(\sigma;\lambda;\theta;t)}{\partial t} + \frac{\partial C_{g,\lambda}N(\sigma;\lambda;\theta;t)} {\partial \lambda} + \cos\phi^{-1} \cdot \frac{\partial C_{f,\phi}N(\sigma;\lambda;\theta;t)}{\partial \phi} \\ + \frac{\partial C_{f,\theta}N(\sigma;\lambda;\theta;t)}{\partial \theta} + \frac{\partial C_{f,\sigma}N(\sigma;\lambda;\theta;t)}{\partial \sigma} = \frac{S(\sigma;\theta;\lambda;\varphi;t)}{\sigma} \end{multlined}$$

\end{document}


All the above works with elsarticle class in your updated question. E.g. the first version becomes:

\documentclass[authoryear,preprint,review,12pt]{elsarticle}

\usepackage{mathtools}

\begin{document}

$$\label{wave kinematic} \begin{split} \MoveEqLeft \frac{\partial N(\sigma;\lambda;\theta;t)}{\partial t} + \frac{\partial C_{g,\lambda}N(\sigma;\lambda;\theta;t)} {\partial \lambda} \\ &+ \cos\phi^{-1} \cdot \frac{\partial C_{f,\phi}N(\sigma;\lambda;\theta;t)}{\partial \phi} \\ &+ \frac{\partial C_{f,\theta}N(\sigma;\lambda;\theta;t)}{\partial \theta} + \frac{\partial C_{f,\sigma}N(\sigma;\lambda;\theta;t)}{\partial \sigma} = \frac{S(\sigma;\theta;\lambda;\varphi;t)}{\sigma} \end{split}$$

\end{document}

• thank you very much, although if i may ask can i ask if multiple packages can be used. I am trying to learn Latex at the same time , thank you for your patience Jul 7, 2014 at 15:10
• Yes you can load several different packages. Jul 7, 2014 at 15:16
• mathtools helps my case. I was using amsthm but it produces weird formatting under Elsevier’s template. Switching to mathtools resolves the issue for me. Jan 16, 2021 at 1:12

Not sure what you tried doing with multine but this seems OK:

\documentclass{amsart}
\begin{document}

\begin{multline}\label{wave kinematic}
\frac{\partial N(\sigma;\lambda;\theta;t)}{\partial t} + \frac{\partial C_{g,\lambda}N(\sigma;\lambda;\theta;t)}{\partial \lambda} +
\cos\phi^{-1}\cdot \frac{\partial C_{f,\phi}N(\sigma;\lambda;\theta;t)}{\partial \phi}+\\
\frac{\partial C_{f,\theta}N(\sigma;\lambda;\theta;t)}{\partial \theta}+\frac{\partial C_{f,\sigma}N(\sigma;\lambda;\theta;t)}{\partial \sigma} = \frac{S(\sigma;\theta;\lambda;\varphi;t}{\sigma}
\end{multline}

\end{document}


Using this you obtain:

Btw, you seem to be missing a bracket on the RHS -- and I deleted an extraneous comma after the .

• Andrew,@Andrew,i used \begin{multline} after the , i pasted your solution and i get an error which i have given in the question as a new edit. I am using the package math of \usepackage{amssymb} \usepackage{amsthm} Jul 7, 2014 at 12:10
• @George I posted the self-contained code example above so that you could see one of doing this that works. My code compiles and, looking at it, it doesn't contain $$...$$. Why don't you try leaving this out?
– user30471
Jul 7, 2014 at 20:16
• i will try it as well, i was fortunate to get many helpful answers. thank you for your time Jul 8, 2014 at 6:34