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

%%%%%%%%

\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
    A1/2/1/3/4, % (( 0(12) )3)4
    X0/1/4/1/4, % ( (01)(23) )4
    A2/3/2/1/4, % ( 0(1(23)) )4
    A3/3/1/2/4, % ( 0((12)3) )4
    Y1/1/2/6/1, %  ((01)2)(34)
    Y2/1/6/2/1, %  (01)(2(34))
    B0/4/3/2/1, %  0(1(2(34)))
    Z1/2/1/6/1, %  (0(12))(34)
    B1/4/1/4/1, %  0((12)(34))
    X2/1/6/1/2, %  (01)((23)4)
    X3/4/3/1/2, %  0(1((23)4))
    B2/4/2/1/3, %  0((1(23))4)
    B3/4/1/2/3% %  0(((12)3)4)
  }

  \foreach \NNN/\A/\B/\C/\D in \LCOORDINATES { %

    %% drop the third coordinate
    \coordinate (\NNN) at ($(\A,\B,\D)$) ;

  }

  %%%%%%%%

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

  %%%%%%%%

  %% face A0, A1, A3, A2, X0 completely in front

  %% edges are drawn twice

  %% split some "-- cycle" at sharp corners

  \begin{scope} [blue]

    \draw[fill=white] % [fill=yellow!80]
    (B1) -- (B0) -- (X3) -- (B2) -- (B3) -- (B1) ; % Bottom

    \draw[fill=blue!15]
    (Z1) -- (Y1) -- (Y2) -- (B0) -- (B1) -- cycle ; % Back
    \draw[fill=blue!15]
    (Y2) -- (X2) -- (X3) -- (B0) -- cycle ; % Back R

    \draw[fill=white,opacity=0.2]
    (A0) -- (X0) -- (X2) -- (Y2) -- (Y1) -- cycle ; % Top

    \draw[fill=red!20,opacity=0.6]
    (A0) -- (Y1) -- (Z1) -- (A1) -- cycle ; % Left up
    \draw[fill=red!20,opacity=0.6]
    (X2) -- (X0) -- (A2) -- (B2) -- (X3) -- (X2) ; % Front R
    \draw[fill=red!20,opacity=0.6]
    (Z1) -- (B1) -- (B3) -- (A3) -- (A1) -- (Z1) ; % Front L
    \draw[fill=red!20,opacity=0.6]
    (A0) -- (A1) -- (A3) -- (A2) -- (X0) -- cycle ; % Front up

    \draw[fill=red!20,opacity=0.4]
    (A2) -- (B2) -- (B3) -- (A3) -- cycle ; % Front

  \end{scope}

  %%%%%%%%

  % \LABELStrue %
  \ifLABELS

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

    \tiny

    %%%% ad hoc hacking...

    \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}

    % \NAMEStrue %
    \ifNAMES

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

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

    \else % \ifNAMES

    %%%%%%%% show the coordinates

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

    \foreach \XXX/\A/\B/\C/\D in \LCOORDINATES { %
      \node at (N\XXX) {\A\B\C\D} ; %
    }

    \fi % \ifNAMES

  \end{scope}

  \fi % \ifLABELS

  \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 387x227.

%% png creation (large size)

%%% pdflatex cube-3LL.tex
%%% pdftocairo -png -singlefile -r 361.35 -W 1626 -H 1034 -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: %% 1426x834+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.1-43 Q16-HDRI x86_64 22550 https://imagemagick.org
%%% OptiPNG version 0.7.7

%%%%%%%%

%%%% Created:
%%% 2026-03-10

%%%% Latest change:
%%% 2026-03-11 % yellow!80 -> white

%%%%%%%%
