我正在将一本书翻译成中文,但翻译公司没有提供这本书的 latex 文件。如何在子方程式前添加文本?
这是我的代码
\parbox{8.5em}{
predictor: \\
Kalman gain: \\
corrector:
}
\parbox{8.5em}{
\begin{subequations}
\begin{align}
\check{\mathbf{P}}_k &= ...\\
\check{\mathbf{x}}_k &= ...\\
\mathbf{K}_k &= ...\\
\hat{\mathbf{P}}_k &= ...\\
\hat{\mathbf{x}}_k &= ...
\end{align}
\end{subequations}
}
答案1
使用以下快速解决方案eqnarray
(不太推荐):
\documentclass{article}
\usepackage{amsmath,multirow}
\begin{document}
\begin{subequations}
\begin{eqnarray}
\multirow{2}{*}{predictor:} &\Check{\mathbf{P}}_k = ...\\
&\Check{\mathbf{x}}_k = ...\\
\text{Kalman gain:} &\mathbf{K}_k = ...\\
\multirow{2}{*}{corrector:} &\hat{\mathbf{P}}_k = ...\\
&\hat{\mathbf{x}}_k = ...
\end{eqnarray}
\end{subequations}
\end{document}
更好的选择是使用align
:
\begin{subequations}
\newcommand{\hleft}{\hspace{-6em}}
\begin{align}
\multirow{2}{*}{predictor:} &\hleft& \Check{\mathbf{P}}_k &= ...\\
&\hleft& \Check{\mathbf{x}}_k &= ...\\
\text{Kalman gain:} &\hleft& \mathbf{K}_k &= ...\\
\multirow{2}{*}{corrector:} &\hleft& \hat{\mathbf{P}}_k &= ...\\
&\hleft& \hat{\mathbf{x}}_k &= ...
\end{align}
\end{subequations}
答案2
两种解决方案,包括\alignat
和mathtools
,以及一些手动调整:
\documentclass{article}
\usepackage{array}
\usepackage{mathtools}
\begin{document}
\begin{subequations}
\begin{alignat}{2}
& & \check{\mathbf{P}}_k & = ... \\[-1.2ex]
\ArrowBetweenLines[\llap{\raisebox{-0.8ex}[0pt][0pt]{predictor:}}] & \qquad & \check{\mathbf{x}}_k & = ... \\[0.5ex]
\llap{Kalman gain:\quad} & & \mathbf{K}_k & = ... \\
& & \hat{\mathbf{P}}_k & = ... \\[-1.2ex]
\ArrowBetweenLines[\llap{\raisebox{-0.8ex}{corrector:}}] & & \hat{\mathbf{x}}_k & = ...
\end{alignat}
\end{subequations}
\begin{subequations}
\begin{alignat}{2}
& & \check{\mathbf{P}}_k & = ... \\
& & \check{\mathbf{x}}_k & = ... \\
\llap{\raisebox{1.2ex}[0pt][0pt]{\setlength{\extrarowheight}{3ex}\begin{tabular}{r}predictor: \\[-0.5ex]Kalman gain: \\corrector:
\end{tabular}}} & \qquad & \mathbf{K}_k & = ... \\
& & \hat{\mathbf{P}}_k & = ... \\
& & \hat{\mathbf{x}}_k & = ...
\end{alignat}
\end{subequations}
\end{document}