%% assoc-L3O.tex - orthogonal projections of the Loday associahedron
%% Author: Markus Rost <https://www.math.uni-bielefeld.de/~rost/>
%% Created: 12 Mar 2026

%% to be compiled with pdflatex

\documentclass{amsart}

%%%%%%%%

%%%%% Shows an orthogonal projection of Loday's realization of the
%%%%% 3-dimensional associahedron A_3.

%%%%% The realization lies in the hyperplane
%%%%%
%%%%%           H = { x + y + z + t = 10 }
%%%%%
%%%%% in R^4.  On H one takes the inherited Euclidean metric and
%%%%% projects orthogonally to the plane { y = 1 } containing the
%%%%% pentagon
%%%%%
%%%%%              2134 - 2161 - 4141
%%%%%                 \          /
%%%%%                 3124 -- 4123
%%%%%
%%%%% This is the projection along (1,-3,1,1).

%%%%% The basic 2-dimensional sub-associahedron A_2 (coordinates NNN4)
%%%%%
%%%%%              3214 - 1414 - 1234
%%%%%                 \          /
%%%%%                 3124 -- 2134
%%%%%
%%%%% and its opposite A_2' (coordinates 4NNN)
%%%%%
%%%%%              4213 -- 4312 - 4321
%%%%%                 \           /
%%%%%                  4123 - 4141
%%%%%
%%%%% are drawn in green.  The arrows indicate the homotopy A_2 ->
%%%%% A_2'.

%%%%% This file is edited from cube-3L.tex, which see for more comments.

%%%%% There are essentially 4 cases of orthogonal projections to faces
%%%%% (up to the symmetry xyzt<->tyzx).  These can be optionally
%%%%% selected.  The colorings are experimental.

%%%%%%%%

%%%% select an orthogonal projection to a face
\def\Variant{1}
% \def\Variant{2}
% \def\Variant{3}
% \def\Variant{4}

\newif\ifLABELS %
%% uncomment to show the Loday coordinates
% \LABELStrue %

\newif\ifNAMES %
%% uncomment to show instead the internal names of the vertices
%%% recommended if you read this file
% \NAMEStrue % no effect with \LABELSfalse
\ifNAMES \LABELStrue \fi %

\newif\ifHEIGHT %
%% uncomment to show the projection height of a vertex
% \HEIGHTtrue % no effect with \LABELSfalse, \NAMEStrue
\ifHEIGHT \LABELStrue \NAMESfalse \fi %

\newif\ifPARENS %
%% uncomment to get paren expressions as labels
% \PARENStrue %
\ifPARENS \LABELSfalse \fi % just in case

\newif\ifCOLORS %
%% comment out to omit colors for faces
\COLORStrue %

\newif\ifCOLORSC %
%% uncomment for even more colorful colors for faces
% \COLORSCtrue % no effect with \COLORSfalse
\ifCOLORSC \COLORStrue \fi %

\newif\ifARROWS %
%% comment out to omit arrows
\ARROWStrue %

\newif\ifBLACKRED %
%% uncomment to get a simple perspective (at least for projection-1)
% \BLACKREDtrue
\ifBLACKRED \COLORSfalse \ARROWSfalse \fi %

\newif\ifDRAWDOUBLES %
%% uncomment to draw edge overlaps with dark colors
% \DRAWDOUBLEStrue %

\newif\ifDRAWBULLETS %
%% uncomment to draw also vertex overlaps
% \DRAWBULLETStrue % no effect with \DRAWDOUBLESfalse

\newif\ifTHICK %
%% uncomment to draw thick edges
% \THICKtrue %
\ifTHICK \DRAWDOUBLEStrue \ARROWSfalse \fi %

\newif\ifINSPECTOR %
%% uncomment to show the gory details of drawing edges
% \INSPECTORtrue %
\ifINSPECTOR \THICKtrue \DRAWDOUBLEStrue \ARROWSfalse \fi %

\ifPARENS \DRAWDOUBLEStrue \fi %
\ifDRAWDOUBLES \ifPARENS \else \DRAWBULLETStrue \fi\fi %
\ifHEIGHT \COLORStrue \COLORSCtrue \fi %

%%% projection-2 with reversed perspective has some disadvantages
\newif\ifREVP %
%% uncomment to reverse perspective (effect for projection-2 only)
% \REVPtrue

%%%%%%%%

\ifPARENS %

%% this is cmb10 scaled 0.5 (there is no cmb5)
%% cmb10 has same sizes and spacing as cmr10
% \DeclareFixedFont{\PARENfont}{OT1}{cmr}{b}{n}{5} %

%% this is cmbx10 scaled 0.5 (not cmbx5)
%%% looks better and there is enough space for it
\DeclareFontShape{OT1}{cmr}{bx10scaled}{n}{<-> cmbx10}{} %
\DeclareFixedFont{\PARENfont}{OT1}{cmr}{bx10scaled}{n}{5} %

\fi % \ifPARENS

\usepackage{tikz}
\usetikzlibrary{calc,decorations.markings,arrows.meta}

\begin{document}
\thispagestyle{empty} %

