我怎样才能达到这种效果?这是我的代码
\[\textcolor{blue}{
\begin{aligned}
u_{1}^{\prime} &=u_{1} \\
u_{2}^{\prime} &=u_{2}-\frac{\left\langle u_{2}, u_{1}^{\prime}\right\rangle}{\left\langle u_{1}^{\prime}, u_{1}^{\prime}\right\rangle} u_{1}^{\prime} \\
u_{3}^{\prime} &=u_{3}-\frac{\left\langle u_{3}, u_{1}^{\prime}\right\rangle}{\left\langle u_{1}^{\prime}, u_{1}^{\prime}\right\rangle} u_{1}^{\prime}-\frac{\left\langle u_{3}, u_{2}^{\prime}\right\rangle}{\left\langle u_{2}^{\prime}, u_{2}^{\prime}\right\rangle} u_{2}^{\prime} \\
\vdots\quad & \vdots \quad \quad \vdots\\
u_{n}^{\prime} &=u_{n}-\frac{\left\langle u_{n}, u_{1}^{\prime}\right\rangle}{\left\langle u_{1}^{\prime}, u_{1}^{\prime}\right\rangle} u_{1}^{\prime}-\frac{\left\langle u_{n}, u_{2}^{\prime}\right\rangle}{\left\langle u_{2}^{\prime}, u_{2}^{\prime}\right\rangle} u_{2}^{\prime}-\cdots-\frac{\left\langle u_{n}, u_{n-1}^{\prime}\right\rangle}{\left\langle u_{n-1}^{\prime}, u_{n-1}^{\prime}\right\rangle} u_{n-1}^{\prime}
\end{aligned}}
\]
答案1
首先删除所有没有任何用处的内容\left
。\right
接下来,定义重复部分的简写(带参数)。您也可以使用'
而不是^{\prime}
。
\documentclass{article}
\usepackage{amsmath,mathtools}
\usepackage{xcolor}
\begin{document}
\[\color{blue!70}
\newcommand{\gs}[2]{%
\frac{\langle u_{#1},u_{#2}'\rangle}
{\langle u_{#2}',u_{#2}'\rangle}%
u_{#2}'%
}
\begin{aligned}
u_{1}' &=u_{1} \\
u_{2}' &=u_{2}-\gs{2}{1} \\
u_{3}' &=u_{3}-\gs{3}{1}-\gs{3}{2} \\
\vdotswithin{u_{n}} & \vdotswithin{=} \vdotswithin{u_2-\gs{2}{1}}\\
u_{n}' &=u_{n}-\gs{n}{1}-\gs{n}{2}-\dots-\gs{n}{n-1}
\end{aligned}
\]
\end{document}
答案2
这是一个解决方案,(a)使用\tfrac
而不是\frac
和(b)使用\shortvdotswithin
——包提供的宏mathtools
——而不是\vdots
创建一个看起来紧凑的方程组。
注意,此解决方案在最后两行之间仅使用一组垂直点。如果方程式排版太紧凑,不符合您的口味,只需\tfrac
用\frac
和替换\shortvdotswithin
即可\vdotswithin
。
\documentclass{article} % or some other suitable document class
\usepackage{xcolor} % for '\color' macro
\usepackage{mathtools} % for '\shortvdotswithin' macro
\newcommand\myfrac[2]{% % handy shortcut macro
\tfrac{\langle u^{}_{#1}, u_{#2}'\rangle}% % note the use of "^{}"
{\langle u_{#2}', u_{#2}'\rangle}
u_{#2}'}
\begin{document}
\begingroup % limit the scope of the following instruction
\color{blue}
\begin{align*}
u_1' &= u_1 \\
u_2' &= u_2-\myfrac{2}{1} \\
u_3' &= u_3-\myfrac{3}{1}-\myfrac{3}{2} \\
&\shortvdotswithin{=}
u_n' &= u_n-\myfrac{n}{1}-\myfrac{n}{2}-\dots-\myfrac{n}{n-1}
\end{align*}
\endgroup
\end{document}