NiceMatrix 右边距元素

NiceMatrix 右边距元素

我一直在努力弄清楚我的代码出了什么问题。我目前有一个带有一些颜色的矩阵,在边缘上,我想要箭头。目前我有这个

\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{xcolor}
\usepackage{mathtools}
\usepackage{nicematrix}
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{arrows,matrix,positioning,fit, decorations.pathreplacing}
\setcounter{MaxMatrixCols}{20}
\usepackage[left=1in,top=1in,right=1in,bottom=1in,nohead,paperwidth=8.5in, paperheight=11in]{geometry}

\begin{document}

\begin{figure}
    \centering
\[
\NiceMatrixOptions{xdots={horizontal-labels,line-style = <->}}
\setlength\arraycolsep{6pt}
\begin{pNiceMatrix}%
[   margin,
    last-col,
  ]
\Block[fill=red!15,rounded-corners]{2-12}{} a_{1,1} & a_{1,2} & a_{1,3} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,9} & a_{1,10} & a_{1,11} & a_{1,12} & \\
 a_{2,1} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,10} & a_{1,11} & a_{1,12} & \\
 a_{2,1} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,10} & a_{1,11} & a_{1,12} & \\
\Block[fill=blue!15,rounded-corners]{2-12}{} a_{1,1} & a_{1,2} & a_{1,3} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,9} & a_{1,10} & a_{1,11} & a_{1,12} & \\
 a_{2,1} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,10} & a_{1,11} & a_{1,12} & \\
 a_{2,1} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,10} & a_{1,11} & a_{1,12} & \\
\Block[fill=green!15,rounded-corners]{2-12}{} a_{1,1} & a_{1,2} & a_{1,3} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,9} & a_{1,10} & a_{1,11} & a_{1,12} & \\
 a_{2,1} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,10} & a_{1,11} & a_{1,12} & \\
 a_{2,1} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,10} & a_{1,11} & a_{1,12} & \\
\Block[fill=brown!15,rounded-corners]{2-12}{} a_{1,1} & a_{1,2} & a_{1,3} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,9} & a_{1,10} & a_{1,11} & a_{1,12} & \\
 a_{2,1} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,10} & a_{1,11} & a_{1,12} & \\
 a_{2,1} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,10} & a_{1,11} & a_{1,12} & \\
\end{pNiceMatrix}\]
\end{figure}

\begin{figure}
\[
\NiceMatrixOptions{xdots={horizontal-labels,line-style = <->}}
\setlength\arraycolsep{6pt}
\begin{pNiceMatrix}%
[   margin,
    last-col,
  ]
\Block[fill=red!15,rounded-corners]{1-12}{} a_{11} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{19} & a_{1,3} & a_{1,3} & a_{1,3} & \Vdotsfor{3}^{\text{State 1}}\\
\Block[fill=blue!15,rounded-corners]{1-12}{} a_{21} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & \\ 
\Block[fill=green!15,rounded-corners]{1-12}{} a_{21} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & \\
a_{2,1} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,10} & a_{1,11} & a_{1,12} & \Vdotsfor{3}^{\text{State 2}}\\
a_{2,1} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,10} & a_{1,11} & a_{1,12} & \\
a_{2,1} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,4} & a_{1,10} & a_{1,11} & a_{1,12} & \\
\Block[fill=red!15,rounded-corners]{1-12}{} a_{71} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & \Vdotsfor{3}^{\text{State 3}}\\
\Block[fill=blue!15,rounded-corners]{1-12}{} a_{71} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & \\
\Block[fill=green!15,rounded-corners]{1-12}{} a_{71} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & \\
\Block[fill=red!15,rounded-corners]{1-12}{} a_{71} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & \Vdotsfor{3}^{\text{State 3}}\\
\Block[fill=blue!15,rounded-corners]{1-12}{} a_{71} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & \\
\Block[fill=green!15,rounded-corners]{1-12}{} a_{71} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & a_{1,3} & \\
\end{pNiceMatrix}\]
\end{figure}
\end{document}

第一个图目前溢出到了页边距。此外,第二个图几乎是第一个图的完全复制品,但当我想添加垂直箭头时,我收到错误“缺失 = 插入 \ifnum。”和“缺失数字,视为零。”此外,最后一列与页边距合并。有什么办法可以解决这个问题吗?

答案1

因此,Overleaf 确实存在问题,包nicematrix未更新到最新版本。将文件上传nicematrix.sty到我的 Overleaf 项目解决了该问题。该文件可以在 TeXLive 的 SVN 服务器上找到:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty

相关内容