\centerline{%

  \tikzpicture %

  %%%%%%%% Loday coordinates

  \def\LCOORDINATES{%
    A0/1/2/3/4/(((01)2)3)4, % ((( 01 )2)3)4
    A1/2/1/3/4/((0(12))3)4, % (( 0(12) )3)4
    X0/1/4/1/4/((01)(23))4, % ( (01)(23) )4
    A2/3/2/1/4/(0(1(23)))4, % ( 0(1(23)) )4
    A3/3/1/2/4/(0((12)3))4, % ( 0((12)3) )4
    Y1/1/2/6/1/((01)2)(34), %  ((01)2)(34)
    Y2/1/6/2/1/(01)(2(34)), %  (01)(2(34))
    B0/4/3/2/1/0(1(2(34))), %  0(1(2(34)))
    Z1/2/1/6/1/(0(12))(34), %  (0(12))(34)
    B1/4/1/4/1/0((12)(34)), %  0((12)(34))
    X2/1/6/1/2/(01)((23)4), %  (01)((23)4)
    X3/4/3/1/2/0(1((23)4)), %  0(1((23)4))
    B2/4/2/1/3/0((1(23))4), %  0((1(23))4)
    B3/4/1/2/3/0(((12)3)4)% %  0(((12)3)4)
  }

  \ifcase\Variant %

  \or % projection-1
  %%%% projection to face A1-A3-B3-B1-Z1
  %%% orthogonal projection with
  %%%%         A3-B3 = (-1,0,0,1)  -> (0,2)
  %%%%     (Z1-B3)/2 = (-1,0,2,-1) -> (2*sqrt(3),0)
  %%%% B3-(X2+2X3)/3 = (1,-3,1,1)  -> (0,0)
  %%% the three vectors are orthogonal with squared length 2,6,12
  %%% their images are orthogonal with squared length 4,12,0
  \path foreach \NNN/\x/\y/\z/\t in \LCOORDINATES { %
    coordinate (\NNN) at ($({(-\x+2*\z-\t)/sqrt(3)},\t-\x)$) } ; %

  \or % projection-2
  %%%% projection to A_2 (and its parallel), collapsing line A2-B0
  %%% orthogonal projection with
  %%%%           A1-A3 = (-1,0,1,0)  -> (0,2)
  %%%% (2X0-(A3+A2))/3 = (-1,2,-1,0) -> (2*sqrt(3),0)
  %%%%           B0-A2 = (1,1,1,-3)  -> (0,0)
  %%% the three vectors are orthogonal with squared length 2,6,12
  %%% their images are orthogonal with squared length 4,12,0
  \path foreach \NNN/\x/\y/\z/\t in \LCOORDINATES { %
    coordinate (\NNN) at ($({(-\x+2*\y-\z)/sqrt(3)},\z-\x)$) } ; %

  \or % projection-3
  %%%% projection to rectangle A2-A3-B3-B2, collapsing the other
  %%%% rectangles to lines
  %%% orthogonal projection with
  %%%%         A3-A2 = (0,-1,1,0)  -> (2,0)
  %%%%         B2-A2 = (1,0,0,-1)  -> (0,-2)
  %%%% A1-(2A0+Y1)/3 = (1,-1,-1,1) -> (0,0)
  %%% the three vectors are orthogonal with squared length 2,2,4
  %%% their images are orthogonal with squared length 4,4,0
  \path foreach \NNN/\x/\y/\z/\t in \LCOORDINATES { %
    coordinate (\NNN) at ($(\z-\y,\t-\x)$) } ; %

  \or % projection-4
  %%%% projection to rectangle A0-Y1-Z1-A1 (and its parallel),
  %%%% collapsing lines X3-A1 and A3-B2 and rectangle A2-A3-B3-B2 to a
  %%%% line
  %%% orthogonal projection with
  %%%%      (Y1-A0)/3 = (0,0,1,-1)  -> (2,0)
  %%%%          A1-A0 = (1,-1,0,0)  -> (0,-2)
  %%%%      (X3-A1)/2 = (1,1,-1,-1) -> (0,0)
  %%% the three vectors are orthogonal with squared length 2,2,4
  %%% their images are orthogonal with squared length 4,4,0
  \path foreach \NNN/\x/\y/\z/\t in \LCOORDINATES { %
    coordinate (\NNN) at ($(\z-\t,\y-\x)$) } ; %

  \fi % \ifcase

  %%%%%%%%

  %%%% make the xy-coordinates of the vectors explicit

  %% \newdimen\cx %
  %% \newdimen\cy %
  %% \foreach \XXX/\UNUSED in \LCOORDINATES { %
  %%   \pgfextractx{\cx}{\pgfpointanchor{\XXX}{center}} %
  %%   \pgfextracty{\cy}{\pgfpointanchor{\XXX}{center}} %
  %%   \typeout{\string\coordinate \space (\XXX) at (\the\cx,\the\cy) ; \csname@percentchar\endcsname} %
  %%   %%
  %% }

  %%%%%%%%

  %% placement in shipout is independent of labels
  %% \useasboundingbox (A2) (X0) (Y1) (B1) ; % projection-1
  %% \useasboundingbox (X2) (B2) (Y1) (B1) ; % projection-2
  %% \useasboundingbox (X2) (X0) (Z1) (B1) ; % projection-3/4
  \useasboundingbox (A2) (X0) (Y1) (B1) (X2) (B2) (Z1) ;

  %%%%%%%%

  %%%% the 9 faces of the associahedron

  \def\faceQA{A2,A3,B3,B2} % square
  \def\faceQB{A1,A0,Y1,Z1} % rectangle at PA
  \def\faceQC{X3,B0,Y2,X2} % rectangle T(QB) %% T=transpose

  %% 2-dim sub-associahedron + parallel
  \def\facePA{A2,A3,A1,A0,X0} %
  \def\facePF{B0,B1,Z1,Y1,Y2} %
  %% 2-dim sub-associahedron' + parallel
  \def\facePB{B3,B2,X3,B0,B1} % T(PA)
  \def\facePG{A0,X0,X2,Y2,Y1} % T(PF)
  %% pentagons with no parallel face
  \def\facePC{A3,B3,B1,Z1,A1} %
  \def\facePD{B2,A2,X0,X2,X3} % T(PC)

  %%%% macros for draw/fill

  %% \PATH, \CYCLE cannot be preceeded by --
  % \def\CYCLE#1{foreach\p[count=\i]in#1{\ifnum\i=1 \else--\fi(\p)}--cycle}
  \def\PATH#1{foreach\p[count=\i]in#1{\ifnum\i=1 \else--\fi(\p)}}
  \def\CYCLE#1{\PATH{#1}--cycle}

  %%%% the 21 edges of the associahedron

  %%% for smoother corners the boundary edges are drawn as cycle

  \ifcase\Variant %

  \or % projection-1

  %% \def\EDGESFRONT{% 16 edges
  %%   A0/A1,A1/A3,A3/A2,A2/X0,X0/A0, % PA
  %%   B0/X3,X3/B2,B2/B3,B3/B1,B1/B0, % PB=T(PA)
  %%   A2/B2,A3/B3,A0/Y1,A1/Z1,Y1/Z1,Z1/B1%
  %% }
  \def\EDGESBACK{Y1/Y2,Y2/B0,Y2/X2,X0/X2,X2/X3} % 5 edges
  \def\faceBDRY{X0,A0,Y1,Z1,B1,B0,X3,B2,A2} % 9 edges
  \def\EDGESFRONT{A0/A1,A1/A3,A3/A2,B2/B3,B3/B1,A3/B3,A1/Z1} % 7 edges

  \or % projection-2

  %%% changed perspective
  \ifREVP
  \def\EDGESFRONT{% 18 edges
    A3/B3,B3/B2,B2/A2, % QA
    A0/Y1,Y1/Z1,Z1/A1, % QB
    B3/B1,B1/Z1, % PC
    B2/X3,X3/X2,X2/X0, % PD
    Y1/Y2,Y2/X2, % PG
    A2/A3,A3/A1,A1/A0,A0/X0,X0/A2% PA
  }
  \def\EDGESBACK{% 3 edges
    B0/X3, % PB %%
    B1/B0,B0/Y2% PF %% B1/B0, B0/Y2 partially covered by A2/A3, X0/A2
  }
  \else % \ifREVP
  %%% changed perspective
  \def\EDGESFRONT{% 3 edges
    B0/X3, % PB %%
    B1/B0,B0/Y2% PF
  }
  \def\EDGESBACK{%
    A3/B3,B2/A2,A0/Y1,Z1/A1,X2/X0, %
    % A2/A3, %% covered by B1/B0
    % ,X0/A2 %% covered by B0/Y2
    A3/A1,A1/A0,A0/X0} % 10 edges
  \fi % \ifREVP
  \def\faceBDRY{Y1,Y2,X2,X3,B2,B3,B1,Z1} % 8 edges
  \def\pathCOVER{A3,A2,X0} % the partial overlaps

  \or % projection-3

  %% \def\EDGESFRONT{% 12 edges + 2x4 edges = 20 edges
  %%   A3/A1,A0/X0,X0/A2, % PA
  %%   B3/B1,B1/B0,X3/B2, % PB
  %%   B1/Z1, % PC
  %%   Z1/A0, % not an edge %% A1/A0, Y1/Z1, A0/Y1, Z1/A1
  %%   X2/X0, % PD
  %%   X2/B0, % not an edge %% X3/B0, Y2/X2, B0/Y2, X2/X3
  %%   A2/A3,A3/B3,B3/B2,B2/A2% QA
  %% }
  \def\EDGESBACK{Y1/Y2} % 1 edge
  \def\EDGESFRONT{A3/A1,X0/A2,B3/B1,X3/B2,A2/A3,A3/B3,B3/B2,B2/A2} %
  %% subdivide \faceBDRY
  \def\pathBDRYa{X2,X0,A0}
  \def\pathBDRYb{Z1,B1,B0}
  \def\pathBDRYu{B0,X2} % collapse of QB
  \def\pathBDRYv{A0,Z1} % collapse of QA
  \edef\faceBDRY{\pathBDRYa,\pathBDRYv,\pathBDRYb,\pathBDRYu}

  \or % projection-4

  %% \def\EDGESFRONT{% 11 edges
  %%   A1/A0,A0/Y1,Y1/Z1,Z1/A1, % QB %% Z1/A1 covers B0/X3
  %%   A0/X0,X0/A2,% PA %% A2/A3 in \EDGESDOUBLE
  %%   B3/B1,B1/Z1,% PC %% B2/B3 in \EDGESDOUBLE
  %%   Y1/Y2,Y2/X2,X2/X0% PG
  %% }
  \def\EDGESBACK{% 3 edges
    Y2/B0,B0/B1,% PF
    % PD %% A2/B2 in \EDGESDOUBLE
    X2/X3% QC %% partially covered by A0/A1
  }
  \def\faceBDRY{A2,X0,X2,Y2,Y1,Z1,B1,B3} % 7 edges, --cycle in \EDGESDOUBLE
  \def\EDGESFRONT{A1/A0,A0/Y1,Z1/A1,A0/X0} %
  \def\EDGESDOUBLE{% 2 edges + 3,1 edges
    A2/B3,A3/A1% QA,PA,PD %% B2/X3=A3/A1
  }

  \fi % \ifcase

  %%%%%%%%

  \ifTHICK
  \ifINSPECTOR % show details of edge drawing
  \ifcase\Variant %
  \or \scope[line width=10pt,opacity=0.5] % projection-1
  \or \scope[line width=10pt,opacity=0.5] % projection-2
  \or \scope[line width=20pt,opacity=0.5] % projection-3
  \or \scope[line width=20pt,opacity=0.5] % projection-4
  \fi %
  \else %
  \scope[line width=5pt] %
  \fi % \ifINSPECTOR
  \else % \ifTHICK
  \scope[semithick] % thickness of edges (0.6pt)
  \fi

  \ifCOLORS

  %% for edge overlaps
  \colorlet{myblue}{blue!50!black} %
  %% for rectangle collapses
  \colorlet{myblack}{black} %
  %% even darker for vertex overlaps
  \colorlet{myblueV}{blue!25!black} %
  \colorlet{myblackV}{black} %

  \ifDRAWBULLETS %
  %% thick bullets for vertex overlaps
  \tikzset{radius=0.8*\pgflinewidth}
  \fi %

  \ifcase\Variant %

  \or % projection-1

  \ifCOLORSC
  \fill[yellow!50] \CYCLE\facePD ; % Back Left
  \fill[yellow!50] \CYCLE\facePG ; % Back Right
  \fill[red!40] \CYCLE\faceQC ; % Rectangle Back
  \fill[red!40] \CYCLE\facePF ; % Bottom Right
  \else
  \fill[red!10] \CYCLE\facePD ; % Back Left
  \fill[red!10] \CYCLE\facePG ; % Back Right
  \fill[blue!30] \CYCLE\faceQC ; % Rectangle Back
  \fill[blue!30] \CYCLE\facePF ; % Bottom Right
  \fi % \ifCOLORSC

  \draw[blue] foreach \XXX/\YYY in \EDGESBACK { (\XXX) -- (\YYY) } ; %

  \ifCOLORSC
  %% \fill[green!50,opacity=0.6] \CYCLE\facePB ; % South Left
  %% \fill[red!40,opacity=0.6] \CYCLE\facePC ; % Front
  \fill[green!50,opacity=0.7] \CYCLE\facePB ; % South Left
  \fill[red!40,opacity=0.8] \CYCLE\facePC ; % Front
  \fill[red!40,opacity=0.6] \CYCLE\faceQB ; % Rectangle Right
  \fill[red!40,opacity=0.6] \CYCLE\faceQA ; % Rectangle Left
  \fill[green!50,opacity=0.6] \CYCLE\facePA ; % North Left
  \else
  \fill[green!50,opacity=0.8] \CYCLE\facePB ; % South Left
  \fill[red!20,opacity=0.8] \CYCLE\facePC ; % Front
  \fill[red!20,opacity=0.8] \CYCLE\faceQB ; % Rectangle Right
  \fill[red!20,opacity=0.8] \CYCLE\faceQA ; % Rectangle Left
  \fill[green!50,opacity=0.8] \CYCLE\facePA ; % North Left
  \fi % \ifCOLORSC

  \draw[blue] \CYCLE\faceBDRY %
  foreach \XXX/\YYY in \EDGESFRONT { (\XXX) -- (\YYY) } ; %

  \ifDRAWDOUBLES %
  \ifDRAWBULLETS %
  %% (B3) lies on (X2) -- (X3)
  % \fill[myblueV] (B3) circle[] ; %
  %% projection-1 has only a vertex/edge overlap
  %% don't use the very dark color for this
  \fill[myblue] (B3) circle[] ; %
  \fi %
  \fi %

  \or % projection-2

  \ifREVP

  \ifCOLORSC
  \fill[yellow!50] \CYCLE\facePF ; %
  \fill[green!50] \CYCLE\facePB ; %
  \fill[red!40] \CYCLE\faceQC ; %
  \else
  \fill[red!10] \CYCLE\facePF ; %
  \fill[green!50] \CYCLE\facePB ; %
  \fill[blue!30] \CYCLE\faceQC ; %
  \fi % \ifCOLORSC

  \draw[blue] foreach \XXX/\YYY in \EDGESBACK { (\XXX) -- (\YYY) } ; %

  \ifCOLORSC
  \fill[blue!25,opacity=0.6] \CYCLE\faceQA ; % square down
  \fill[blue!25,opacity=0.6] \CYCLE\faceQB ; % rectangle up
  \fill[red!40,opacity=0.6] \CYCLE\facePC ; % left
  \fill[red!40,opacity=0.6] \CYCLE\facePD ; % down right
  \fill[red!40,opacity=0.6] \CYCLE\facePG ; % up right
  \fill[green!50,opacity=0.85] \CYCLE\facePA ; % Ass_2
  \else
  \fill[blue!20,opacity=0.8] \CYCLE\faceQA ; % square down
  \fill[blue!20,opacity=0.8] \CYCLE\faceQB ; % rectangle up
  \fill[red!20,opacity=0.8] \CYCLE\facePC ; % left
  \fill[red!20,opacity=0.8] \CYCLE\facePD ; % down right
  \fill[red!20,opacity=0.8] \CYCLE\facePG ; % up right
  \fill[green!50,opacity=0.8] \CYCLE\facePA ; % Ass_2
  \fi % \ifCOLORSC

  \draw[blue] \CYCLE\faceBDRY %
  foreach \XXX/\YYY in \EDGESFRONT { (\XXX) -- (\YYY) } ; %

  \else % \ifREVP

  \ifCOLORSC
  \fill[blue!25] \CYCLE\faceQA ; % square down
  \fill[blue!25] \CYCLE\faceQB ; % rectangle up
  \fill[red!40] \CYCLE\facePC ; % left
  \fill[red!40] \CYCLE\facePD ; % down right
  \fill[red!40] \CYCLE\facePG ; % up right
  \fill[green!50] \CYCLE\facePA ; % Ass_2
  \else
  \fill[blue!20] \CYCLE\faceQA ; % square down
  \fill[blue!20] \CYCLE\faceQB ; % rectangle up
  \fill[red!20] \CYCLE\facePC ; % left
  \fill[red!20] \CYCLE\facePD ; % down right
  \fill[red!20] \CYCLE\facePG ; % up right
  \fill[green!50] \CYCLE\facePA ; % Ass_2
  \fi % \ifCOLORSC

  \draw[blue] foreach \XXX/\YYY in \EDGESBACK { (\XXX) -- (\YYY) } ; %

  \ifCOLORSC
  \fill[yellow!50,opacity=0.5] \CYCLE\facePF ; %
  \fill[green!50,opacity=0.7] \CYCLE\facePB ; %
  \fill[red!40,opacity=0.8] \CYCLE\faceQC ; %
  \else
  \fill[red!30,opacity=0.6] \CYCLE\facePF ; %
  \fill[green!50,opacity=0.7] \CYCLE\facePB ; %
  \fill[blue!30,opacity=0.8] \CYCLE\faceQC ; %
  \fi % \ifCOLORSC

  \draw[blue] \CYCLE\faceBDRY %
  foreach \XXX/\YYY in \EDGESFRONT { (\XXX) -- (\YYY) } ; %

  \fi % \ifREVP

  \ifDRAWDOUBLES %

  %%%% piece together edges with different colors
  %%% \INSPECTORtrue shows the details

  \tikzset{ %
    fit90+60/.style={ %
      shorten <=-\pgflinewidth/2, %
      postaction={decorate,decoration= %
        {markings,mark=at position 0 with %
          \arrowreversed{Butt Cap[slant=tan(30),sep=0pt -tan(30)]}}}, %
      postaction={decorate,decoration= %
        {markings,mark=at position 1 with %
          \arrow{Butt Cap[slant=-tan(30),sep=0pt -tan(30)]}}}, %
      postaction={decorate,decoration= %
        {markings,mark=at position 1 with %
          \arrow{Butt Cap[slant=-tan(60),sep=0pt -1]}}}, %
  }} %

  %% \draw[myblue,fit90+60] \PATH\pathCOVER ; %
  %%% fit90+60 is too sophisticated and distracting
  \draw[myblue] \PATH\pathCOVER ; %

  \ifDRAWBULLETS %
  \fill[myblueV] (A2) circle[] ; %
  \fi %

  \fi % \ifDRAWDOUBLES

  \or % projection-3

  \ifCOLORSC
  \fill[blue!20] \CYCLE\facePF ; %
  \fill[yellow!60] \CYCLE\facePG ; %
  \else
  \fill[blue!30] \CYCLE\facePF ; %
  \fill[red!10] \CYCLE\facePG ; %
  \fi % \ifCOLORSC

  \draw[blue] foreach \XXX/\YYY in \EDGESBACK { (\XXX) -- (\YYY) } ; %

  \ifCOLORSC
  \fill[green!50,opacity=0.85] \CYCLE\facePA ; %
  \fill[green!50,opacity=0.85] \CYCLE\facePB ; %
  \fill[red!40,opacity=0.85] \CYCLE\facePC ; %
  \fill[red!40,opacity=0.85] \CYCLE\facePD ; %
  \fill[blue!25,opacity=0.85] \CYCLE\faceQA ; % Square
  \else
  \fill[green!50,opacity=0.8] \CYCLE\facePA ; %
  \fill[green!50,opacity=0.8] \CYCLE\facePB ; %
  \fill[red!20,opacity=0.8] \CYCLE\facePC ; %
  \fill[red!20,opacity=0.8] \CYCLE\facePD ; %
  \fill[blue!20,opacity=0.8] \CYCLE\faceQA ; % Square
  \fi % \ifCOLORSC

  \ifDRAWDOUBLES %

  %%%% piece together edges with different colors
  %%% \INSPECTORtrue shows the details

  \draw[blue] % \CYCLE\faceBDRY %
  foreach \XXX/\YYY in \EDGESFRONT { (\XXX) -- (\YYY) } ; %

  \tikzset{ %
    fit90-45under/.style={ %
      shorten <=-\pgflinewidth/2, %
      shorten >=-tan(22.5)*\pgflinewidth/2}, %
    fit45-90over/.style={ %
      {Butt Cap[slant=-tan(22.5)]}-,
      shorten >=5/4*\pgflinewidth/2, %
      postaction={decorate,decoration= %
        {markings,mark=at position 1 with %
          \arrow{Butt Cap[slant=1]}}}, %
  }} %

  \draw[blue,fit90-45under] \PATH\pathBDRYa ; %
  \draw[blue,fit90-45under] \PATH\pathBDRYb ; %
  \draw[myblack,fit45-90over] \PATH\pathBDRYu ; %
  \draw[myblack,fit45-90over] \PATH\pathBDRYv ; %

  \else % \ifDRAWDOUBLES

  \draw[blue] \CYCLE\faceBDRY %
  foreach \XXX/\YYY in \EDGESFRONT { (\XXX) -- (\YYY) } ; %

  \fi % \ifDRAWDOUBLES

  \or % projection-4

  \ifCOLORSC
  \fill[red!50] \CYCLE\faceQC ; % Rectangle Bot
  \fill[green] \CYCLE\facePB ; %
  \fill[blue!20] \CYCLE\facePD ; %
  \fill[blue!20] \CYCLE\facePF ; %
  \else
  \fill[red!10] \CYCLE\faceQC ; % Rectangle Bot
  \fill[green!50] \CYCLE\facePB ; %
  \fill[blue!30] \CYCLE\facePD ; %
  \fill[blue!30] \CYCLE\facePF ; %
  \fi % \ifCOLORSC

  \draw[blue] foreach \XXX/\YYY in \EDGESBACK { (\XXX) -- (\YYY) } ; %

  \ifCOLORSC
  \fill[green!50,opacity=0.85] \CYCLE\facePA ; %
  \fill[yellow!60,opacity=0.85] \CYCLE\facePG ; %
  \fill[orange!50,opacity=0.85] \CYCLE\facePC ; %
  \fill[blue!25,opacity=0.85] \CYCLE\faceQB ; % Rectangle Top
  \else
  \fill[green!50,opacity=0.8] \CYCLE\facePA ; %
  \fill[red!20,opacity=0.8] \CYCLE\facePG ; %
  \fill[red!20,opacity=0.8] \CYCLE\facePC ; %
  \fill[red!20,opacity=0.8] \CYCLE\faceQB ; % Rectangle Top
  \fi % \ifCOLORSC

  \ifDRAWDOUBLES %

  %% \draw[blue] \PATH\faceBDRY %
  %% foreach \XXX/\YYY in \EDGESFRONT { (\XXX) -- (\YYY) } ; %
  %% \draw[black] foreach \XXX/\YYY in \EDGESDOUBLE { (\XXX) -- (\YYY) } ; %

  %%%% piece together edges with different colors
  %%% \INSPECTORtrue shows the details

  \tikzset{ %
    fit90-90/.style={ %
      shorten <=-\pgflinewidth/2, %
      postaction={decorate,decoration= %
        {markings,mark=at position 0 with %
          \arrowreversed{Butt Cap[slant=-tan(45),sep=0pt -cos(45)]}}}, %
      shorten >=-\pgflinewidth/2, %
      postaction={decorate,decoration= %
        {markings,mark=at position 1 with %
          \arrow{Butt Cap[slant=-tan(45),sep=0pt -cos(45)]}}}, %
    }, %
    fit45-45under/.style={ %
      shorten <=-tan(22.5)*\pgflinewidth/2,
      shorten >=-tan(22.5)*\pgflinewidth/2}, %
    fit45-45over/.style={ %
      {Butt Cap[slant=-tan(22.5)]}-{Butt Cap[slant=tan(22.5)]}}, %
  } %

  \draw[blue] foreach \XXX/\YYY in \EDGESFRONT { (\XXX) -- (\YYY) } ; %
  \draw[myblue] (A3) -- (A1) ; %
  %% \draw[myblue,fit90-90] (A0) -- (A1) -- (B0) ; %
  %%% fit90-90 is too sophisticated and distracting
  \draw[myblue] (A0) -- (A1) -- (B0) ; %

  \draw[blue,fit45-45under] \PATH\faceBDRY ; % starts in (A2), ends in (B3)
  \draw[myblack,fit45-45over] (B3) -- (A2) ; %

  \ifDRAWBULLETS %
  \fill[myblueV] (A1) circle[] ; %
  \fill[myblackV] (A3) circle[] ; %
  \fi %

  \else % \ifDRAWDOUBLES

  \edef\EDGESFRONTALL{A3/A1,\EDGESFRONT}
  \draw[blue] \CYCLE\faceBDRY %
  foreach \XXX/\YYY in \EDGESFRONTALL { (\XXX) -- (\YYY) } ; %

  \fi % \ifDRAWDOUBLES

  \fi % \ifcase

  \else % \ifCOLORS

  %% draw just the 1-skeleton (no faces)

  \ifnum\Variant=4 %
  \edef\EDGESFRONTALL{\EDGESDOUBLE,\EDGESFRONT}
  \else %
  \let\EDGESFRONTALL\EDGESFRONT
  \fi %

  \ifBLACKRED % thick black-red variant

  \scope[line width=2pt]
  \draw[red] foreach \XXX/\YYY in \EDGESBACK { (\XXX) -- (\YYY) } ; %
  \draw[black] \CYCLE\faceBDRY %
  foreach \XXX/\YYY in \EDGESFRONTALL { (\XXX) -- (\YYY) } ; %
  \endscope

  \else % \BLACKRED

  \edef\EDGES{\EDGESBACK,\EDGESFRONTALL} %
  \draw[blue] \CYCLE\faceBDRY %
  foreach \XXX/\YYY in \EDGES { (\XXX) -- (\YYY) } ; %

  \fi % \BLACKRED

  \fi % \ifCOLORS

  \endscope % thickness of edges

  %%%%%%%%

  %% 9 homotopy arrows

  \ifARROWS

  \ifcase\Variant %
  \or % projection-1
  \def\ARROWSBACK{Y1/Y2,Y2/B0,X0/X2,X2/X3}
  \def\ARROWSFRONT{A2/B2,A3/B3,A0/Y1,A1/Z1,Z1/B1}
  \or % projection-2
  \ifREVP
  \def\ARROWSBACK{Y2/B0}
  \def\ARROWSFRONT{A2/B2,A3/B3,A0/Y1,A1/Z1,Z1/B1, %
    Y1/Y2,X0/X2,X2/X3}
  \else % \ifREVP
  \def\ARROWSBACK{A2/B2,A3/B3,A0/Y1,A1/Z1,X0/X2}
  \def\ARROWSFRONT{Y1/Y2,Y2/B0,X2/X3,Z1/B1}
  \fi % \ifREVP
  \or % projection-3
  \def\ARROWSBACK{Y1/Y2,Y2/B0,A0/Y1}
  \def\ARROWSFRONT{A2/B2,A3/B3,A1/Z1,Z1/B1,X0/X2,X2/X3}
  \or % projection-4
  \def\ARROWSBACK{A2/B2,X2/X3,Y2/B0}
  \def\ARROWSFRONT{A3/B3,A0/Y1,A1/Z1,Z1/B1,Y1/Y2,X0/X2}
  \fi % \ifcase

  \def\MIDTIP{0.5} %
  \ifcase\Variant %
  \or % looks better for projection-1
  \ifCOLORS \def\MIDTIP{0.4} \else\fi
  \fi

  \tikzset{ %
    midtip/.style={ %
      postaction={decorate,decoration= %
        {markings,mark=at position #1 with %
          \arrow{stealth} %
    }}}, %
    midtip/.default=\MIDTIP, %
  } %

  %%% BTW: stealth is Stealth with configuration
  %% \tikzset{sStealth/.tip={Stealth[
  %%       length = +2.24pt 2.4 0.8, %
  %%       width' = +0pt 1, %
  %%       inset' = +0pt 0.375, %
  %%       line width = +0pt, %
  %% ]}} %

  \def\COLOR{black}
  \foreach \XXX/\YYY in \ARROWSFRONT { %
    \path[midtip,\COLOR] (\XXX) -- (\YYY) ; } %

  %%% with colors, back arrows are drawn in gray
  %% in projection-3/4 some back gray arrows are drawn over some black
  %% front edges (which are already drawn).

  \ifCOLORS \def\COLOR{black!50} \else\fi
  \foreach \XXX/\YYY in \ARROWSBACK { %
    \path[midtip,\COLOR] (\XXX) -- (\YYY) ; } %

  \fi % \ifARROWS

  %%%%%%%%

  %% labels (Loday coordinates, internal names, parenthetical)

  \ifCOLORS
  \def\LABELCOLOR{white}
  \else
  \def\LABELCOLOR{black!10} % more contrast with no colors
  \fi

  \tikzset{ %
    labelbox/.style={ %
      fill=\LABELCOLOR,fill opacity=0.6, %
      draw,text opacity=1, %
      inner sep=#1}, %
    labelbox/.default=7/3pt, %
  } %

  \ifLABELS

  \ifNAMES
  \def\Label#1{$\tt\scriptscriptstyle#1$} % technical look
  \else
  \def\Label#1{$\scriptscriptstyle#1$}
  \fi

  %% for projection-2/4
  \def\DoubleLabelAt#1#2#3{
    \node[labelbox] at (#3)
         {\Label{\nulldelimiterspace=0pt\genfrac{}{}{0pt}{3}{#1}{#2}}} ; }
  \def\DoubleLabel#1#2{\DoubleLabelAt{#1}{#2}{#1}}

  \ifcase\Variant %

  \or % projection-1
  \ifNAMES %
  \path foreach \XXX/\UNUSED in \LCOORDINATES { %
    node[labelbox] at (\XXX) {\Label\XXX} } ; %
  \else %
  \ifHEIGHT % (1,-3,1,1)
  \def\HEIGHT#1#2#3#4{\pgfmathparse{int(#1-3*#2+#3+#4)}\pgfmathresult}
  \path foreach \XXX/\x/\y/\z/\t in \LCOORDINATES { %
    node[labelbox] at (\XXX) {\Label{\HEIGHT\x\y\z\t}} } ; %
  \else % \ifHEIGHT
  \path foreach \XXX/\x/\y/\z/\t in \LCOORDINATES { %
    node[labelbox] at (\XXX) {\Label{\x\y\z\t}} } ; %
  \fi\fi %

  \or % projection-2
  \ifNAMES %
  \path foreach \XXX/\UNUSED [count=\i] in \LCOORDINATES { %
    \ifnum\i=4 \else\ifnum\i=8 \else
    node[labelbox] at (\XXX) {\Label\XXX}
    \fi\fi } ; %
  \DoubleLabel{B0}{A2} %
  \else %
  \ifHEIGHT % (1,1,1,-3)
  \ifREVP % -(1,1,1,-3)
  \def\HEIGHT#1#2#3#4{\pgfmathparse{int(-#1-#2-#3+3*#4)}\pgfmathresult}
  \else % \ifREVP
  \def\HEIGHT#1#2#3#4{\pgfmathparse{int(#1+#2+#3-3*#4)}\pgfmathresult}
  \fi % \ifREVP
  \path foreach \XXX/\x/\y/\z/\t [count=\i] in \LCOORDINATES { %
    \ifnum\i=4 \else\ifnum\i=8 \else
    node[labelbox] at (\XXX) {\Label{\HEIGHT\x\y\z\t}}
    \fi\fi } ; %
  \DoubleLabelAt{6}{-6}{B0} % 4321 3214
  \else % \ifHEIGHT
  \path foreach \XXX/\x/\y/\z/\t [count=\i] in \LCOORDINATES { %
    \ifnum\i=4 \else\ifnum\i=8 \else
    node[labelbox] at (\XXX) {\Label{\x\y\z\t}}
    \fi\fi } ; %
  \DoubleLabelAt{4321}{3214}{B0} %
  \fi\fi %

  \or % projection-3 - same as for projection-1 (up to \HEIGHT)
  \ifNAMES %
  \path foreach \XXX/\UNUSED in \LCOORDINATES { %
    node[labelbox] at (\XXX) {\Label\XXX} } ; %
  \else %
  \ifHEIGHT % (1,-1,-1,1)
  \def\HEIGHT#1#2#3#4{\pgfmathparse{int(#1-#2-#3+#4)}\pgfmathresult}
  \path foreach \XXX/\x/\y/\z/\t in \LCOORDINATES { %
    node[labelbox] at (\XXX) {\Label{\HEIGHT\x\y\z\t}} } ; %
  \else % \ifHEIGHT
  \path foreach \XXX/\x/\y/\z/\t in \LCOORDINATES { %
    node[labelbox] at (\XXX) {\Label{\x\y\z\t}} } ; %
  \fi\fi %

  \or % projection-4
  \ifNAMES %
  \path foreach \XXX/\UNUSED [count=\i] in \LCOORDINATES { %
    \ifnum\i=2 \else\ifnum\i=12 \else\ifnum\i=5 \else\ifnum\i=13 \else
    node[labelbox] at (\XXX) {\Label\XXX}
    \fi\fi\fi\fi } ; %
  \DoubleLabel{A1}{X3} %
  \DoubleLabel{A3}{B2} %
  \else %
  \ifHEIGHT % -(1,1,-1,-1)
  \def\HEIGHT#1#2#3#4{\pgfmathparse{int(-#1-#2+#3+#4)}\pgfmathresult}
  \path foreach \XXX/\x/\y/\z/\t [count=\i] in \LCOORDINATES { %
    \ifnum\i=2 \else\ifnum\i=12 \else\ifnum\i=5 \else\ifnum\i=13 \else
    node[labelbox] at (\XXX) {\Label{\HEIGHT\x\y\z\t}}
    \fi\fi\fi\fi } ; %
  \DoubleLabelAt{4}{-4}{A1} % {2134}{4312}
  \DoubleLabelAt{2}{-2}{A3} % {3124}{4213}
  \else % \ifHEIGHT
  \path foreach \XXX/\x/\y/\z/\t [count=\i] in \LCOORDINATES { %
    \ifnum\i=2 \else\ifnum\i=12 \else\ifnum\i=5 \else\ifnum\i=13 \else
    node[labelbox] at (\XXX) {\Label{\x\y\z\t}}
    \fi\fi\fi\fi } ; %
  \DoubleLabelAt{2134}{4312}{A1} %
  \DoubleLabelAt{3124}{4213}{A3} %
  \fi\fi %

  \fi % \ifcase

  \fi % \ifLABELS

  \ifPARENS

  %% identical
  % \def\Label#1{\scalebox{.5}{\textbf{#1}}}
  \def\Label#1{\PARENfont#1}

  \tikzset{ %
    labelbox/.default=4/3pt, %
  } %

  %% for projection-2/4
  \def\DoubleLabelAt#1#2#3{
    \node[labelbox] at (#3)
         {$\nulldelimiterspace=0pt\genfrac{}{}{0pt}{3}
           {\hbox{\PARENfont#1}} % front vertex
           {\hbox{\PARENfont#2}} % back vertex
           $}; }
  \def\DoubleLabel#1#2{\DoubleLabelAt{#1}{#2}{#1}}

  \ifcase\Variant %

  \or % projection-1
  \path foreach \XXX/\x/\y/\z/\t/\P in \LCOORDINATES { %
    node[labelbox] at (\XXX) {\Label\P} } ; %

  \or % projection-2
  \path foreach \XXX/\x/\y/\z/\t\P [count=\i] in \LCOORDINATES { %
    \ifnum\i=4 \else\ifnum\i=8 \else
    node[labelbox] at (\XXX) {\Label\P}
    \fi\fi } ; %
  \DoubleLabelAt{0(1(2(34)))}{(0(1(23)))4}{B0} % {B0}{A2}

  \or % projection-3 - same as for projection-1
  \path foreach \XXX/\x/\y/\z/\t/\P in \LCOORDINATES { %
    node[labelbox] at (\XXX) {\Label\P} } ; %

  \or % projection-4
  \path foreach \XXX/\x/\y/\z/\t/\P [count=\i] in \LCOORDINATES { %
    \ifnum\i=2 \else\ifnum\i=12 \else\ifnum\i=5 \else\ifnum\i=13 \else
    node[labelbox] at (\XXX) {\Label\P}
    \fi\fi\fi\fi } ; %
  \DoubleLabelAt{((0(12))3)4}{0(1((23)4))}{A1} % {A1}{X3}
  \DoubleLabelAt{(0((12)3))4}{0((1(23))4)}{A3} % {A3}{B2}

  \fi % \ifcase

  \fi % \ifPARENS

  \endtikzpicture
} % \centerline
\end{document}

%%%%%%%%

%% png creation (normal size, transparent)

%%% pdflatex cube-3LO.tex
%%% pdftocairo -png -singlefile -transp cube-3LO.pdf tmp
%%% magick -define png:exclude-chunk=date,time tmp.png -trim +repage cube-3LO.png
%%% optipng cube-3LO.png

%%%% magick adds white (fallback) background to the transparent image
%%%% and has the convenient option -trim.

%%%% Default resolution of pdftocairo is 150 ppi.  Size of trimmed
%%%% image is 517x356.

%% png creation (large size)

%%% pdflatex cube-3LO.tex
%%% pdftocairo -png -singlefile -r 361.35 -W 1436 -H 1058 -x 818 -y 480 cube-3LO.pdf cube-3LO-large
%%% optipng cube-3LO-large.png

%%%% The resolution 361.35 ppi translates 1pt to 5 pixels.  Hence 1
%%%% pixel in the png corresponds to 0.2pt.  A TeX rule becomes 2
%%%% pixels wide.

%%%% trim parameters (without arrows):
%%% magick tmp.png -format "%@\n" info: %% 1236x858+918+580
%%%% padding is 100 pixels

%% program versions

%%% This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex)
%%% Document Class: amsart 2017/10/31 v2.20.4
%%% Package: tikz 2020/01/08 v3.1.5b (3.1.5b)

%%% pdftocairo version 0.86.1
%%% ImageMagick 7.1.2-19 Q16-HDRI x86_64 23897 https://imagemagick.org
%%% OptiPNG version 0.7.7

%%%%%%%%

%%%% Created:
%%% 2026-03-12 % for projection-1

%%%% Latest change of an image:
%%% 2026-03-14 % green A_2,A_2' + arrows
%%% 2026-05-04+ % new: many further variants
%%% 2026-05-30 % new: assoc-L3O-height-proj*.png

%%%% Latest code change:
%%% 2026-05-04 % add the other projections and alternative colors
%%% 2026-05-11 % changed perspective for projection-2
%%% 2026-05-25 % implement various \ifs
%%% 2026-05-30 % implement \ifHEIGHT
%%% 2026-06-02 % implement \ifREVP (for projection-2)

%%%%%%%%
