我对创建此代码没有一点想法:
\documentclass{article}
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,top=1.5cm,bottom=1.5cm,left=2cm,right=2cm]{geometry}
\usepackage{tikz-cd}
\usepackage{color}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{stmaryrd}
\usepackage{stix}
\usepackage{xcolor}
\usepackage[customcolors,shade]{hf-tikz}
\usepackage{nicematrix}
\usetikzlibrary{calc,matrix,backgrounds}
\begin{document}
\begin{subequations}
NiceMatrix_1 \label{NiceMatrix_1}\\
NiceMatrix_2 \label{NiceMatrix_2}\\
\vdots \\
NiceMatrix_n \label{NiceMatrix_n}\\
\end{subequations}
While: \[
NiceMatrix_1 = \begin{NiceMatrix}[columns-width=8.5mm,cell-space-limits=2pt,hvlines]
\diagbox{\small A_i} {\small A^j}
& A^1 & A^2 & A^3 \\
A_1 & \Block{3-3}{}
1 & 2 & 3 \\
A_2 & 4 & 5 & 6 \\
A_3 & 7 & 8 & 9
\CodeAfter
\begin{tikzpicture}
\begin{scope} [dashed]
\draw ([xshift=3mm]3-|2) -- ([xshift=-3mm]3-|5) ;
\draw ([xshift=3mm]4-|2) -- ([xshift=-3mm]4-|5) ;
\draw (2-|3) -- (5-|3) ;
\draw (2-|4) -- (5-|4) ;
\end{scope}
\end{tikzpicture}
\end{NiceMatrix}
\]
\[NiceMatrix_2 = ... \]
\[\vdots \]
\[NiceMatrix_n = ... \]
\end{document}
答案1
在本身中使用 的环境nicematrix
(如{NiceMatrix}
)没有问题。{align}
{subequations}
\documentclass{article}
\usepackage[italian]{babel}
\usepackage[a4paper,top=1.5cm,bottom=1.5cm,left=2cm,right=2cm]{geometry}
\usepackage{mathtools}
\usepackage{stix}
\usepackage{xcolor}
\usepackage{nicematrix}
\usepackage{tikz}
\begin{document}
\begin{subequations}\label{eq:all}
\NiceMatrixOptions{columns-width=8.5mm,cell-space-limits=2pt,hvlines}
\begin{align}
\label{NiceMatrix_1}
M_1 & =
\begin{NiceMatrix}
\diagbox{A_i}{A^j}
& A^1 & A^2 & A^3 \\
A_1 & \Block{3-3}{}
1 & 2 & 3 \\
A_2 & 4 & 5 & 6 \\
A_3 & 7 & 8 & 9
\CodeAfter
\begin{tikzpicture}
\begin{scope} [dashed]
\draw ([xshift=3mm]3-|2) -- ([xshift=-3mm]3-|5) ;
\draw ([xshift=3mm]4-|2) -- ([xshift=-3mm]4-|5) ;
\draw (2-|3) -- (5-|3) ;
\draw (2-|4) -- (5-|4) ;
\end{scope}
\end{tikzpicture}
\end{NiceMatrix} \\
\label{NiceMatrix_2}
M_2 & =
\begin{NiceMatrix}
1 & 2 & 3 \\
\end{NiceMatrix} \\
\label{NiceMatrix_3}
M_3 & =
\begin{NiceMatrix}
4 & 5 & 6 \\
\end{NiceMatrix}
\end{align}
\end{subequations}
See \eqref{eq:all}: \eqref{NiceMatrix_1}, \eqref{NiceMatrix_2} and \eqref{NiceMatrix_3}.
\end{document}
与往常一样nicematrix
,您需要进行多次编译。
答案2
此代码产生了所需的结果。
% !TeX TS-program = pdflatex
\documentclass{article}
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,top=1.5cm,bottom=1.5cm,left=2cm,right=2cm]{geometry}
\usepackage{tikz-cd}
\usepackage{color}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{stmaryrd}
\usepackage{stix}
\usepackage{xcolor}
\usepackage[customcolors,shade]{hf-tikz}
\usepackage{nicematrix}
\usetikzlibrary{calc,matrix,backgrounds}
\begin{document}
\newcommand{\NiceMatrixi}{%
\begin{NiceMatrix}[columns-width=8.5mm,cell-space-limits=2pt,hvlines]
\diagbox{A_i} {\A^j}
& A^1 & A^2 & A^3 \\
A_1 & \Block{3-3}{}
1 & 2 & 3 \\
A_2 & 4 & 5 & 6 \\
A_3 & 7 & 8 & 9
\CodeAfter
\begin{tikzpicture}
\begin{scope} [dashed]
\draw ([xshift=3mm]3-|2) -- ([xshift=-3mm]3-|5) ;
\draw ([xshift=3mm]4-|2) -- ([xshift=-3mm]4-|5) ;
\draw (2-|3) -- (5-|3) ;
\draw (2-|4) -- (5-|4) ;
\end{scope}
\end{tikzpicture}
\end{NiceMatrix}
}
\newcommand{\NiceMatrixii}{%
\begin{NiceMatrix}[columns-width=8.5mm,cell-space-limits=2pt,hvlines]
1 & 2 & 3 \\
\end{NiceMatrix}
}
\newcommand{\NiceMatrixiii}{%
\begin{NiceMatrix}[columns-width=8.5mm,cell-space-limits=2pt,hvlines]
4 & 5 & 6 \\
\end{NiceMatrix}
}
\begin{subequations}\label{eq:all}
\begin{align}
\label{NiceMatrix_1}
NiceMatrix_1 &= \NiceMatrixi \\
\label{NiceMatrix_2}
NiceMatrix_2 &= \NiceMatrixii \\
\label{NiceMatrix_3}
NiceMatrix_3 &= \NiceMatrixiii
\end{align}
\end{subequations}
While:
\[NiceMatrix_1=\NiceMatrixi\]
\[NiceMatrix_2=\NiceMatrixii\]
\[\vdots \]
\[NiceMatrix_3=\NiceMatrixiii\]
See \eqref{eq:all}: \eqref{NiceMatrix_1}, \eqref{NiceMatrix_2} and \eqref{NiceMatrix_3}.
\end{document}