首页 > 编程知识 正文

latex中矩阵换行,latex矩阵左对齐

时间:2023-05-03 12:16:55 阅读:194686 作者:2863

1 开花前

本科毕设中需要输入如下的公式以凑字数 :

不想花时间系统地学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

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。