## 编译环境 操作系统 * [x ] Windows 7/8/10 * [ ] macOS * [ ] Linux `若需勾选,请把[ ]改成[x]` Tex发行版 * [x ] TexLive `年份` * [ ] MikTeX `版本号` * [ ] CTeX `若需勾选,请把[ ]改成[x]` ## 我的问题 在此输入你遇到的问题... ```c \documentclass{article} \usepackage{bm,amsfonts,amssymb,amsmath,float} \begin{document} The covariance matrix is listed as below $ (10^{-4}) $, $$\begin{pmatrix} 146.2 & 82.2 & 77.7 & 55.5 & 4.1 \\ 82.2 & 159.7 & 93.9 & 58.1 & 4.5 \\ 77.7 & 93.9 & 236.6 & 44.2 & 9.2 \\ 55.5 & 58.1 & 44.2 & 191.4 & -1.7 \\ 4.1 & 4.5 & 9.2 & -1.7 & 11.7 \\ \end{pmatrix} . $$ \end{document} ```

1 回答1

0
提供了三种方法,一个是常规的方法,一个是用`nicematrix`包, 一个是用`stackengine`包 ```tex \documentclass{article} \usepackage{bm,amsfonts,amssymb,amsmath,float} \usepackage{array} \usepackage{siunitx} \usepackage{nicematrix} \usepackage{stackengine} \newcommand{\mymatrix}{ \begin{pmatrix} 146.2 & 82.2 & 77.7 & 55.5 & 4.1 \\ 82.2 & 159.7 & 93.9 & 58.1 & 4.5 \\ 77.7 & 93.9 & 236.6 & 44.2 & 9.2 \\ 55.5 & 58.1 & 44.2 & 191.4 & -1.7 \\ 4.1 & 4.5 & 9.2 & -1.7 & 11.7 \\ \end{pmatrix} } \begin{document} \section{Normal method} The covariance matrix is listed as below $ (10^{-4}) $, \[ \begin{array}{l} \vphantom{.} \\[-1em] \mymatrix \end{array} \begin{array}{l} \vphantom{\mymatrix} \\[-1em] . \\ \end{array} \] \section{NiceMatrix} The covariance matrix is listed as below $ (10^{-4}) $, \[ \begin{pNiceArray}{*5{S}}[last-col] 146.2 & 82.2 & 77.7 & 55.5 & 4.1 & \\ 82.2 & 159.7 & 93.9 & 58.1 & 4.5 & \\ 77.7 & 93.9 & 236.6 & 44.2 & 9.2 & \\ 55.5 & 58.1 & 44.2 & 191.4 & -1.7 & \\ 4.1 & 4.5 & 9.2 & -1.7 & 11.7 & . \\ \end{pNiceArray} \] \section{stackengine} \[ \abovebaseline[-3pt]{$\mymatrix$}. \] \end{document} ``` ![](https://wenda.latexstudio.net/data/attach/200615/AX3Er2B2.png)

你的回答

请登录后回答

你的回答将会帮助更多人,请务必认真回答问题。