bNiceArray 不显示第一行

bNiceArray 不显示第一行

我有以下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},用户必须使用字母LC和,R而不是lcr

在这种情况下,这意味着\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}

结果:

在此处输入图片描述

相关内容