%% to be compiled with pdflatex

\documentclass{amsart}

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

\DeclareFixedFont{\TMfontA}{OMS}{cmsy}{m}{n}{10.95}
\DeclareFixedFont{\TMfontB}{OMS}{cmsy}{m}{n}{12}
\DeclareFixedFont{\TMfontC}{OMS}{cmsy}{m}{n}{14.4}

\newlength{\TypewriterEnskip}

\begin{document}

\thispagestyle{empty}

\newif\ifSKIPRULES

\tikzset{
  every path/.style={red,draw=blue,fill=green},
  every edge/.style={draw=black,opacity=0.5},
}

\long\def\extrabox#1 | #2|#3|#4{

  \setbox0\hbox{#4}

  \setbox0\hbox{#2%
    \vbox to 0pt{#3

      \ifSKIPRULES

      \ht0=0pt
      \box0

      \else

      \setbox1\vbox{
        \offinterlineskip
        \setbox1\vbox to 0pt{\vss \hrule width \wd0 \vss}
        \vbox to 0pt{\vss \copy1 \vskip\ht0}
        \vbox to 0pt{\vskip\dp0 \copy1 \vss}
        \box1
        \setbox1\hbox to 0pt{\hss \vrule height \ht0 depth \dp0 \hss}
        \ht1=0pt \dp1=0pt
        \hbox{\hskip\wd0 \copy1}
        \box1
      }

      \ht0=0pt \dp0=0pt
      \box0

      \unvbox1

      \fi

      \vss
    }%
  }

  \ifdim\hsize<\wd0 \hsize=\wd0 \fi

  \vskip-\baselineskip
  \unhbox0

}

\def\TTthick{semithick}

\def\overharpoon#1{%
  \vbox{
    \setbox0\hbox{#1}
    \hbox{%
      \begin{tikzpicture} [trim left,trim right=0]
        \draw[\TTthick,arrows={-Straight Barb[harpoon]}]
        (0,0) -- (\wd0,0) ;
      \end{tikzpicture}%
    }
    \nointerlineskip
    \vskip1.2pt
    \box0
  }%
}

\def\TTto{%
  \hbox to 3\tten{%
    \hss
    \begin{tikzpicture} [baseline=-55/18pt+0.2pt]
      \draw[\TTthick,-Straight Barb] (0,0) -- (2\tten,0) ;
    \end{tikzpicture}%
    \hss
  }%
}

\def\TTsubscript#1{$\scriptspace=0pt _{\hbox{#1}}$}

\def\dottedbox{%
  \begin{tikzpicture} [trim left,baseline=-55/18pt]
    \fill[x=45/16pt,y=45/16pt,radius=0.5pt,draw=none]
    foreach \x in {0,28} { foreach \y in {-4,...,4} { (\x,\y) circle[] }}
    foreach \y in {-4,4} { foreach \x in {1,...,27} { (\x,\y) circle[] }}
    ;
  \end{tikzpicture}%
}

\tikzset{LatexF/.tip={Latex[sep=-4pt]}}

\def\ARROW#1#2{
  \draw let
  \p0=($(#1)!0.55!(#2)$) in
  (#1) edge[-LatexF] (\p0) (\p0) -- (#2) ;
}
\def\ARROWDASHED[#1]#2#3{
  \begin{scope} [#1]
    \draw let
    \p0=($(#2)!0.55!(#3)$),
    \p1=($(\p0)!-6pt!(#2)$) in
    (#2) edge[-LatexF] (\p0) (\p1) -- (#3) ;
  \end{scope}
}

\def\BULLET#1{
  \fill[draw=none] (#1) circle[radius=1.4pt] ;
}
\def\BULLETX[#1]#2{
  \begin{scope} [#1] \BULLET{#2} \end{scope}}

\def\TMCaptionClearA{1.095*8pt}
\def\TMCaptionClearB{1.2*8pt}
\def\TMCaptionClearC{1.44*8pt}

\def\showTMCaptionA{
  \node[below=\TMCaptionClearA,inner ysep=0pt] at (current bounding box.base)
       {\TMCaption\TMfontA2} ; }

\def\showTMCaptionB{
  \node[below=\TMCaptionClearB,inner ysep=0pt] at (current bounding box.base)
       {\TMCaption\TMfontB3} ; }

\def\showTMCaptionC#1{
  \node[below=\TMCaptionClearC,inner ysep=0pt] at (#1.base)
       {\TMCaption\TMfontC4} ; }

\def\TMCaption#1#2{
  \setbox0\hbox{#1 M}%
  \begin{tikzpicture} [trim left,trim right=0,baseline=-\ht0/2]
    \draw[densely dotted,dash phase=-1pt,dash expand off,black] (0,0) -- (\wd0+\tten,0) ;
  \end{tikzpicture}%
  \box0\TTsubscript{#2}}

\tikzset{outer sep=0pt}

\tt

\parindent=0pt

\let\tten\TypewriterEnskip
\tten=5.25pt

\let\bs\baselineskip
\bs=10.97pt

\catcode`\?=\active
\let?=\ \relax

\vphantom{X}

\hsize=0pt

\extrabox top line | | | {%
  \hskip33.5\tten
  -?\S
  ?1?-%
  \hskip30.5\tten
  -?12?-%
}

\extrabox 1-2 | \hskip18.5\tten | \vskip5\bs \vskip-2.2pt \SKIPRULEStrue | {%
  \begin{tikzpicture} [trim left,baseline=0]
    \draw[cyan!50]
    foreach \X in {0,1,2,16,17,18}
    { (\X\tten,55/9pt) -- (\X\tten,-3\bs-5.6pt) }
    ;
  \end{tikzpicture}%
}

\extrabox 1 | \hskip18.5\tten | \vskip5\bs \vskip-2.2pt | {%

  \begin{tikzpicture} [trim left,trim right=0,baseline=-55/18pt]
    \draw[densely dotted,black!50] (0,0) -- (21\tten,0) ;
  \end{tikzpicture}%

  \overharpoon{A0}\TTsubscript{2}%

  ?:?%

  \rlap{?a(bc)\TTto(ab)c}%

  \dottedbox

}

\extrabox 2 | \hskip19.5\tten | \vskip8\bs \vskip3.4pt | {%
  \begin{tikzpicture} [trim left,baseline=(11)]

    \coordinate (11) at (0,0) ;
    \coordinate (20) at (16\tten,0) ;

    \ARROW{11}{20} ;

    \BULLET{11} ;
    \BULLET{20} ;

    \showTMCaptionA

    \node[above] at (11) {11} ;
    \node[above] at (20) {20} ;

  \end{tikzpicture}%
}

\extrabox 3 | \hskip23.5\tten \hskip0.6pt | \vskip266pt | {%
  \begin{tikzpicture} [trim left,baseline=(210),x=1pt,y=1pt]

    \coordinate (201) at (0,110.2) ;
    \coordinate (300) at (-59.25,71.2) ;
    \coordinate (210) at (-37.25,0) ;
    \coordinate (111) at ([xscale=-1] 300) ;
    \coordinate (120) at ([xscale=-1] 210) ;

    \foreach \XXX/\YYY in {
      201/300, 210/300, 120/210, 111/120, 111/201}
    \ARROW\XXX\YYY ;

    \foreach \XXX in {
      201, 300, 210, 111, 120}
    \BULLET\XXX ;

    \showTMCaptionB

    \node[above] at (201) {201} ;
    \node[left] at (300) {300} ;
    \node[left] at (210) {210} ;
    \node[right] at (111) {111} ;
    \node[right] at (120) {120} ;

  \end{tikzpicture}%
}

\extrabox 4 | \hskip58\tten \hskip2pt | \vskip155pt | {%
  \begin{tikzpicture} [trim left,baseline=(1120),x=1pt,y=1pt]

    \coordinate (3010) at (0,114.1) ;
    \coordinate (1201) at (0,-87.9) ;

    \coordinate (4000) at (0,90.4) ;
    \coordinate (3001) at (-41.4,35.3) ;
    \coordinate (2101) at (0,-21.2) ;

    \coordinate (2020) at (-71.3,71.9) ;
    \coordinate (2011) at (-102.3,16.2) ;
    \coordinate (1120) at (-46.1,0) ;
    \coordinate (1111) at (-75.7,-51.3) ;

    \coordinate (3100) at ([xscale=-1] 3001) ;
    \coordinate (2110) at ([xscale=-1] 2020) ;
    \coordinate (2200) at ([xscale=-1] 2011) ;
    \coordinate (1210) at ([xscale=-1] 1120) ;
    \coordinate (1300) at ([xscale=-1] 1111) ;

    \foreach \XXX/\YYY in {
      3010/4000,
      3001/4000, 3100/4000,
      2011/3001, 2200/3100,
      2101/3001, 2101/3100,
      1201/2101}
    \ARROWDASHED[dashed,gray]\XXX\YYY ;

    \foreach \XXX/\YYY in {
      1120/2020, 1210/2110,
      1120/1210,
      1111/1120, 1210/1300,
      2020/3010, 2110/3010,
      2011/2020, 2110/2200,
      1111/2011, 1300/2200,
      1111/1201, 1201/1300}
    \ARROW\XXX\YYY ;

    \foreach \XXX in {
      4000, 3001, 3100, 2101}
    \BULLETX[gray]\XXX ;

    \foreach \XXX in {
      1120, 1210,
      3010,
      2020, 2011, 1111,
      2110, 2200, 1300,
      1201}
    \BULLET\XXX ;

    \node[above] at (3010) {3010} ;
    \node[below] (1201N) at (1201) {1201} ;

    \node[above left,xshift=4] (2020N) at (2020) {2020} ;
    \node at ([xscale=-1] 2020N) {2110} ;

    \node[left] (2011N) at (2011) {2011} ;
    \node[inner xsep=0pt] at ([xscale=-1] 2011N) {2200} ;

    \node[below left,xshift=4] (1111N) at (1111) {1111} ;
    \node at ([xscale=-1] 1111N) {1300} ;

    \node[right,yshift=1.2] at (4000) {4000} ;
    \node[below right,yshift=4] at (2101) {2101} ;

    \node[right=1.6] (3001N) at (3001) {3001} ;
    \node at ([xscale=-1] 3001N) {3100} ;

    \node[below right,xshift=-3.8] at (1120) {1120} ;
    \node[right,yshift=0.6] at (1210) {1210} ;

    \showTMCaptionC{1201N}

  \end{tikzpicture}%
}

\leavevmode

???1- ab

??11- a(bc)

??20- (ab)c

?111- a(b(cd))

?120- a((bc)d)

?201- (ab)(cd)

?210- (a(bc))d

?300- ((ab)c)d

1111-a(b(c(de)))

1120-a(b((cd)e))

1201-a((bc)(de))

2011-(ab)(c(de))

2020-(ab)((cd)e)

.?.?.?.?.?.?.?.

\vskip11\bs

\hskip36.5\tten
Fig.?1

\end{document}
