# how to latex the octahedral axiom diagram?

How do I latex the octahedral axiom diagram, shown below and taken from the wikipedia page on triangulated categories and due to Ryan Reich? The arrows should be easy, but it is the positioning of the objects that I'm concerned about. Every triple of objects (e.g. X, Y, Z') that appears to be in a straight line needs to be in (nearly) a straight line

Here is another solution, tikz-oriented.

I used an opening angle of 35 degrees as I felt it was close to the original figure angle, you can control this angle by altering the openingangle definition. My figure does not feature this "not-fully-linear" appearance. And the lengths of the arrows getting out of the nodes are not the same.

However I believe the figure can easily be adapted, and that it correctly illustrates the theorem about categories it was made for.

\documentclass{article}

\usepackage{amsmath,amssymb}
\usepackage{tikz}
\usetikzlibrary{calc, intersections}

\begin{document}

\begin{tikzpicture}[scale=3]
\def\openingangle{35}
\node (Z') at (0, 0) {Z'};
\node (Y) at ($(Z') +(270-\openingangle:1)$) {Y};
\node (Y') at ($(Z') +(270+\openingangle:1)$) {Y'};
\node (X) at ($(Y) +(270-\openingangle:1)$) {X};
\node (X') at ($(Y') +(270+\openingangle:1)$) {X'};
\draw[white, name path=L1] (X) -- (Y');
\draw[white, name path=L2] (X') -- (Y);
\path[name intersections={of=L1 and L2, by=pZ}];
\node (Z) at (pZ) {Z};

\draw[-latex] (X) -- node[above left] {$u$} (Y);
\draw[-latex] (X) -- node[below right] {$v \circ u$} (Z);
\draw[-latex] (Y) -- node[above left] {$j$} (Z');
\draw[-latex] (Y) -- node[above right] {$v$} (Z);
\draw[-latex] (Z) -- (Y');
\draw[-latex] (Z) -- (X');

\draw[-latex] (X') -- ($(X')!-1!(Y')$);
\draw[-latex] (X') -- node[above right] {$i$} ($(X')!-1!(Z)$);
\draw[-latex] (Y') -- node[above right] {$g$} (X');
\draw[-latex] (Y') -- ($(Y')!-1!(Z)$);
\draw[-latex] (Z') -- node[above right] {$f$} (Y');
\draw[-latex] (Z') -- ($(Z')!-1!(Y)$);
\end{tikzpicture}

\end{document}


On Wikipedia, the source is usually available for images created using LaTeX, just click the image on Wikipedia and click "More details" in the below-right corner.

For this particular image, source is at https://commons.wikimedia.org/wiki/File:Axiom_TR4_%28BBD%29.svg

Here is a short code with pstricks and the psmatrix environment:

\documentclass[border=3pt]{standalone}
\usepackage{pst-node, auto-pst-pdf}

\begin{document}

\psset{arrows=->, arrowinset=0.15, linewidth=0.6pt, nodesep=3pt, labelsep=2pt, colsep=0.8cm, rowsep=1.2cm}
\everypsbox{\scriptstyle}
$\begin{psmatrix} & & & \pnode{E}\\ & & Z' & \pnode(0,0.4){M}\\ & Y & \psnode(0,-0.47){Z}{\displaystyle Z} & Y'& \pnode(0,0.65){P} \\ X & & & &X'\\ & & & & & \pnode(0.3,0){B} & \pnode(0.4,0.7){N} %%% \ncline{2,3}{1,4}\ncline{2,3}{3,4}\naput{f }% \ncline{3,2}{2,3}\naput{j}\ncline[offsetA=-0.03]{3,2}{Z}\naput{v}% \ncline{Z}{3,4}\ncline[offsetA=0.05]{Z}{4,5}% \ncline{3,4}{4,5}\naput{g } \ncline{3,4}{P}% \ncline{4,1}{3,2}\naput{u} \ncline{4,1}{Z}\nbput[nrot=:U]{v ∘ u}% \ncline{4,5}{B}\ncline{4,5}{N}\naput{i} \end{psmatrix}$%

\end{document}