本科毕设中需要输入如下的公式以凑字数 :
不想花时间系统地学LaTeX…多看了几篇博客东拼西凑勉强开了个花。
2 开花中矩阵对齐有好多:
直接用matrix、pmatrix、bmatrix、Bmatrix、vmatrix或者Vmatrix环境:使用array环境来输入矩阵使用left[ begin{array}{ccc} 1 & 0 & -1\ 1 & 0 & -1\ 1 & 0 & -1 end{array} right ]}这种…在 begin{equation} end{equation} 里的操作…公式换行对齐也有好多,感觉都无外乎align还有split这种操作…但是结合起来就一堆bug
3 开花 (失败?)实现方法:使用$公式的语句下的用bmatrix的矩阵输入加上…align的对齐方法(但是会报错)
$$begin{align}boldsymbol{x}&=Vhat{boldsymbol{x}}=begin{bmatrix} vdots & vdots & cdots & vdots \ boldsymbol{v_1} & boldsymbol{v_2} & cdots & boldsymbol{v_N} \ vdots & vdots & cdots & vdots end{bmatrix} begin{bmatrix} hat{x}_1 \ hat{x}_2 \ vdots \ hat{x}_N end{bmatrix}\&=hat{x}_1boldsymbol{v_1}+hat{x}_2boldsymbol{v_2}+cdots+hat{x}_Nboldsymbol{v_N} \&=sum_{k=1}^{N}hat{x}_kboldsymbol{v_k}end{align}$$报错:Package amsmath Error: Erroneous nesting of equation structures;(amsmath) trying to recover with `aligned’. end{align}
效果(虽然报错了但是emmmmm喵个咪的居然实现了…我吐了…有大佬路过的话求帮帮忙拆个蛋)
如果把align的对齐方式改成gathered就不会报错,但是不会按照等号来对齐,也就是单纯的换行:
$$begin{gathered}boldsymbol{x}=Vhat{boldsymbol{x}}=begin{bmatrix} vdots & vdots & cdots & vdots \ boldsymbol{v_1} & boldsymbol{v_2} & cdots & boldsymbol{v_N} \ vdots & vdots & cdots & vdots end{bmatrix} begin{bmatrix} hat{x}_1 \ hat{x}_2 \ vdots \ hat{x}_N end{bmatrix}\=hat{x}_1boldsymbol{v_1}+hat{x}_2boldsymbol{v_2}+cdots+hat{x}_Nboldsymbol{v_N} \=sum_{k=1}^{N}hat{x}_kboldsymbol{v_k}end{gathered}$$效果:
Ref 矩阵对齐参考https://blog.csdn.net/luohuiwu/article/details/80722026
https://blog.csdn.net/cpp12341234/article/details/50068849