如何强制两个旋转矩阵具有相同的大小,而不管内容如何?

如何强制两个旋转矩阵具有相同的大小,而不管内容如何?

我有两个彼此相邻的旋转 45 度的矩阵。不幸的是,它们的大小不同,可能是因为一个矩阵有两位数,另一个矩阵有一位数。

我怎样才能强制它们具有相同的尺寸?

在此处输入图片描述

这是我的 MWE(感谢@marmot 提供原始代码):

\documentclass{article}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usepackage{german}

\usetikzlibrary{matrix,shapes.geometric,positioning}

\begin{document}
\begin{figure}
\begin{tikzpicture}
 \matrix[matrix of nodes,transform canvas={rotate=45},
 nodes={regular polygon,regular polygon sides=4,draw,rotate=-45,shape border             rotate=45},
 row sep=-\pgflinewidth,column sep=-\pgflinewidth]
 (mat)
 {03 & 13 & 23 & 33 \\ 
 02 & 12 & 22 & 32 \\ 
 01 & 11 & 21 & 31 \\ 
 00 & 10 & 20 & 30 \\ 
 };
 \path ([xshift=-3mm,yshift=3mm]mat.south west |- mat.north west) rectangle 
 ([xshift=3mm,yshift=-3mm]mat.south east -| mat.north east);
 \node at (mat.south west) {$\Phi_1$};
 \node at (mat.south east) {$\Phi_2$};
\end{tikzpicture}
\qquad
\begin{tikzpicture}
 \matrix[matrix of nodes,transform canvas={rotate=45},
 nodes={regular polygon,regular polygon sides=4,draw,rotate=-45,shape border     rotate=45},
 row sep=-\pgflinewidth,column sep=-\pgflinewidth]
 (mat)
 {1 & 3 & 5 & 6 \\ 
 1 & 3 & 4 & 5 \\ 
 1 & 2 & 3 & 3 \\ 
 0 & 1 & 1 & 1 \\ 
 };
 \path ([xshift=-3mm,yshift=3mm]mat.south west |- mat.north west) rectangle 
 ([xshift=3mm,yshift=-3mm]mat.south east -| mat.north east);
 \node at (mat.south west) {$\Phi_1$};
 \node at (mat.south east) {$\Phi_2$};
\end{tikzpicture}
\caption{Vereinigung zweier epistemischer Zustände $\Phi_1$ und $\Phi_2$     mittels Schlichtungsoperation $\Delta_{ls}$.}
\end{figure}
\end{document}

答案1

只需要minimum size在两个矩阵中添加两个节点样式的键:

\documentclass{standalone}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usepackage{german}

\usetikzlibrary{matrix,shapes.geometric,positioning}

\begin{document}
\begin{tikzpicture}
 \matrix[matrix of nodes,transform canvas={rotate=45},
 nodes={minimum size=1.3cm,regular polygon,regular polygon sides=4,draw,rotate=-45,shape border             rotate=45},
 row sep=-\pgflinewidth,column sep=-\pgflinewidth]
 (mat)
 {03 & 13 & 23 & 33 \\ 
 02 & 12 & 22 & 32 \\ 
 01 & 11 & 21 & 31 \\ 
 00 & 10 & 20 & 30 \\ 
 };
 \path ([xshift=-3mm,yshift=3mm]mat.south west |- mat.north west) rectangle 
 ([xshift=3mm,yshift=-3mm]mat.south east -| mat.north east);
 \node at (mat.south west) {$\Phi_1$};
 \node at (mat.south east) {$\Phi_2$};
\end{tikzpicture}
\qquad
\begin{tikzpicture}
 \matrix[matrix of nodes,transform canvas={rotate=45},
 nodes={minimum size=1.3cm,regular polygon,regular polygon sides=4,draw,rotate=-45,shape border     rotate=45},
 row sep=-\pgflinewidth,column sep=-\pgflinewidth]
 (mat)
 {1 & 3 & 5 & 6 \\ 
 1 & 3 & 4 & 5 \\ 
 1 & 2 & 3 & 3 \\ 
 0 & 1 & 1 & 1 \\ 
 };
 \path ([xshift=-3mm,yshift=3mm]mat.south west |- mat.north west) rectangle 
 ([xshift=3mm,yshift=-3mm]mat.south east -| mat.north east);
 \node at (mat.south west) {$\Phi_1$};
 \node at (mat.south east) {$\Phi_2$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

另一个(更好的)解决方案归功于@土拨鼠:我们将text width={width(33)}和添加align=center到第二个矩阵。现在两个矩阵的大小相同:

\documentclass[margin=5mm]{standalone}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usepackage{german}

\usetikzlibrary{matrix,shapes.geometric,positioning}

\begin{document}
\begin{tikzpicture}
 \matrix[matrix of nodes,transform canvas={rotate=45},
 nodes={regular polygon,regular polygon sides=4,draw,rotate=-45,shape border             rotate=45},
 row sep=-\pgflinewidth,column sep=-\pgflinewidth]
 (mat)
 {03 & 13 & 23 & 33 \\ 
 02 & 12 & 22 & 32 \\ 
 01 & 11 & 21 & 31 \\ 
 00 & 10 & 20 & 30 \\ 
 };
 \path ([xshift=-3mm,yshift=3mm]mat.south west |- mat.north west) rectangle 
 ([xshift=3mm,yshift=-3mm]mat.south east -| mat.north east);
 \node at (mat.south west) {$\Phi_1$};
 \node at (mat.south east) {$\Phi_2$};
\end{tikzpicture}
\qquad
\begin{tikzpicture}
 \matrix[matrix of nodes,transform canvas={rotate=45},
 nodes={text width={width(33)},regular polygon,regular polygon sides=4,draw,rotate=-45,shape border     rotate=45,align=center},
 row sep=-\pgflinewidth,column sep=-\pgflinewidth]
 (mat)
 {1 & 3 & 5 & 6 \\ 
 1 & 3 & 4 & 5 \\ 
 1 & 2 & 3 & 3 \\ 
 0 & 1 & 1 & 1 \\ 
 };
 \path ([xshift=-3mm,yshift=3mm]mat.south west |- mat.north west) rectangle 
 ([xshift=3mm,yshift=-3mm]mat.south east -| mat.north east);
 \node at (mat.south west) {$\Phi_1$};
 \node at (mat.south east) {$\Phi_2$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容