我怎样才能在 gather 环境中并排放置多个方程式,并进行换行以避免这些方程式超出页面大小。以下是一个例子:
\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}
由此得出方程
推断页边距。
答案1
以下是另外两种可能性:
\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}
答案2
如果我理解正确的话你想要类似的东西
从
\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}
如果您确实想节省垂直空间,您可以将其更改{2}
为{4}
,然后将每个其他步骤更改\\
为&
以每行获得两个步骤,但我认为这不会有助于提高可读性。
\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}