我希望得到与下图相同的结果(当然还有其他变量):
我试过这个代码,效果很好,但对我来说这不是正确的做法,因为我需要每个方程的编号,因为在对齐环境中可以有编号。我使用的代码如下,如您所见,代码太大了。我想知道是否可以将其简化为对齐环境或另一种使用 \underbrace {} 的简单方法?..
\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}
\begin{document}
\[
\underbrace{
\begin{array}{c}
z_1 \\[0.2cm]
z_2 \\[0.2cm]
z_3 \\[0.2cm]
z_4
\end{array}}_\text{Measurements}
\begin{array}{c}
= \\[0.2cm]
= \\[0.2cm]
= \\[0.2cm]
=
\end{array}
\underbrace{
\begin{array}{c}
h_1\left(x_1, x_2, x_3, x_4\right) \\[0.2cm]
h_2\left(x_1, x_2, x_3, x_4\right) \\[0.2cm]
h_3\left(x_1, x_2, x_3, x_4\right) \\[0.2cm]
h_4\left(x_1, x_2, x_3, x_4\right)
\end{array}}_\text{True values from system model}
\begin{array}{c}
+ \\[0.2cm]
+ \\[0.2cm]
+ \\[0.2cm]
+
\end{array}
\underbrace{
\begin{array}{c}
e_1 \\[0.2cm]
e_2 \\[0.2cm]
e_3 \\[0.2cm]
e_4
\end{array}}_\text{Errors}
\]
\end{document}
提前感谢您的帮助。
答案1
我不太确定这两种解决方案是否真的令人满意;我可能会在对齐之外写出符号的含义。无论如何,下面是它:
\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools,calc}
% for the align solution
\newcommand{\fakeunderbrace}[3]{%
\mathmakebox[\widthof{$\underbrace{#3}_{#1}$}]{\;#2}%
}
\newcommand{\fuba}[1]{%
\fakeunderbrace{\text{Measurements}}{#1}{\qquad\qquad}%
}
\newcommand{\fubb}[1]{%
\fakeunderbrace{\substack{\text{True values from}\\\text{system model}}}
{#1}{\,h_4(x_1, x_2, x_3, x_4)\,}%
}
\newcommand{\fubc}[1]{%
\fakeunderbrace{\text{Errors}}{#1}{\qquad\qquad}%
}
% for the alignat solution
\newcommand{\fw}[2]{\mathmakebox[\widthof{$#1$}]{#2}}
\newcommand{\fwa}[1]{\fw{\substack{\text{Measurements}}}{#1}}
\newcommand{\fwb}[1]{\fw{\quad h_1(x_1,x_2,x_3,x_4)\quad}{#1}}
\newcommand{\fwc}[1]{\fw{\substack{\text{Errors}}}{#1}}
\begin{document}
\begin{align}
\fuba{z_1} &= \fubb{h_1(x_1, x_2, x_3, x_4)} + \fubc{e_1} \\
\fuba{z_2} &= \fubb{h_2(x_1, x_2, x_3, x_4)} + \fubc{e_2} \\
\fuba{z_3} &= \fubb{h_3(x_1, x_2, x_3, x_4)} + \fubc{e_3} \\
\fuba{z_4} &= \fubb{h_4(x_1, x_2, x_3, x_4)} + \fubc{e_4} \\[-.8\baselineskip]
\underbrace{\qquad\qquad}_{\text{Measurements}} &\hphantom{{}={}}
\underbrace{\mathmakebox[\widthof{$h_1(x_1, x_2, x_3, x_4)$}]{}}%
_{\substack{\text{True values from}\\\text{system model}}}
\hphantom{\;+\;} \underbrace{\qquad\qquad}_{\text{Errors}}\nonumber
\end{align}
\begin{alignat}{2}
\substack{\text{Measurements}}
& \hphantom{{}={}}
\fwb{\substack{\text{True values from}\\\text{system model}}}
&& \hphantom{{}+{}}
\fwc{\substack{\text{Errors}}} \nonumber \\
\fwa{z_1} &= \fwb{h_1(x_1, x_2, x_3, x_4)} &&+ \fwc{e_1} \\
\fwa{z_2} &= \fwb{h_2(x_1, x_2, x_3, x_4)} &&+ \fwc{e_2} \\
\fwa{z_3} &= \fwb{h_3(x_1, x_2, x_3, x_4)} &&+ \fwc{e_3} \\
\fwa{z_4} &= \fwb{h_4(x_1, x_2, x_3, x_4)} &&+ \fwc{e_4}
\end{alignat}
\end{document}
答案2
这是一个稍微不太复杂但确实有效的方法:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat}{3}
z_1\qquad &= h_1\bigl(x_1, x_2, x_3, x_4\bigr) && + \enspace e_1 \\
z_2\qquad &= h_2\bigl(x_1, x_2, x_3, x_4\bigr) && + \enspace e_2 \\
z_3\qquad &= h_3\bigl(x_1, x_2, x_3, x_4\bigr) && + \enspace e_3 \\
z_4\qquad &= h_4\bigl(x_1, x_2, x_3, x_4\bigr) && + \enspace e_4 \\[-.5\normalbaselineskip]
\underbrace{\hphantom{zzzzzzz}}_{\text{Measurements}} &
\phantom{{}=}\underbrace{\hphantom{h_4\bigl(x_1, x_2, x_3, x_4\bigr)}}_{\text{\shortstack{True values from \\ system model}}} &&
\phantom{+}\underbrace{\hphantom{eeeeee}}_{\text{Errors}} \nonumber
\end{alignat}
\end{document}