有没有办法让整个文档中所有等式的所有等号对齐?我写了一个论文(scrbook
),希望所有等号都对齐。如果无法让整个文档对齐,至少在一章中对齐。
或者\begin{align}
只\begin{eqnarray}
针对小组这样做。而用于\intertext
整个章节是不切实际的。
例如目前的情况:
\begin{align}
F_L^{\rightarrow} & = q ( E_{eFeld}^{\rightarrow} + v^{\rightarrow} \times B^{\rightarrow} )
\end{align}
much text
\begin{align}
F_{Lx} & = q ( E_{eFeld} + v_{gx} * B )
\end{align}
little text
\begin{align}
T & = F_{L1} - F_{L2} \\
& = q ( E_{eFeld} + v_{g1} * B - E_{eFeld} - v_{g2} * B ) \\
& = q*B ( v_{g1} - v_{g2} )
\end{align}
\subsection{new subsection}
very little text
\begin{align}
P_{Photon} & = hf * nAc \\
& = \frac{E_{Photon}}{t}
\end{align}
more text
\begin{align}
F_{0} & = 2nhfA \\
& = \frac{2 P_{Photon}}{c}
\end{align}
我想要的是类似这样的东西:
A = b+C
Text
A = longe equation
**New Headline**
B = also nice equation
等等。我想你明白我想要什么了。你能帮我吗?谢谢
答案1
从我的回答开始对齐单独的方程式,我发现我需要更改一些内容,特别是因为这个问题的 OP 想要包含多线方程。因此,我必须将其恢复\arraystretch
为非零值(事实上,我将其设置为 1.2)。但这样一来,我必须\vspace
在进入和退出algneqn
我创建的环境时进行一些操作。
但最终,所有等号都对齐了,正如 OP 所要求的。设置\leftalgn
和的值\rightalgn
将决定对齐标签将设置在整行的哪个位置。
\documentclass{article}
\usepackage{amsmath}
\def\leftalgn{0.3}\def\rightalgn{0.6}
\def\algnrow{\rule{\leftalgn\textwidth}{0ex}&\rule{\rightalgn\textwidth}{0ex}}
% CONSTRAINTS:
% equation label must fit in {1 -\leftalgn -\rightalgn}\textwidth
% \leftalgn must be larger than any text to left of align character
% \rightalgn must be larger than any text to right of align character
\newenvironment{algneqn}{%
\vspace{-1.6\baselineskip}%
\arraycolsep=0ex\renewcommand\arraystretch{1.2}%
\begin{equation}%
\begin{array}{rl}%
\algnrow\\%
}%
{\\\algnrow%
\end{array}\vspace{-\baselineskip}%
\end{equation}\ignorespacesafterend%
}
\def\snug#1{\vspace*{-#1\baselineskip}}
\begin{document}
\begin{algneqn}
F_L^{\rightarrow} & = q ( E_{eFeld}^{\rightarrow} + v^{\rightarrow} \times B^{\rightarrow} )
\end{algneqn}
much text
\begin{algneqn}
F_{Lx} & = q ( E_{eFeld} + v_{gx} * B )
\end{algneqn}
little text
\begin{algneqn}
T & = F_{L1} - F_{L2} \\
& = q ( E_{eFeld} + v_{g1} * B - E_{eFeld} - v_{g2} * B ) \\
& = q*B ( v_{g1} - v_{g2} )
\end{algneqn}
\subsection{new subsection}
very little text
\begin{algneqn}
P_{Photon} & = hf * nAc \\
& = \dfrac{E_{Photon}}{t}
\end{algneqn}
more text
\begin{algneqn}
F_{0} & = 2nhfA \\
& = \dfrac{2 P_{Photon}}{c}
\end{algneqn}
\end{document}