我想在文档的左侧对齐一些方程式。此外,我希望每个方程式后面都有对齐的文本。方程式也需要编号。使用下面的代码,我的目标几乎实现了。我只需要将文本对齐到右侧...我该怎么做?谢谢
\documentclass[a4paper, 11pt]{book}
\usepackage{amsmath}
\begin{document}
\begin{flalign}
&u_\mathrm{L} = L \cdot \frac{\text{d}i_\mathrm{L}}{\text{d}t} \quad(\text{Differentialform}) &\label{eq:2_19} \\
&i_\mathrm{L} = \frac{1}{L} \cdot \int\limits_t u_\mathrm{L} \text{d}t + i_\mathrm{L}(t=0) \quad (\text{Integralform}) &\label{eq:2_20}
\end{flalign}
\end{document}
答案1
...或者只是重新排列“&”符号:
\documentclass[a4paper, 11pt]{book}
\usepackage{amsmath}
\begin{document}
\begin{flalign}
u_\mathrm{L} & = L \cdot \frac{\text{d}i_\mathrm{L}}{\text{d}t}
&
& \text{(Differentialform)} & & \\
i_\mathrm{L} & = \frac{1}{L} \cdot \int\limits_t u_\mathrm{L} \text{d}t + i_\mathrm{L}(t=0)
&
& \text{(Integralform)} & &
\end{flalign}
\end{document}
答案2
\mathllap
这只是使用该mathtools
包中的最长方程(的一部分)的问题:
\documentclass[a4paper, 11pt]{book}
\usepackage{mathtools}
\begin{document}
\begin{flalign}
& u_\mathrm{L} = L · \frac{\text{d}i_\mathrm{L}}{\text{d}t} & & \text{(Differentialform)} & & \label{eq:2_19} \\
& \mathrlap{i_\mathrm{L} = \frac{1}{L} · \int\limits_t u_\mathrm{L} \text{d}t + i_\mathrm{L}(t=0) } & & \text{(Integralform)} & & \label{eq:2_20}
\end{flalign}
\end{document}
答案3
您可以使用[fleqn]
包选项amsmath
并通过\mathindent
长度控制左缩进:
笔记:
- 包裹
showframe
仅用于显示页边距。实际使用中不需要它。
代码:
\documentclass{book}
\usepackage[fleqn]{amsmath}
\usepackage{showframe}
\begin{document}
{%\setlength{\mathindent}{0pt}% <-- brace group to keep these changes local.
\begin{alignat}{3}
u_\mathrm{L} &= L \cdot \frac{\text{d}i_\mathrm{L}}{\text{d}t} &&\quad(\text{Differential form}) &\label{eq:2_19} \\
i_\mathrm{L} &= \frac{1}{L} \cdot \int\limits_t u_\mathrm{L} \text{d}t + i_\mathrm{L}(t=0) &&\quad(\text{Integral form}) \label{eq:2_20}
\end{alignat}
}
\end{document}