% (find-LATEX "2022tikzwd-2.tex")
% (defun c () (interactive) (find-LATEXsh "lualatex -record 2022tikzwd-2.tex" :end))
% (defun C () (interactive) (find-LATEXSH "lualatex 2022tikzwd-2.tex" "Success!!!"))
% (defun D () (interactive) (find-pdf-page      "~/LATEX/2022tikzwd-2.pdf"))
% (defun d () (interactive) (find-pdftools-page "~/LATEX/2022tikzwd-2.pdf"))
% (defun e () (interactive) (find-LATEX "2022tikzwd-2.tex"))
% (defun u () (interactive) (find-latex-upload-links "2022tikzwd-2"))
% (defun v () (interactive) (find-2a '(e) '(d)))
% (defun cv () (interactive) (C) (ee-kill-this-buffer) (v) (g))
% (defun d0 () (interactive) (find-ebuffer "2022tikzwd-2.pdf"))
%          (code-eec-LATEX "2022tikzwd-2")
% (find-pdf-page   "~/LATEX/2022tikzwd-2.pdf")
% (find-sh0 "cp -v  ~/LATEX/2022tikzwd-2.pdf /tmp/")
% (find-sh0 "cp -v  ~/LATEX/2022tikzwd-2.pdf /tmp/pen/")
%   file:///home/edrx/LATEX/2022tikzwd-2.pdf
%               file:///tmp/2022tikzwd-2.pdf
%           file:///tmp/pen/2022tikzwd-2.pdf
% http://angg.twu.net/LATEX/2022tikzwd-2.pdf
% (find-LATEX "2019.mk")
% (find-lualatex-links "2022tikzwd-2" "tw2")

%\documentclass[oneside,12pt]{article}
\documentclass[11pt,oneside,article]{memoir}
\usepackage[colorlinks,citecolor=red,urlcolor=red]{hyperref} % (find-es "tex" "hyperref")
\usepackage{colorweb}                 % (find-es "tex" "colorweb")
\usepackage{amsthm}
\usepackage{newpxtext}
\usepackage[varg,bigdelims]{newpxmath}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz}
%
\usepackage{edrx21}               % (find-LATEX "edrx21.sty")
\input edrxaccents.tex            % (find-LATEX "edrxaccents.tex")
\input edrx21chars.tex            % (find-LATEX "edrx21chars.tex")
%\input edrxheadfoot.tex           % (find-LATEX "edrxheadfoot.tex")

\usetikzlibrary{
	decorations.markings,
	positioning,
	calc,
	fit}

