0

This question already has an answer here:

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

enter image description here

that extrapolates the page margins.

marked as duplicate by Werner equations Jul 25 '17 at 23:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 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
1

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} 

enter image description here

0

If I understand correctly you want something like

enter image description here

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.

enter image description here

\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}

Not the answer you're looking for? Browse other questions tagged or ask your own question.