我能够使用 tikz 制作 2 x 2 x 2 的超矩阵,使用以下乳胶代码:
\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{calc}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[every node/.style={anchor=north east,fill=white,minimum
width=.7cm,minimum height=5mm}]
\matrix (mA) [draw,matrix of math nodes]
{
\frac{1}{2} & -\frac{i}{2} \\
\frac{i}{2} & \frac{1}{2} \\
};
\matrix (mB) [draw,matrix of math nodes] at ($(mA.south west)+(3.3,3.3)$)
{
-\frac{i}{2} & -\frac{1}{2} \\
\frac{1}{2} & -\frac{i}{2}\\
};
\draw[dashed](mA.north east)--(mB.north east);
\draw[dashed](mA.north west)--(mB.north west);
\draw[dashed](mA.south east)--(mB.south east);
\end{tikzpicture}
\end{document}
输出为
我想为超矩阵的切片赋予不同的颜色,如下图所示。
有什么想法可以做到这一点吗?谢谢!
答案1
也许是这样的?
我为您的示例添加了更多空间以提高可见性,并使用语法更改了节点的颜色
|[red]| \frac{1}{2} & ...
我在库的帮助下画了线、圆和弧calc
来显示“切片”。这是代码:
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{calc,matrix}
\definecolor{my green}{HTML}{009900}
\begin{document}
\begin{tikzpicture}[every node/.style={minimum width=1.2cm,minimum height=1.2cm}]
\matrix (mA) [draw,matrix of math nodes,inner sep=0]
{
|[red]| \frac{1}{2} & |[blue]| -\frac{i}{2}\\
|[my green]|\frac{i}{2} & |[my green]|\phantom{-}\frac{1}{2}\\
};
\matrix (mB) [draw,matrix of math nodes,inner sep=0] at ($(mA.south west)+(3.5cm,3cm)$)
{
|[red]| -\frac{i}{2} & |[blue]| -\frac{1}{2}\\
|[my green]|\phantom{-}\frac{1}{2} & |[my green]|-\frac{i}{2}\\
};
\draw[dashed](mA.north east) -- (mB.north east);
\draw[dashed](mA.north west) -- (mB.north west);
\draw[dashed](mA.south east) -- (mB.south east);
% codimension slice
\foreach\i in {A,B}
\draw[my green] ($(m\i-2-1)+(0, 0.4)$) arc (90:270:0.4) --
($(m\i-2-2)+(0,-0.4)$) arc (-90:90:0.4) -- cycle;
\draw[my green] ($(mA-2-1)+(135:0.4)$) -- ($(mB-2-1)+(135:0.4)$);
\draw[my green] ($(mA-2-2)+(-45:0.4)$) -- ($(mB-2-2)+(-45:0.4)$);
% 1-1 slice
\foreach\i in {A,B}
\draw[red] (m\i-1-1) circle (0.4);
\foreach\i in {-45,135}
\draw[red] ($(mA-1-1)+(\i:0.4)$) -- ($(mB-1-1)+(\i:0.4)$);
% 1-2 slice
\foreach\i in {A,B}
\draw[blue] (m\i-1-2) circle (0.4);
\foreach\i in {-45,135}
\draw[blue] ($(mA-1-2)+(\i:0.4)$) -- ($(mB-1-2)+(\i:0.4)$);
\end{tikzpicture}
\end{document}
答案2
如果我正确理解了这个问题。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,calc}
\begin{document}
\begin{tikzpicture}[every node/.style={anchor=north east,minimum width=.7cm,minimum height=5mm}]
\matrix (mA) [draw,matrix of math nodes,fill=red!15]
{
\frac{1}{2} & -\frac{i}{2} \\
\frac{i}{2} & \frac{1}{2} \\
};
\matrix (mB) [draw,matrix of math nodes,fill=blue!15] at ($(mA.south west)+(3.3,3.3)$)
{
-\frac{i}{2} & -\frac{1}{2} \\
\frac{1}{2} & -\frac{i}{2}\\
};
\draw[dashed](mA.north east)--(mB.north east);
\draw[dashed](mA.north west)--(mB.north west);
\draw[dashed](mA.south east)--(mB.south east);
\end{tikzpicture}
\end{document}