\tikzset{
   oriented WD/.style={%everything after equals replaces "oriented WD" in key.
      every to/.style={out=0,in=180,draw},
      label/.style={
         font=\everymath\expandafter{\the\everymath\scriptstyle},
         inner sep=0pt,
         node distance=2pt and -2pt},
      semithick,
      node distance=1 and 1,
      decoration={markings, mark=at position \stringdecpos with \stringdec},
      ar/.style={postaction={decorate}},
      execute at begin picture={\tikzset{
         x=\bbx, y=\bby,
         every fit/.style={inner xsep=\bbx, inner ysep=\bby}}}
      },
   string decoration/.store in=\stringdec,
   string decoration={\arrow{stealth};},
   string decoration pos/.store in=\stringdecpos,
   string decoration pos=.7,
   bbx/.store in=\bbx,
   bbx = 1.5cm,
   bby/.store in=\bby,
   bby = 1.5ex,
   bb port sep/.store in=\bbportsep,
   bb port sep=1.5,
   bb port length/.store in=\bbportlen,
   bb port length=4pt,
   bb penetrate/.store in=\bbpenetrate,
   bb penetrate=0,
   bb min width/.store in=\bbminwidth,
   bb min width=1cm,
   bb rounded corners/.store in=\bbcorners,
   bb rounded corners=2pt,
   bb  small/.style={bb port sep=1, bb port length=2.5pt, bbx=.4cm, bb min width=.4cm, bby=.7ex},
   bb medium/.style={bb port sep=1, bb port length=2.5pt, bbx=.4cm, bb min width=.4cm, bby=.9ex},
   bb/.code 2 args={%When you see this key, run the code below:
      \pgfmathsetlengthmacro{\bbheight}{\bbportsep * (max(#1,#2)+1) * \bby}
      \pgfkeysalso{draw,minimum height=\bbheight,minimum width=\bbminwidth,outer sep=0pt,
         rounded corners=\bbcorners,thick,
         prefix after command={\pgfextra{\let\fixname\tikzlastnode}},
         append after command={\pgfextra{\draw
            \ifnum #1=0{} \else foreach \i in {1,...,#1} {
               ($(\fixname.north west)!{\i/(#1+1)}!(\fixname.south west)$) +(-\bbportlen,0) 
               coordinate (\fixname_in\i) -- +(\bbpenetrate,0) coordinate (\fixname_in\i')}
            \fi 
            % Define the endpoints of tickmarks
            \ifnum #2=0{} \else foreach \i in {1,...,#2} {
               ($(\fixname.north east)!{\i/(#2+1)}!(\fixname.south east)$) +(-\bbpenetrate,0) 
               coordinate (\fixname_out\i') -- +(\bbportlen,0) coordinate (\fixname_out\i)}
            \fi;
         }}}
   },
   bb name/.style={append after command={\pgfextra{\node[anchor=north] at (\fixname.north) {#1};}}}
}


\tikzset{
      pack size/.store in=\psize,
      pack size = 8pt,
      spacing/.store in=\spacing,
      spacing = 8pt,
      link size/.store in=\lsize,
      pack color/.store in=\pcolor,
      pack color = blue,
      pack inside color/.store in=\picolor,
      pack inside color=blue!20,
      pack outside color/.store in=\pocolor,
      pack outside color=blue!50!black,
      surround sep/.store in=\ssep,
      surround sep=8pt,
      link/.style={
              circle, 
              draw=black, 
              fill=black,
              inner sep=0pt, 
              minimum size=\lsize
      },
}

% (find-es "tex" "geometry")
\usepackage[a6paper, landscape,
            top=1.5cm, bottom=.25cm, left=1cm, right=1cm, includefoot
           ]{geometry}
\begin{document}
\pagestyle{empty}

Some diagrams from:
{\footnotesize\par
\url{https://github.com/appliedcategorytheory/TikZWD}
}

\bsk

\begin{tikzpicture}
\begin{scope}[font=\footnotesize, text height=1.5ex, text depth=.5ex]
  \begin{scope}[oriented WD, bb port sep=1, bb port length=2.5pt, bb min width=.4cm,
                bby=.2cm, inner xsep=.2cm, x=.5cm, y=.3cm]
    \begin{scope}[color=red]
  	\node[bb={1}{1}] (Catf) {$f$};
  	\node[bb={1}{1}, right=1 of Catf] (Catg) {$g$};
  	\node[bb={0}{0}, fit=(Catf) (Catg)] (Cat) {};
  	\node[coordinate] at (Cat.west|-Catf_in1) (Cat_in1) {};
  	\node[coordinate] at (Cat.east|-Catg_out1) (Cat_out1) {};
  	\draw[shorten <=-2pt] (Cat_in1) -- (Catf_in1);
  	\draw (Catf_out1) -- (Catg_in1);
  	\draw[shorten >=-2pt] (Catg_out1) -- (Cat_out1);
    \end{scope}
    \begin{scope}[color=orange]
  	\node[bb={1}{2}, above right=-1.5 and 4 of Catf] (Monf) {$f$};
  	\node[bb={2}{1}, below right=-1 and 1 of Monf] (Mong) {$g$};
  	\node[bb={0}{0}, fit=(Monf) (Mong)] (Mon) {};
  	\node[coordinate] at (Mon.west|-Monf_in1) (Mon_in1) {};
  	\node[coordinate] at (Mon.west|-Mong_in2) (Mon_in2) {};
  	\node[coordinate] at (Mon.east|-Monf_out1) (Mon_out1) {};
  	\node[coordinate] at (Mon.east|-Mong_out1) (Mon_out2) {};
  	\draw[shorten <=-2pt] (Mon_in1) -- (Monf_in1);
  	\draw[shorten >=-2pt] (Monf_out1) -- (Mon_out1);
  	\draw (Monf_out2) to (Mong_in1);
  	\draw[shorten <=-2pt] (Mon_in2) -- (Mong_in2);
  	\draw[shorten >=-2pt] (Mong_out1) -- (Mon_out2);
    \end{scope}
  \end{scope}
  \node[below=.4 of Cat.south] (Cat name) {category};
  \node[text width=1.5cm] at (Cat name-|Mon) {monoidal category};
\end{scope}
\end{tikzpicture}


\GenericWarning{Success:}{Success!!!}  % Used by `M-x cv'

\end{document}

% Local Variables:
% coding: utf-8-unix
% ee-tla: "tw2"
% End:
