我有一些文本跟在方程式后面,这些方程式之间用段落分隔(因此无法使用\intertext
)。我希望这些文本在全部文件中方程式的计算结果。例如:
\documentclass{article}
\thispagestyle{empty}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
a_i + b_i = c_i
\qquad \text{for i = 2, \dots, 9}
\end{equation*}
Then a lot of text follows.
\begin{equation}
k_i = a_i + b_i + \sqrt{\text{some stuff that messes up alignment}}
\qquad \text{for i = 1, \dots, 7}
\end{equation}
\end{document}
我希望为了对齐。
答案1
该解将第一个方程置于第二个方程所占空间的中心。
\documentclass{article}
\thispagestyle{empty}
\usepackage{mathtools}
\newsavebox{\tempbox}
\begin{document}
\savebox{\tempbox}{$\displaystyle k_i = a_i + b_i + \sqrt{\text{some stuff that messes up alignment}}$}
\begin{align}
\mathmakebox[\wd\tempbox][c]{a_i + b_i = c_i}
\qquad &\text{for i = 2, \dots, 9} \notag
\intertext{Then a lot of text follows.}
\usebox{\tempbox}
\qquad &\text{for i = 1, \dots, 7}
\end{align}
\end{document}
答案2
\documentclass{article}
\thispagestyle{empty}
\usepackage{amsmath}
\begin{document}
\begin{align*}
a_i + b_i &= c_i
&\qquad \text{for }i = 2, \dots, 9\\% math mode here!!!!
\intertext{
Then a lot of text follows.
\endgraf
and more
\endgraf
a third paragraph
}
k_i &= a_i + b_i + \sqrt{\text{some stuff that messes up alignment}}
&\qquad \text{for } i = 1, \dots, 7% math mode here!!!!
\end{align*}
\end{document}