# How to produce a 3D-like commutative diagram using xymatrix?

Could somebody give an idea how to create the following 3D commutative diagram?

• Welcome! Please post the code you've got so far. Right now, this is just another do-it-for-me. You may get lucky. Or you may not. If you can make your diagrammatic needs cuter and more visually appealing (e.g. include a small dragon or a large duck), you may stand a better chance. However, you may also get only the dragons and ducks, so this might be a problem if they are not the main focus of your work. I recommend specialising in dragon-duck interactions for maximum do-it-for-me yields. Otherwise, a Minimum Working Example is the way to go. Why do you need xy-pic especially? – cfr Jul 27 '16 at 3:15
• Are you only looking for a xy-pic solution? – Jagath Jul 27 '16 at 3:22
• Any other solution as convenient as the xy-pic one is welcome! – PhysicsMath Jul 27 '16 at 3:54

A tikz based solution:

\documentclass{article}
\usepackage{amsfonts}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=2em,column sep=4em]{
& S(n) & S(n) & \cdots\\
TM   &      &      &       \\
&      \mathfrak{X}(n, n+q) & \mathfrak{X}(n, n+q+1) & \cdots\\
M    &      &      &       \\};
\path[-stealth]
(m-2-1) edge (m-1-2);
\path[-stealth]
(m-1-2) edge (m-1-3);
\path[-stealth]
(m-1-3) edge (m-1-4);
\path[-stealth]
(m-4-1) edge (m-3-2);
\path[-stealth]
(m-3-2) edge (m-3-3);
\path[-stealth]
(m-3-3) edge (m-3-4);
\path[-stealth]
(m-2-1) edge (m-4-1);
\path[-stealth]
(m-1-2) edge (m-3-2);
\path[-stealth]
(m-1-3) edge (m-3-3);
\end{tikzpicture}
\end{document}


Output:

You can simplify this even using one \path. See an example here.

[EDITED by Steven B. Segletes to add \slantbox feature from Shear transform a "box"

For 3-D effect, one can use Bruno's \slantbox. Note in this case, for the isometric effect, the optional argument to \slantbox is the tangent of the rotation angle.

\documentclass{article}
\usepackage{amsfonts}
\usepackage{tikz}
\usetikzlibrary{matrix}
\newsavebox\foobox
\newcommand{\slantbox}[2][.2]{\mbox{%
\sbox{\foobox}{#2}%
\hskip\wd\foobox
\pdfsave
\pdfsetmatrix{1 0 #1 1}%
\llap{\usebox{\foobox}}%
\pdfrestore
}}
\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,row sep=2em,column sep=4em]{
& S(n) & S(n) & \cdots\\
\rotatebox{25}{\slantbox[.466]{TM}}   &      &      &       \\
&      \mathfrak{X}(n, n+q) & \mathfrak{X}(n, n+q+1) & \cdots\\
\rotatebox{25}{\slantbox[.466]{M}}    &      &      &       \\};
\path[-stealth]
(m-2-1) edge (m-1-2);
\path[-stealth]
(m-1-2) edge (m-1-3);
\path[-stealth]
(m-1-3) edge (m-1-4);
\path[-stealth]
(m-4-1) edge (m-3-2);
\path[-stealth]
(m-3-2) edge (m-3-3);
\path[-stealth]
(m-3-3) edge (m-3-4);
\path[-stealth]
(m-2-1) edge (m-4-1);
\path[-stealth]
(m-1-2) edge (m-3-2);
\path[-stealth]
(m-1-3) edge (m-3-3);
\end{tikzpicture}
\end{document}


• I hope you don't mind that I added a 3-D supplement to your answer. If you don't like it, you or I can roll it back to your prior posting. – Steven B. Segletes Jul 27 '16 at 10:30
• @StevenB.Segletes: Its a pleasure :-) – Jagath Jul 27 '16 at 11:32
• OMG, there is even 3D effect! That is more than what I am looking for! Many thanks for your answer and I am so impressed by your TeX skills! – PhysicsMath Jul 28 '16 at 2:19

The trick is to use four rows, reducing the spacing between rows.

Take your pick among Xy-pic and tikz-cd:

\documentclass{article}

\usepackage[all,cmtip]{xy}

\usepackage{tikz-cd}

\begin{document}

This is the diagram using Xy-pic
$\xymatrix@R-.8pc{ & S(n) \ar[rr] \ar[dd] && S(n) \ar[rr] \ar[dd] && \cdots \\ T(M) \ar[ur] \ar[dd] \\ & \mathcal{X}(n,n+q) \ar[rr] && \mathcal{X}(n,n+q+1) \ar[rr] && \cdots \\ M \ar[ur] }$

This is the diagram using tikz-cd
$\begin{tikzcd}[row sep=4ex] & S(n) \arrow[rr] \arrow[dd] && S(n) \arrow[rr] \arrow[dd] && \cdots \\ T(M) \arrow[ur] \arrow[dd] \\ & \mathcal{X}(n,n+q) \arrow[rr] && \mathcal{X}(n,n+q+1) \arrow[rr] && \cdots \\ M \arrow[ur] \end{tikzcd}$

\end{document}


• Looks great even though it is not really 3D diagram. But the trick greatly reduces the amount of coding! Many thanks! And I also appreciate very much the comparison! – PhysicsMath Jul 28 '16 at 2:21