我有以下bNiceArray
环境:
\begin{equation}
\mathbf{S}_{Mi} =
\begin{bNiceArray}{cccccccccccc}[first-row,first-col,code-for-first-col=\mathbf{\arabic{iRow}},code-for-first-row=\arabic{jCol}]
& & & & & & & & & & & & \\
& \frac{EA}{L} & 0 & 0 & 0 & 0 & 0 & -\frac{EA}{L} & 0 & 0 & 0 & 0 & 0 \\
& & \frac{12EI_z}{L^3} & 0 & 0 & 0 & \frac{6EI_z}{L^2} & 0 & -\frac{12EI_z}{L^3} & 0 & 0 & 0 & \frac{6EI_z}{L^2} \\
& & & \frac{12EI_y}{L^3} & 0 & -\frac{6EI_y}{L^2} & 0 & 0 & 0 & -\frac{12EI_y}{L^3} & 0 & -\frac{6EI_y}{L^2} & 0 \\
& & & & \frac{GJ}{L} & 0 & 0 & 0 & 0 & 0 & -\frac{GJ}{L} & 0 & 0 \\
& & & & & \frac{4EI_y}{L} & 0 & 0 & 0 & \frac{6EI_y}{L^2} & 0 & \frac{2EI_y}{L} & 0 \\
& & & & & & \frac{4EI_z}{L} & 0 & -\frac{6EI_z}{L^2} & 0 & 0 & 0 & \frac{2EI_z}{L} \\
& & & & & & & \frac{EA}{L} & 0 & 0 & 0 & 0 & 0 \\
& & & & & & & & \frac{12EI_z}{L^3} & 0 & 0 & 0 & -\frac{6EI_z}{L^2} \\
& & & & & & & & & \frac{12EI_y}{L^3} & 0 & \frac{6EI_y}{L^2} & 0 \\
& & & & & & & & & & \frac{GJ}{L} & 0 & 0 \\
& & & & & & & & & & & \frac{4EI_y}{L} & 0 \\
& \emph{sim.} & & & & & & & & & & & \frac{4EI_z}{L}
\end{bNiceArray}
\label{eq:stiffness_matrix}
\end{equation}
但第一行没有出现。有什么想法吗?
编辑
我想要得到这个:
我手写了第一行,但是与列号的样式不匹配。
\begin{equation}
\mathbf{S}_{Mi} =
\begin{bNiceArray}{cccccccccccc}[small,first-col,first-row,code-for-first-col=\mathbf{\arabic{iRow}},code-for-first-row=\mathbf{}]
& 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
& \frac{EA}{L} & 0 & 0 & 0 & 0 & 0 & -\frac{EA}{L} & 0 & 0 & 0 & 0 & 0 \\
& & \frac{12EI_z}{L^3} & 0 & 0 & 0 & \frac{6EI_z}{L^2} & 0 & -\frac{12EI_z}{L^3} & 0 & 0 & 0 & \frac{6EI_z}{L^2} \\
& & & \frac{12EI_y}{L^3} & 0 & -\frac{6EI_y}{L^2} & 0 & 0 & 0 & -\frac{12EI_y}{L^3} & 0 & -\frac{6EI_y}{L^2} & 0 \\
& & & & \frac{GJ}{L} & 0 & 0 & 0 & 0 & 0 & -\frac{GJ}{L} & 0 & 0 \\
& & & & & \frac{4EI_y}{L} & 0 & 0 & 0 & \frac{6EI_y}{L^2} & 0 & \frac{2EI_y}{L} & 0 \\
& & & & & & \frac{4EI_z}{L} & 0 & -\frac{6EI_z}{L^2} & 0 & 0 & 0 & \frac{2EI_z}{L} \\
& & & & & & & \frac{EA}{L} & 0 & 0 & 0 & 0 & 0 \\
& & & & & & & & \frac{12EI_z}{L^3} & 0 & 0 & 0 & -\frac{6EI_z}{L^2} \\
& & & & & & & & & \frac{12EI_y}{L^3} & 0 & \frac{6EI_y}{L^2} & 0 \\
& & & & & & & & & & \frac{GJ}{L} & 0 & 0 \\
& & & & & & & & & & & \frac{4EI_y}{L} & 0 \\
& \emph{sim.} & & & & & & & & & & & \frac{4EI_z}{L}
\end{bNiceArray}
\label{eq:stiffness_matrix}
\end{equation}
解决了
我再次运行该文档,它运行良好。
答案1
注意:此答案适用于 nicematrix 4.4 或更早版本。从 5.0 版(2021 年 7 月 15 日)开始,列规范以小写形式提供。
列规范需要用大写字母提供。摘自nicematrix
手册:
但是,由于技术原因,在环境的序言中
{NiceArray}
,用户必须使用字母L
、C
和,R
而不是l
、c
和r
在这种情况下,这意味着\begin{bNiceArray}{CCCCCCCCCCCC}
。
梅威瑟:
\documentclass{article}
\usepackage{nicematrix}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\mathbf{S}_{Mi} =
\begin{bNiceArray}{CCCCCCCCCCCC}[first-row,first-col,code-for-first-col=\mathbf{\arabic{iRow}},code-for-first-row=\arabic{jCol}]
& & & & & & & & & & & & \\
& \frac{EA}{L} & 0 & 0 & 0 & 0 & 0 & -\frac{EA}{L} & 0 & 0 & 0 & 0 & 0 \\
& & \frac{12EI_z}{L^3} & 0 & 0 & 0 & \frac{6EI_z}{L^2} & 0 & -\frac{12EI_z}{L^3} & 0 & 0 & 0 & \frac{6EI_z}{L^2} \\
& & & \frac{12EI_y}{L^3} & 0 & -\frac{6EI_y}{L^2} & 0 & 0 & 0 & -\frac{12EI_y}{L^3} & 0 & -\frac{6EI_y}{L^2} & 0 \\
& & & & \frac{GJ}{L} & 0 & 0 & 0 & 0 & 0 & -\frac{GJ}{L} & 0 & 0 \\
& & & & & \frac{4EI_y}{L} & 0 & 0 & 0 & \frac{6EI_y}{L^2} & 0 & \frac{2EI_y}{L} & 0 \\
& & & & & & \frac{4EI_z}{L} & 0 & -\frac{6EI_z}{L^2} & 0 & 0 & 0 & \frac{2EI_z}{L} \\
& & & & & & & \frac{EA}{L} & 0 & 0 & 0 & 0 & 0 \\
& & & & & & & & \frac{12EI_z}{L^3} & 0 & 0 & 0 & -\frac{6EI_z}{L^2} \\
& & & & & & & & & \frac{12EI_y}{L^3} & 0 & \frac{6EI_y}{L^2} & 0 \\
& & & & & & & & & & \frac{GJ}{L} & 0 & 0 \\
& & & & & & & & & & & \frac{4EI_y}{L} & 0 \\
& \emph{sim.} & & & & & & & & & & & \frac{4EI_z}{L}
\end{bNiceArray}
\label{eq:stiffness_matrix}
\end{equation}
\end{document}
结果: