How to start a new line in a LaTeX equation: split, aligned, align, and multline
To start a new line in a LaTeX equation, load amsmath and use a multiline environment. Use equation with split for one aligned equation and one number, align for separately numbered rows, or multline for a long equation without an alignment point. A plain equation does not provide rows just because you insert \\.
The same source works in local TeX Live or MiKTeX and in EasyLaTeX. These examples use article and pdfLaTeX, with English text in the source. In an existing paper, keep its document class and engine and copy only the equation fragments you need.
A complete example you can compile
Save this as main.tex. It puts a squared-error term and two regularization terms on separate lines with one number for the whole objective.
\documentclass[a4paper,11pt]{article}\usepackage{amsmath}\begin{document}\begin{equation}\begin{split}J(w) &= \frac{1}{n}\sum_{i=1}^{n}(w x_i-y_i)^2 \\ &\quad + \lambda w^2 + \mu(w-w_0)^2.\end{split}\label{eq:objective}\end{equation}See Equation~\eqref{eq:objective}.\end{document}Here n is a positive integer; w, w_0, x_i, and y_i are real; and \lambda and \mu are nonnegative. The second row continues the addition. & marks an alignment position and \\ ends a row. A newline in the source alone does not create a new equation row in the PDF.
Choose by alignment and numbering
Layout diagram: decide how many numbers you need, then whether the rows should align. Strokes stand for mathematical content.
| What you need | Environment | Numbering and placement |
|---|---|---|
| One long equation aligned at a chosen point | equation + split | One number from the outer environment |
| An aligned block inside a larger expression | aligned | Requires math mode; outer environment controls numbering |
| Several equations or steps with individual numbers | align | One number per row by default; standalone display |
| One long equation without a shared alignment point | multline | One number; standalone display |
| No numbers | align*, multline*, or aligned inside \[...\] | Choose according to alignment needs |
Use one & per row in the split examples here. aligned supports multiple alignment pairs and can sit beside enclosing delimiters; split suits a single broken equation filling its display. Neither chooses line breaks automatically.
split and aligned: one equation number
The complete example uses split. For a block that can form part of a larger expression, use aligned. Here is the same objective. All following fragments belong inside an existing document body.
\begin{equation}\begin{aligned}J(w) &= \frac{1}{n}\sum_{i=1}^{n}(w x_i-y_i)^2 \\ &\quad + \lambda w^2 + \mu(w-w_0)^2.\end{aligned}\label{eq:aligned}\end{equation}aligned supplies no number itself. Put it in equation for one number or \[...\] for none. Control numbering through the wrapper; do not look for aligned* or split*.
Source-to-layout diagram. D(w) denotes the data-error term and R(w) the sum of both regularization terms; the markers identify the alignment point and row break.
\quad indents the continuation. To preserve binary-operator spacing on a leading plus, you can write &\quad {}+ .... Repeated source spaces do not position the rows: TeX ignores most spaces in math mode.
align: cite the objective and derivative separately
If your paper refers to the objective and its derivative individually, give each a row and label. Differentiation below treats x_i, y_i, w_0, \lambda, and \mu as constants with respect to w.
\begin{align}J(w) &= \frac{1}{n}\sum_{i=1}^{n}(w x_i-y_i)^2 + \lambda w^2 + \mu(w-w_0)^2 \label{eq:loss} \\J'(w) &= \frac{2}{n}\sum_{i=1}^{n}x_i(w x_i-y_i) + 2\lambda w + 2\mu(w-w_0). \label{eq:gradient}\end{align}Use \eqref{eq:loss} and \eqref{eq:gradient} in the text. These are separate mathematical statements, each with an equals sign. Do not add an equals sign to a continuation that simply adds the remaining terms of a sum.
Use align* to remove all numbers. To number only one row, put \notag before the row break on the others:
\begin{align}(x+1)^2 &= x^2+2x+1 \notag \\ &= x(x+2)+1. \label{eq:expansion}\end{align}Attach the label to a numbered row. If a new reference shows ??, run LaTeX again locally and check for duplicate labels. On the platform, wait for the current compilation and check its reference output.
multline: no alignment point required
The same objective can use multline, without &:
\begin{multline}J(w) = \frac{1}{n}\sum_{i=1}^{n}(w x_i-y_i)^2 \\ + \lambda w^2 + \mu(w-w_0)^2.\label{eq:multline}\end{multline}With the default right-side numbering used here, the first row starts toward the left, the last ends toward the right, and the number sits on the last row. The environment leaves a small gap at the edges; intermediate rows are centered. Document-class and amsmath options can change display placement and numbering direction. Use multline* for no number. Do not nest this standalone display inside equation or \[...\].
Diagnose failed line breaks
| Symptom or log message | What to check |
|---|---|
Environment align undefined | Load amsmath in the main file's preamble; ensure it is installed locally |
\\ inside equation does not make rows | Add split or aligned, or use standalone align or multline |
Erroneous nesting of equation structures | Check for align nested in equation |
Misplaced alignment tab character & | Use & only in an alignment environment; not in multline |
Missing \right. or delimiter errors | Check whether \left and \right cross a row boundary |
| A PDF is produced but the equation still overflows | Move the break or regroup terms; inspect Overfull \hbox warnings and the PDF |
This nesting is incorrect:
% Incorrect nesting\begin{equation}\begin{align}a &= b \\ &= c\end{align}\end{equation}For one number, replace the inner environment:
\begin{equation}\begin{split}a &= b \\ &= c\end{split}\end{equation}Do not pair \left( and \right) across alignment rows. Fixed-size delimiters can span the visual break without that pairing restriction:
\[\begin{aligned}F(x) &= \Bigl(a+b+c \\ &\qquad +d+e\Bigr).\end{aligned}\]Here a through e are terms being added; the fragment demonstrates delimiter syntax. Keep blank paragraphs out of math environments and normally omit \\ on the final row.
Two-column papers: shorten each row
The usable width in a two-column template is one column. A formula that fits the example above may still overflow there. Define the data and regularization terms to shorten the rows:
\begin{equation}\begin{split}J(w) &= D(w)+R(w), \\D(w) &= \frac{1}{n}\sum_{i=1}^{n}(w x_i-y_i)^2, \\R(w) &= \lambda w^2+\mu(w-w_0)^2.\end{split}\label{eq:compact}\end{equation}This preserves the objective. Recheck widths, numbering, and delimiters in the actual submission template. Prefer meaningful breaks to shrinking the entire equation with \resizebox. Follow the publisher's instructions for displays spanning both columns.
Check locally or in EasyLaTeX
Compilation workflow diagram. Both paths end by checking the current PDF's margins and equation numbers.
Local TeX Live or MiKTeX
Save the complete example as main.tex and run this command twice in its directory to resolve the reference. If you use an editor's build button, check its root-file and compiler settings.
pdflatex -interaction=nonstopmode -halt-on-error main.texRead main.log, fix the first error, and inspect overflow warnings. Open the newly generated main.pdf: both rows should be complete, the objective should have one number, and its reference should have parentheses rather than ??. If local and online outputs differ, compare the class, engine, package versions, and column width.
EasyLaTeX: main file, compiler, and Agent
In a blank test project, create main.tex, select it in the top main-file dropdown, choose pdfLaTeX in Editor Settings, and compile. In an existing paper, keep its main file, engine, and template and replace only the equation block. Compiler selection is stored per user in the project, so collaborators should check their own setting.
Wait for the current job and inspect line breaks, alignment, and numbering in the PDF preview. Open Bug and Original Log for errors. AI Fix can start Agent debugging; you can also make a specific request in Chat & Agent:
Split the current objective across two rows with one number and the existing label. Preserve every term, coefficient, delimiter, and sign. Check the main file and existing packages first, edit only the relevant equation block, compile, and report remaining errors or overflow.
Review Agent's source changes and the current compilation result. An older visible PDF does not establish that the latest build succeeded. Compare the mathematics term by term, then download the PDF or LaTeX project for submission or continued local editing.
Related guides: multiline equations and alignment, numbering and references, getting started in EasyLaTeX, and compilation troubleshooting.