带有 tikz 的大块矩阵

带有 tikz 的大块矩阵

我知道这与很多问题非常相似。

下面的矩阵实际上更大,所以我意识到我必须使用 tikz。在这个数组中,A、A'、…、L'、T 是方阵,我用零填充了右半部分,尽管原始矩阵没有这些琐碎的条目,所以我无法删除它们(不要试图修复右侧的条目,因为当我引入它们的实际值时间距是可以的)

  • 有没有不那么丑陋的方式来写这个块矩阵?
  • 我确信有更好的方法可以在下面的非零块中显示这个张量积,因为显示的结果是不可读的。我的意思是,这似乎\otimes T只是乘以矩阵 L!

在此处输入图片描述

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{arrows,chains,matrix,positioning,scopes}

\begin{document}


\begin{tikzpicture}[node distance=-1ex]
\matrix (mymatrix) [matrix of math nodes,left delimiter={(},right
delimiter={)}]
{ 0  &  0 & A&  A'  &  0  &  0  &  0  &  0 & 0 & 0 &  0  &  0  &  0  & 0  &  0  &  0  &  0&0 &\!\!\!\!\! \\
0  &  0  &  B' & B\,\, &  0  &  0  &  0  &  0 & 0 & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
C &  C'  &  0  &  0  &  0  &  0  &  0  &  0 & 0 & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
D' & D &  0  &  0  &  0  &  0  &  0  &  0 & 0 & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
0  &  0  &  0  &  0  &  0  &  0  &  K  &  K' &  & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
0  &  0  &  0  &  0  &  0  &  0  &  L'  & L  & \!\!\!\otimes T & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
0  &  0  &  0  &  0  &  M  &  M'  &  0   &0  &   &  0  &  0  &  0  & 0  &  0  &  0  &  0  & 0&0&\!\!\!\!\!\\
0  &  0  &  0  &  0  &  N'  &  N  &  0  & 0  &   &  0  &  0  &  0  & 0  &  0  &  0  &  0  & 0&0&\!\!\!\!\!\\
};
\draw[blue,dashed] (mymatrix-4-1.south west) -- (mymatrix-4-4.south east);
\draw[blue,dashed] (mymatrix-1-4.north east) -- (mymatrix-4-4.south east);
\draw[red,dashed] (mymatrix-4-4.south east) -- (mymatrix-4-10.south west);
\draw[red,dashed] (mymatrix-5-4.north east) -- (mymatrix-8-4.south east); 
\draw[red,dashed] (mymatrix-4-10.south west) -- (mymatrix-8-10.south west);
\draw[red,dashed] (mymatrix-8-4.south east) -- (mymatrix-8-10.south west);
\end{tikzpicture}
\end{document}

答案1

有些矩阵不是为了排版的。

您特别提到不要摆弄正确的部分,但我看不到任何特殊处理,因为空白在数学模式中被吞噬,并且您已通过启用它matrix of math nodes

无论如何,这是一个想法。

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,tikz}
\usetikzlibrary{arrows,chains,matrix,positioning,scopes}

\begin{document}
We regret to state that we can not publish the following matrix in any journal in its current state. We 
encourage the authors leave these all behind.

\begin{equation}
\begin{pmatrix}
\begin{tikzpicture}[every node/.style={minimum width=1.5em}]
\matrix (m1) [matrix of math nodes]
{ 
0  &  0  &  A  &  A' \\
0  &  0  &  B' &  B  \\
C  &  C' &  0  &  0  \\
D' &  D  &  0  &  0  \\
};
\matrix (m2) at (m1-4-4.south east) [anchor=m2-1-1.north west,
matrix of math nodes]
{
0  &  0  &  K  &  K' \\
0  &  0  &  L' &  L  \\
M  &  M' &  0  &  0  \\
N' &  N  &  0  &  0  \\
};
\node[scale=2] at (m1 |- m2) {$0$};
\node[scale=2,anchor=west] (kron) at ([xshift=-5mm]m2.east) {$\otimes T$};
\node[scale=2] at (m1 -| m2-1-4) {$0$};
\matrix (m3) at ([xshift=5pt]kron.east |- m1-1-4.north east) 
[matrix of math nodes,anchor=m3-1-1.north west]
{
A' & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
0 & B' & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
0 & 0 & C' & 0 & 0 & 0 & 0 & 0 & 0\\
0 & 0 & 0 & D' & 0 & 0 & 0 & 0 & 0\\
0 & 0 & 0 & 0 & E' & 0 & 0 & 0 & 0\\
0 & 0 & 0 & 0 & 0 & ASD' & 0 & 0 & 0\\
0 & 0 & 0 & 0 & 0 & 0 & H & 0 & 0\\
0 & 0 & 0 & 0 & 0 & 0 & 0 & G & I'0\\
};
\draw (m1-1-4.north east) -- (m1-1-4.north east |- m2-4-1.south west);
\draw (m1-1-4.north east -| m3.west) -- (m3.west |- m3-8-1.south east);
\draw (m1-4-1.south west) -- (m3-4-9.south east);
\end{tikzpicture}
\end{pmatrix}
\end{equation}
\end{document}

在此处输入图片描述

答案2

我只是引入了三个小改动,但我认为它们有助于改善外观:蓝色垂直虚线现在真正垂直了;我将张量积与 T 向下移动,以暗示其左侧所有块的积;我过去常常{}\otimes T得到适当的间距\otimes

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{arrows,chains,matrix,positioning,scopes}

\begin{document}


\begin{tikzpicture}[node distance=-1ex]
\matrix (mymatrix) [matrix of math nodes,left delimiter={(},right
delimiter={)}]
{ 0  &  0 & A&  A'  &  0  &  0  &  0  &  0 & 0 & 0 &  0  &  0  &  0  & 0  &  0  &  0  &  0&0 &\!\!\!\!\! \\
0  &  0  &  B' & B\,\, &  0  &  0  &  0  &  0 & 0 & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
C &  C'  &  0  &  0  &  0  &  0  &  0  &  0 & 0 & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
D' & D &  0  &  0' &  0  &  0  &  0  &  0 & 0 & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
0  &  0  &  0  &  0  &  0  &  0  &  K  &  K' & \phantom{00} & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
0  &  0  &  0  &  0  &  0  &  0  &  L'  & L  & & 0  &  0  &  0  &  0  & 0  &  0  &  0  &  0  &0&\!\!\!\!\!\\
0  &  0  &  0  &  0  &  M  &  M'  &  0   &0  &   &  0  &  0  &  0  & 0  &  0  &  0  &  0  & 0&0&\!\!\!\!\!\\
0  &  0  &  0  &  0  &  N'  &  N  &  0  & 0  &   &  0  &  0  &  0  & 0  &  0  &  0  &  0  & 0&0&\!\!\!\!\!\\
};
\draw[blue,dashed] (mymatrix-4-1.south west) -- (mymatrix-4-4.south east);
\draw[blue,dashed] (mymatrix-1-4.north east) -- (mymatrix-5-4.north east -| mymatrix-1-4.south east);
\draw[red,dashed] (mymatrix-4-4.south east) -- (mymatrix-4-10.south west);
\draw[red,dashed] ([xshift=3pt]mymatrix-5-4.north east) -- ([xshift=3pt]mymatrix-8-4.south east); 
\draw[red,dashed] (mymatrix-4-10.south west) -- (mymatrix-8-10.south west);
\draw[red,dashed] ([xshift=3pt]mymatrix-8-4.south east) -- (mymatrix-8-10.south west);
\node[xshift=8pt] at (mymatrix-6-8.south east) {${}\otimes T$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容