在 tikzpicture 中添加矩阵名称

在 tikzpicture 中添加矩阵名称

我有这个矩阵,我想给它命名。我必须H =在矩阵的开头输入,但我不能。我试过,\begin{bmatrix}但我不能用 Ti 圈出Z。

\begin{equation*}
\begin{tikzpicture}
\matrix  [{matrix of math nodes},left delimiter={[},right delimiter= {]}] (m)
{
0 & 1 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 1\\
1 & 0 & 1 & 0 & 0 & 1 & 1 & 0 & 0 & 0\\
1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 1\\
0 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 1 & 0\\
0 & 1 & 0 & 1 & 0 & 1 & 0 & 0 & 1 & 0 \\
};  
\draw[color=red] (m-2-1.north west) -- (m-2-3.north east) -- (m-3-3.south east) -- (m-3-1.south west) -- (m-2-1.north west);
\draw[color=blue] (m-2-6.north west) -- (m-2-7.north east) -- (m-3-7.south east) -- (m-4-8.north east) -- (m-4-9.north east) -- (m-5-9.south east) -- (m-5-6.south west) -- (m-2-6.north west);
\end{tikzpicture}
\end{equation*}

矩阵

答案1

tikzpicture您可以使用 键修改行上的垂直位置baselineH=只需在 之前写入即可\begin{tikzpicture}

\documentclass{article}
\usepackage{tikz,amsmath}
\usetikzlibrary{matrix}
\begin{document}
\begin{equation*}
H=
\begin{tikzpicture}[baseline=(m-3-1.base)]
\matrix  [{matrix of math nodes},left delimiter={[},right delimiter= {]}] (m)
{
0 & 1 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 1\\
1 & 0 & 1 & 0 & 0 & 1 & 1 & 0 & 0 & 0\\
1 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 1\\
0 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 1 & 0\\
0 & 1 & 0 & 1 & 0 & 1 & 0 & 0 & 1 & 0 \\
};  
\draw[color=red] (m-2-1.north west) -- (m-2-3.north east) -- (m-3-3.south east) -- (m-3-1.south west) -- (m-2-1.north west);
\draw[color=blue] (m-2-6.north west) -- (m-2-7.north east) -- (m-3-7.south east) -- (m-4-8.north east) -- (m-4-9.north east) -- (m-5-9.south east) -- (m-5-6.south west) -- (m-2-6.north west);
\end{tikzpicture}
\end{equation*}
\end{document}

在此处输入图片描述

相关内容