コンテンツに関係なく、回転した 2 つのマトリックスを同じサイズに強制するにはどうすればよいですか?

コンテンツに関係なく、回転した 2 つのマトリックスを同じサイズに強制するにはどうすればよいですか?

45 度回転した 2 つの行列が隣り合っています。残念ながら、サイズが異なります。おそらく、一方が 2 桁の数字で、もう一方が 1 桁の数字であるためです。

強制的に同じサイズにするにはどうすればいいでしょうか?

ここに画像の説明を入力してください

これが私の 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 size2 つのマトリックスの両方のノード スタイルのキーを追加するだけです。

\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}

ここに画像の説明を入力してください

もう一つの(より良い)解決策は@マーモット: 2番目の行列に と をtext width={width(33)}加えます。これで2つの行列のサイズは同じになります。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}

ここに画像の説明を入力してください

関連情報