%% 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.  One takes the inherited Euclidean metric on H and
%%%%% projects orthogonally to the plane { y = 0 } along (1,-3,1,1).
%%%%% The distance of a vertex from the plane is y times 2/\sqrt{3}
%%%%% (=1.15470).  The plane { y = 1 } contains the pentagon
%%%%%
%%%%%              2134 - 2161 - 4141
%%%%%                 \          /
%%%%%                 3124 -- 4123
%%%%%

%%%%% Orthogonal projections to other faces (up to parallels and the
%%%%% symmetry xyzt<->tyzx) have various collapses and edge overlaps.
%%%%% Presenting understandable drawings is more complicated.
%%%%% Formulas for the essentially 4 cases can be found below.

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

%%%%%%%%

\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,decorations.markings}

\begin{document}
\thispagestyle{empty} %

\centerline{%

  \tikzpicture %

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

  \def\RTHREE{1.7320508} % \sqrt{3}

  \iftrue %
  % \else %
  %%%% projection to face A1-A3-B3-B1-Z1
  \foreach \NNN/\x/\y/\z/\t in \LCOORDINATES { %

    %%% 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
    \coordinate (\NNN) at ($(
                {(-\x+2*\z-\t)/\RTHREE}, %
                {\t-\x} %
                )$) ; }
  \fi %

  \iftrue %
  \else %
  %%%% projection to A_2 (and its parallel), collapsing line A2-B0
  \foreach \NNN/\x/\y/\z/\t in \LCOORDINATES { %

    %%% orthogonal projection with
    %%%%           A3-A1 = (1,0,-1,0)  -> (2\sqrt{3},0)
    %%%% (2X0-(A3+A2))/3 = (-1,2,-1,0) -> (0,6)
    %%%%           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 12,36,0
    \coordinate (\NNN) at ($(
                {\RTHREE*(\x-\z)}, %
                {-\x+2*\y-\z} %
                )$) ; }
  \fi %

  \iftrue %
  \else %
  %%%% projection to rectangle A2-A3-B3-B2, collapsing the other
  %%%% rectangles to lines
  \foreach \NNN/\x/\y/\z/\t in \LCOORDINATES { %

    %%% 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
    \coordinate (\NNN) at ($(
                {\z-\y}, %
                {\t-\x} %
                )$) ; }
  \fi %

  \iftrue %
  \else %
  %%%% 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
  \foreach \NNN/\x/\y/\z/\t in \LCOORDINATES { %

    %%% 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
    \coordinate (\NNN) at ($(
                {\z-\t}, %
                {\y-\x} %
                )$) ; }
  \fi %

  %%%%%%%%

  %%%% 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) (B0) ; %

  %%%%%%%%

  %% edges are drawn twice

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

  \begin{scope} [blue,semithick]

    \draw[fill=red!10]
    (X0) -- (A2) -- (B2) -- (X3) (X3) -- (X2) -- (X0) ; % Back Left
    \draw[fill=red!10]
    (Y1) -- (A0) -- (X0) -- (X2) -- (Y2) -- (Y1) ; % Back Right

    \draw[fill=blue!30]
    (Y2) -- (X2) -- (X3) -- (B0) -- cycle ; % Rectangle Back
    \draw[fill=blue!30]
    (Y1) -- (Y2) -- (B0) -- (B1) -- (Z1) -- cycle ; % Bottom Right

    \draw[fill=green!50,opacity=0.8]
    (B1) -- (B0) -- (X3) -- (B2) -- (B3) -- (B1) ; % South Left

    \draw[fill=red!20,opacity=0.8]
    (A1) -- (Z1) -- (B1) -- (B3) -- (A3) -- cycle ; % Front
    \draw[fill=red!20,opacity=0.8]
    (A0) -- (Y1) -- (Z1) -- (A1) -- cycle ; % Rectangle Right
    \draw[fill=red!20,opacity=0.8]
    (A2) -- (B2) -- (B3) -- (A3) -- cycle ; % Rectangle Left

    \draw[fill=green!50,opacity=0.8]
    (A0) -- (A1) -- (A3) -- (A2) -- (X0) -- cycle ; % North Left

  \end{scope}

  %%%%%%%%

  %% arrows

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

  \foreach \XXX/\YYY in {%
    Y1/Y2,Y2/B0,X0/X2,X2/X3,A2/B2,A3/B3} { %
    \path[midtip,black!50] (\XXX) -- (\YYY) ; } %

  \foreach \XXX/\YYY in {%
    A0/Y1,A1/Z1,Z1/B1,A2/B2,A3/B3} { %
    \path[midtip,black] (\XXX) -- (\YYY) ; } %

  %%%%%%%%

  % \LABELStrue %
  % \NAMEStrue %
  \ifLABELS

  %%%% from cube-4-84.tex
  \tikzset{
    labelbox/.style={ %
      fill=white,fill opacity=0.6, %
      draw,text opacity=1, %
      inner sep=7/3pt}, %
  }

  \ifNAMES % show the names of the vertices

  \def\Label#1{$\tt\scriptscriptstyle#1$}

  \foreach \XXX/\UNUSED in \LCOORDINATES { %
    \node[labelbox] at (\XXX) {\Label\XXX} ; %
  }

  \else % show the coordinates

  \def\Label#1{$\scriptscriptstyle#1$}

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

  \fi\fi %

  \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 517x357.

%% png creation (large size)

%%% pdflatex cube-3LO.tex
%%% pdftocairo -png -singlefile -r 361.35 -W 1438 -H 1059 -x 817 -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: %% 1238x859+917+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.1-43 Q16-HDRI x86_64 22550 https://imagemagick.org
%%% OptiPNG version 0.7.7

%%%%%%%%

%%%% Created:
%%% 2026-03-14

%%%% Latest changes of images:
%%% 2026-03-20 % tiny rendering change

%%%% Latest code changes:
%%% 2026-03-20 % \iftrue\else\fi wrappers for the other projections

%%%% Latest comment changes:
%%% 2026-03-20 % improve description of the projection

%%%%%%%%
