How to draw a commutative cube diagram with colored faces with a small upper-right corner x-y-z axis
A "pure" tikz-cd
attempt:
\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{patterns}
\definecolor{grey1}{RGB}{71,71,71}
\definecolor{grey2}{RGB}{100,100,100}
\begin{document}
\begin{tikzcd}[arrows=dash,execute at end picture={
\foreach \Valor/\Nombre in
{
tikz@f@1-1-4/a,tikz@f@1-2-5/b,tikz@f@1-1-6/c,tikz@f@1-2-7/d,
tikz@f@1-3-4/e,tikz@f@1-4-5/f,tikz@f@1-3-6/g,tikz@f@1-4-7/h%
}
{
\coordinate (\Nombre) at (\Valor);
}
\fill[pattern=north east lines,pattern color=grey1,opacity=0.3]
(b) -- (a) -- (c) -- (d) -- cycle;
\fill[grey2,opacity=0.3]
(f) -- (e) -- (g) -- (h) -- cycle;
}
]
{} \arrow[r,-latex,start anchor=center] \arrow[dr,-latex,start anchor=center] \arrow[d,-latex,start anchor=center] & x &&
A \arrow[rr,"f"] \arrow[dr,swap,"a"] \arrow[dd,swap,"h"] &&
B \arrow[dd,swap,"h'" near start] \arrow[dr,"b"] \\
y & z &&
& A' \arrow[rr,crossing over,"f'" near start] &&
B' \arrow[dd,"k'"] \\
&&& C \arrow[rr,"g" near end] \arrow[dr,swap,"c"] && D \arrow[dr,swap,"d"] \\
&&& & C' \arrow[rr,"g'"] \arrow[uu,crossing over,"k" near end]&& D'
\end{tikzcd}
\end{document}
Color the top face with a stripped grey.
To do this I've loaded the
patterns
library and used\fill[pattern=north east lines,pattern color=grey1,opacity=0.3]
Draw the small right-corner x-y-z axis.
To do this I've used an empty node
{}
and addedstart anchor=center
to the arrows as in\arrow[r,-latex,start anchor=center]
If you want to hide the unseen part of the arrow between B
and D
you can shift down the arrow with something like
\arrow[dd,swap,start anchor={[yshift=-25pt]},"h'"]
to obtain
EDIT
If you want the arrows in the cube, simply delete delete the arrows=dash
option in the tikzcd
environment (or replace it with arrows=-latex
for example):
\documentclass{article}
\usepackage{tikz-cd}
\usetikzlibrary{patterns}
\definecolor{grey1}{RGB}{71,71,71}
\definecolor{grey2}{RGB}{100,100,100}
\begin{document}
\begin{tikzcd}[execute at end picture={
\foreach \Valor/\Nombre in
{
tikz@f@1-1-4/a,tikz@f@1-2-5/b,tikz@f@1-1-6/c,tikz@f@1-2-7/d,
tikz@f@1-3-4/e,tikz@f@1-4-5/f,tikz@f@1-3-6/g,tikz@f@1-4-7/h%
}
{
\coordinate (\Nombre) at (\Valor);
}
\fill[pattern=north east lines,pattern color=grey1,opacity=0.3]
(b) -- (a) -- (c) -- (d) -- cycle;
\fill[grey2,opacity=0.3]
(f) -- (e) -- (g) -- (h) -- cycle;
}
]
{} \arrow[r,-latex,start anchor=center] \arrow[dr,-latex,start anchor=center] \arrow[d,-latex,start anchor=center] & x &&
A \arrow[rr,"f"] \arrow[dr,swap,"a"] \arrow[dd,swap,"h"] &&
B \arrow[dd,swap,"h'" near start] \arrow[dr,"b"] \\
y & z &&
& A' \arrow[rr,crossing over,"f'" near start] &&
B' \arrow[dd,"k'"] \\
&&& C \arrow[rr,"g" near end] \arrow[dr,swap,"c"] && D \arrow[dr,swap,"d"] \\
&&& & C' \arrow[rr,"g'"] \arrow[uu,<-,crossing over,"k" near end]&& D'
\end{tikzcd}
\end{document}