
Доброе утро,
Я нашел много вопросов и руководств о том, как выровнять многострочные уравнения, даже на нескольких страницах и т. д., но я не могу понять, как выровнять несколько уравнений с абзацами текста между ними.
Вот минимальный рабочий пример моей проблемы:
\documentclass[10pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{fleqn}
\begin{document}
Since we have
\begin{equation}
e^x = \frac{d}{dx}e^x
\end{equation}
and
\begin{equation}
e^x = \int e^x dx
\end{equation}
one of my students concluded that
\begin{equation}
\int dx = \frac{d}{dx}.
\end{equation}
\end{document}
Это компилируется в:
Как вы видите, первые два уравнения идеально выровнены, так как левые стороны занимают одинаковую ширину. Уравнение 3 не выровнено, так как левая сторона шире. Я ищу простое решение для выравнивания всех знаков равенства, по крайней мере на странице, если не во всем документе.
В полном документе, который я пишу, между уравнениями есть несколько строк объяснений, иногда со встроенной математикой, ссылками и т. д., поэтому решения, которые просто помещают несколько слов обычным текстом в математическую среду, на мой взгляд, не совсем жизнеспособны.
Надеюсь, я ясно изложил свой вопрос и желаю вам хорошего дня.
решение1
Я знаю, вы сказали, что решения, которые "помещают несколько слов в обычный текст внутри математической среды", не кажутся жизнеспособными. Но вы все равно можете рассмотреть команды \intertext
( amsmath
) и \shortintertext
( mathtools
).
Они позволяют помещать между уравнениями целые абзацы текста, включая встроенную математику и цитаты.
Разница между двумя командами заключается в интервале: \shortintertext
между абзацами расстояние меньше, как показано в примере ниже.
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{filecontents}
\begin{filecontents}{references.bib}
@inproceedings{TestSmith,
title={This is a Test},
author={Smith, John and Jones, Ben},
booktitle={2016 Placeholder Conference on Citation Testing},
pages={3--4},
year={2016}
}
\end{filecontents}
\begin{document}
The "intertext" and "shortintertext" commands allow you to put text inside an align environment.
\begin{align}
c + c + e^x &= \frac{d}{dx}e^x
\intertext{this is normal "intertext"}
\intertext{It has large spacing between paragraphs}
b + b + b + e^x &= \int e^x dx
\shortintertext{"shortintertext" from the "mathtools" package has smaller spacing}
\shortintertext{like this}
\int dx &= \frac{d}{dx}.
\shortintertext{This works even for multi-line paragraphs, inline math ($x=\alpha+\frac{a}{b+1}$) and citations~\cite{TestSmith}.}
\shortintertext{Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. . Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.}
\int dx &= \frac{d}{dx} + a + a + a.
\end{align}
\bibliographystyle{apalike}
\bibliography{references}
\end{document}
решение2
\intertext
подходит для одной или нескольких страниц, если этого достаточно для ваших нужд.
\documentclass[10pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[fleqn]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
%\usepackage{fleqn}
\begin{document}
Since we have
\begin{align}
e^x &= \frac{d}{dx}e^x
\intertext{and}
e^x &= \int e^x dx
\intertext{one of my students concluded that.. one of my students concluded that.. one of my students concluded that..}
\int dx &= \frac{d}{dx}.
\end{align}
\end{document}