%% assoc-L3L.tex - an affine projection of the Loday associahedron similar to the drawing in Lodays paper
%% Author: Markus Rost <https://www.math.uni-bielefeld.de/~rost/>
%% Created: 10 Mar 2026

%% to be compiled with pdflatex

\documentclass{amsart}

%%%%%%%%

%%%%% Shows an affine projection of Loday's realization of the
%%%%% 3-dimensional associahedron.  It is close to the drawing at the
%%%%% end of Loday's paper (Loday, Jean-Louis.  Realization of the
%%%%% Stasheff polytope.  Arch. Math. 83, no. 3, 267-278, 2004. MR
%%%%% 2108555.)

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

%%%%%%%%

\newif\ifLABELS %
%% uncomment to show the 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\ifPARENS %
%% uncomment to get paren expressions as labels
% \PARENStrue %
\ifPARENS \LABELSfalse \fi % just in case

\newif\ifGREEN %
%% uncomment to draw the 2. dim subassociahedra in green
% \GREENtrue %

%%%%%%%%

\ifPARENS %
\DeclareFixedFont{\PARENfont}{OT1}{cmr}{b}{n}{5} %
\fi %

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\thispagestyle{empty} %

\centerline{%

  %%% projection parameters to match Lodays drawing, somewhat
  \tikzpicture[x={(1cm,-3cm/2)}, y={(2cm,0cm)}, z={(1cm,-2cm/3)}]

  %%%%%%%% 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)
  }

  %% drop the third coordinate
  \path foreach \NNN/\x/\y/\z/\t in \LCOORDINATES { %
    coordinate (\NNN) at ($(\x,\y,\t)$) } ; %

  %%%%%%%%

  %% placement in shipout is independent of labels
  \useasboundingbox (Z1) (B3) (Y2) (X2) ; %

  %%%%%%%%

  %%%% 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(Q1) %% 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{B2,B3,B1,B0,X3} % T(PA)
  \def\facePG{X0,A0,Y1,Y2,X2} % T(PF)
  %% pentagons with no parallel face
  \def\facePC{A3,B3,B1,Z1,A1} %
  \def\facePD{A2,B2,X3,X2,X0} % T(PC)

  %%%% the 21 edges of the associahedron

  %% \facePA completely in front

  \def\EDGESBACK{%
    Y2/Y1,Y2/X2,Y2/B0,B0/X3,B0/B1%
  }
  \def\EDGESFRONT{%
    A0/A1,A0/X0,X0/A2,A1/A3,A0/Y1, %
    A1/Z1,Z1/B1,A2/B2,A3/B3,A3/A2, %
    Y1/Z1,B2/X3,B3/B2,B3/B1,X2/X3,X2/X0%
  }

  %%%%%%%%

  \def\CYCLE#1{foreach\p[count=\i]in#1{\ifnum\i=1 \else--\fi(\p)}--cycle}

  % Back, Back R
  \fill[blue!15] \CYCLE\facePF \CYCLE\faceQC ; %

  % Bottom
  \ifGREEN %
  \fill[green!50] \CYCLE\facePB ; %
  \else %
  \fill[white] \CYCLE\facePB ; %
  \fi %

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

  % Left up, Front R, Front L
  \fill[red!20,opacity=0.6] \CYCLE\faceQB \CYCLE\facePD \CYCLE\facePC ; %

  \ifGREEN %
  \fill[red!20,opacity=0.6] \CYCLE\facePG ; % Top
  \fill[green!50,opacity=0.6] \CYCLE\facePA ; % Front up
  \fill[red!20,opacity=0.6] \CYCLE\faceQA ; % Front
  \else %
  \fill[white,opacity=0.2] \CYCLE\facePG ; % Top
  \fill[red!20,opacity=0.6] \CYCLE\facePA ; % Front up
  \fill[red!20,opacity=0.4] \CYCLE\faceQA ; % Front
  \fi %

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

  %%%%%%%%

  \ifLABELS

  \begin{scope} [outer sep=0pt,inner sep=2pt]

    \tiny

    \tikzset{ %
      A0place/.style={above right,xshift=-2.5pt}, %
      X0place/.style={below right,xshift=-1pt,yshift=0.5pt}, %
    } %

    \def\PLACES{ %
      A0/A0place, A1/below left, A2/below left, A3/below right, %
      B0/above left, B1/below left, B2/below, B3/below, %
      X0/X0place, X2/right, X3/below right, %
      Y1/above, Y2/above, Z1/left}

    \ifNAMES

    %%%%%%%% show the names of the vertices

    \path foreach \XXX/\place in \PLACES { %
      node[\place] at (\XXX) {\XXX} } ; %

    \else % \ifNAMES

    %%%%%%%% show the coordinates

    \path
    foreach \XXX/\place in \PLACES { %
      node[\place] (N\XXX) at (\XXX) {\phantom{0000}} } %
    foreach \XXX/\x/\y/\z/\t in \LCOORDINATES { %
      node at (N\XXX) {\x\y\z\t} } ; %

    \fi % \ifNAMES

  \end{scope}

  \fi % \ifLABELS

  \ifPARENS

  \tikzset{
    labelbox/.style={ %
      fill=white,fill opacity=0.6, %
      draw,text opacity=1, %
      inner sep=4/3pt}, %
  }

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

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

  \fi

  \endtikzpicture
} % \centerline
\end{document}

%%%%%%%%

%% png creation (small size, transparent)

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

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

%%%% Size of trimmed image is 385x226.

%% png creation (large size)

%%% pdflatex cube-3LL.tex
%%% pdftocairo -png -singlefile -r 361.35 -W 1625 -H 1033 -x 723 -y 481 cube-3LL.pdf cube-3LL-large
%%% optipng cube-3LL-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:
%%% magick tmp.png -format "%@\n" info: %% 1425x833+823+581
%%%% 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-10

%%%% Latest change of an image:
%%% 2026-04-29 % minor changes
%%% 2026-05-02 % tiny changes

%%%% Latest code change:
%%% 2026-04-29 % draw edges only once
%%% 2026-05-02 % new macro \CYCLE

%%%%%%%%
