# How to place several equations side by side with line breaking [duplicate]

How can I place several equations side by side inside the gather environment with the line breaking working to avoid this equations to exceed the page size. Here goes one example:

\documentclass[12pt,oneside]{report}
\usepackage{geometry}
\geometry{a4paper,total={170mm,257mm},left=20mm,top=20mm}
\usepackage[utf8]{inputenc}
\usepackage{amssymb, amsmath, amsthm}

\begin{document}
\begin{gather*}
u'(x) = p(x)u(x) \rightarrow
\frac{u'(x)}{u(x)} = p(x) \rightarrow
\int\frac{u'(x)}{u(x)}dx = \int p(x) dx \rightarrow
\ln |u(x)| = \int p(x) dx + k \rightarrow
|u(x)| = e^{\int p(x) dx + k} \rightarrow
|u(x)| = e^{k}e^{\int p(x) dx} \rightarrow
|u(x)| = ke^{\int p(x) dx}
\end{gather*}
\end{document}


Which generates the equation

that extrapolates the page margins.

## marked as duplicate by Werner equations StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jul 25 '17 at 23:40

• why can't you use \\  ? – David Carlisle Jul 25 '17 at 22:31
• From a reader's view: Eyes don't like to read too broad lines. From a teacher's view: It's better to use several lines instead of glueing the integration steps into one line in order to save paper and ink ;-) – user31729 Jul 25 '17 at 22:33

Here are two other possibilities:

\documentclass[12pt,oneside]{report}
\usepackage{geometry}
\geometry{a4paper,total={170mm,257mm},left=20mm,top=20mm, showframe}
\usepackage[utf8]{inputenc}
\usepackage{amssymb, mathtools, amsthm}

\begin{document}

\begin{align*}
u'(x) = p(x)u(x) \rightarrow
\frac{u'(x)}{u(x)} & = p(x) \rightarrow
\int\frac{u'(x)}{u(x)}dx = \int p(x) dx \rightarrow
\ln |u(x)| = \int p(x) dx + k \\[1.5ex]
{} \rightarrow |u(x)| & = e^{\int p(x) dx + k} \rightarrow
|u(x)| = e^{k}e^{\int p(x) dx} \rightarrow
|u(x)| = ke^{\int p(x) dx}
\end{align*}

\begin{gather*}
u'(x) = p(x)u(x) \rightarrow
\begin{aligned}[t]\frac{u'(x)}{u(x)} & = p(x) → \\
\mathllap{ \int\frac{u'(x)}{u(x)}dx} & = ∫ p(x) dx \rightarrow
\ln |u(x)| = ∫ p(x) dx + k & & \\[1ex]
\mathllap{{} → |u(x)|} & = e^{\int\! p(x) dx + k} \rightarrow
|u(x)| = e^{k}e^{\int\! p(x) dx} \rightarrow
|u(x)| = ke^{\int\! p(x) dx}
\end{aligned}
\end{gather*}

\end{document}


If I understand correctly you want something like

from

\documentclass[12pt,oneside]{report}
\usepackage{geometry}
\geometry{a4paper,total={170mm,257mm},left=20mm,top=20mm}
\usepackage[utf8]{inputenc}
\usepackage{amssymb, amsmath, amsthm}

\begin{document}
\begin{alignat*}{2}
&&u'(x) &= p(x)u(x)\\
\rightarrow&& \frac{u'(x)}{u(x)} &= p(x)\\
\rightarrow&&\int\frac{u'(x)}{u(x)}dx &= \int p(x) dx\\
\rightarrow&&\ln |u(x)| &= \int p(x) dx + k\\
\rightarrow&&|u(x)| &= e^{\int p(x) dx + k} \\
\rightarrow&& |u(x)| &= e^{k}e^{\int p(x) dx}\\
\rightarrow&&|u(x)| &= ke^{\int p(x) dx}
\end{alignat*}
\end{document}


If you really wanted to save vertical space you could change {2} to {4} and then change every other \\ to & to get two steps per line, but I don't think that would help readability.

\documentclass[12pt,oneside]{report}
\usepackage{geometry}
\geometry{a4paper,total={170mm,257mm},left=20mm,top=20mm}
\usepackage[utf8]{inputenc}
\usepackage{amssymb, amsmath, amsthm}

\begin{document}
\begin{alignat*}{4}
&&u'(x) &= p(x)u(x)&
{}\rightarrow{}&& \frac{u'(x)}{u(x)} &= p(x)\\
{}\rightarrow{}&&\int\frac{u'(x)}{u(x)}dx &= \int p(x) dx&
{}\rightarrow{}&&\ln |u(x)| &= \int p(x) dx + k\\
{}\rightarrow{}&&|u(x)| &= e^{\int p(x) dx + k} &
{}\rightarrow{}&& |u(x)| &= e^{k}e^{\int p(x) dx}\\
{}\rightarrow{}&&|u(x)| &= ke^{\int p(x) dx}
\end{alignat*}
\end{document}