我正在尝试通过使用和计数器nicematrix
生成矩阵来变得花哨/懒惰(Overleaf TeX Live 2020 上的 5.19 版本) 。iRow
jCol
先前的结果是使用以下代码完成的:
\begin{equation*}
\begin{bNiceMatrix}%
[
r,
first-row,
last-col,
code-for-first-row = \Block{}{\scriptstyle \color{blue} \arabic{jCol}},
code-for-last-col = \scriptstyle \color{red} \arabic{iRow}
]
& & & & \\
(-1)^{1+1+1}(1+1) & (-1)^{1+2+1}(1+2) & (-1)^{1+3+1}(1+3) & (-1)^{1+3+1}(1+4) & \\
(-1)^{2+1+1}(2+1) & (-1)^{2+2+1}(2+2) & (-1)^{2+3+1}(2+3) & (-1)^{2+3+1}(2+4) & \\
(-1)^{3+1+1}(3+1) & (-1)^{3+2+1}(3+2) & (-1)^{3+3+1}(3+3) & (-1)^{3+3+1}(3+4) & \\
(-1)^{4+1+1}(4+1) & (-1)^{4+2+1}(4+2) & (-1)^{4+3+1}(4+3) & (-1)^{4+3+1}(4+4) &
\end{bNiceMatrix}
\end{equation*}
但是,我不会单独定义每个术语,而是尝试使用iRow
和jCol
:
\begin{equation*}
\begin{bNiceMatrix}%
[
r,
first-row,
last-col,
code-for-first-row = \Block{}{\scriptstyle \color{blue} \arabic{jCol}},
code-for-last-col = \Block{}{\scriptstyle \color{red} \arabic{iRow}}
]
& & & & \\
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) &
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) &
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) &
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) & \\
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) &
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) &
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) &
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) & \\
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) &
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) &
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) &
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) & \\
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) &
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) &
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) &
(-1)^{\arabic{iRow} + \arabic{jCol} + 1}(\arabic{iRow}+\arabic{jCol}) & \\
\end{bNiceMatrix}
\end{equation*}
使用计数器时似乎存在大小问题,但该问题似乎仅在将它们用作指数时出现,因为删除它也会将分隔符带回到正确的位置:
\begin{equation*}
\begin{bNiceMatrix}%
[
r,
first-row,
last-col,
code-for-first-row = \Block{}{\scriptstyle \color{blue} \arabic{jCol}},
code-for-last-col = \Block{}{\scriptstyle \color{red} \arabic{iRow}}
]
& & & & \\
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) &
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) &
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) &
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) & \\
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) &
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) &
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) &
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) & \\
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) &
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) &
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) &
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) & \\
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) &
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) &
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) &
(\arabic{iRow} + \arabic{jCol} + \arabic{iRow} + \arabic{jCol}) & \\
\end{bNiceMatrix}
\end{equation*}
最后,nicematrix
提供AutoNiceMatrix
命令,使用它们时尺寸是正确的:
\begin{equation*}
\bAutoNiceMatrix{4-4}{(-1)^{\arabic{iRow} + \arabic{jCol} + 1} (\arabic{iRow}+\arabic{jCol})}
\end{equation*}
对于这种用例,这AutoNiceMatrix
将是一个选项,但并不总是能够为矩阵定义一个通用术语。
有谁遇到过这个问题并且能帮助我“生成”矩阵而不是手写吗?
提前致谢。
答案1
aux
按照 F. Pantigny 在评论中的建议,删除文件并重新编译确实解决了这个问题。
多谢!