Ich habe versucht herauszufinden, was mit meinem Code nicht stimmt. Ich habe derzeit eine Matrix mit einigen Farben und am Rand hätte ich gerne Pfeile. Im Moment habe ich das hier
\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}
Die erste Abbildung läuft derzeit in den Rand hinein. Außerdem ist die zweite Abbildung fast eine exakte Kopie der ersten, aber wenn ich vertikale Pfeile hinzufügen möchte, erhalte ich die Fehlermeldung „Fehlt = eingefügt für \ifnum.“ und „Fehlende Zahl, wird als Null behandelt.“ Außerdem wird die letzte Spalte mit dem Rand verschmolzen. Kann man etwas tun, um dies zu beheben?
Antwort1
Es gibt also tatsächlich ein Problem mit Overleaf, bei dem das nicematrix
Paket nicht auf die neueste Version aktualisiert wird. Das Hochladen der Datei nicematrix.sty
in mein Overleaf-Projekt hat das Problem behoben. Die Datei befindet sich auf dem SVN-Server von TeXLive:www.tug.org/svn/texlive/trunk/Master/texmf-dist/tex/latex/nicematrix/nicematrix.sty