% (find-angg "LATEX/2019diagxyhack.tex")
% (defun c () (interactive) (find-LATEXsh "lualatex -record 2019diagxyhack.tex"))
% (defun d () (interactive) (find-xpdfpage "~/LATEX/2019diagxyhack.pdf"))
% (defun e () (interactive) (find-LATEX "2019diagxyhack.tex"))
% (defun u () (interactive) (find-latex-upload-links "2019diagxyhack"))
% (find-xpdfpage "~/LATEX/2019diagxyhack.pdf")
%   file:///home/edrx/LATEX/2019diagxyhack.pdf
% http://angg.twu.net/LATEX/2019diagxyhack.pdf
\documentclass[oneside]{book}
\usepackage[colorlinks]{hyperref}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{pict2e}
\usepackage{xcolor}
%
\input diagxy
\xyoption{curve}
%
\begin{document}

% See:
% https://tug.org/pipermail/xy-pic/2019-February/000808.html

% (find-es "diagxy" "how-diagxy-calls-xypic")
% (find-tlfile "texmf-dist/tex/generic/barr/diagxy.tex")
% (find-tlfile "texmf-dist/tex/generic/barr/diagxy.tex" "\\def\\domorphism")
% (setq last-kbd-macro (kbd "C-a M-f 4*<left> \\ XYPIC{ C-e <left> } C-a <down>"))

\def\domorphism(#1,#2)|#3|/#4/<#5,#6>[#7`#8;#9]{%
 % Check if arrow arg has an @; then don't add it.%
\def\next{\car#4.\nil}%
\if@\next\relax%
 \if#3l%
  \ifnum #6>0%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar#4^-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \else%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar#4_-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \fi%
 \else \if#3m%
    \setbox0\hbox{$#9$}%
   \ifdim \wd0=0pt%
     \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar#4 (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
   \else%
     \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar#4|-*+<1pt,4pt>{\labelstyle#9}%
       (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
   \fi%
 \else \if#3r%
  \ifnum #6<0%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar#4^-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \else%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar#4_-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \fi%
 \else \if#3a%
  \ifnum #5>0%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar#4^-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \else%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar#4_-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \fi%
 \else \if#3b%
  \ifnum #5<0%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar#4^-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \else%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar#4_-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \fi%
 \else%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar#4 (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
 \fi\fi\fi\fi\fi%
 %% Otherwise, have to add @{..}%
\else%
 \if#3l%
  \ifnum #6>0%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar@{#4}^-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \else%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar@{#4}_-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \fi%
 \else \if#3m%
    \setbox0\hbox{$#9$}%
   \ifdim \wd0=0pt%
     \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar@{#4} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
   \else%
     \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar@{#4}|-*+<1pt,4pt>{\labelstyle#9}%
         (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
   \fi%
 \else \if#3r%
  \ifnum #6<0%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar@{#4}^-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \else%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar@{#4}_-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \fi%
 \else \if#3a%
  \ifnum #5>0%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar@{#4}^-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \else%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar@{#4}_-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \fi%
 \else \if#3b%
  \ifnum #5<0%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar@{#4}^-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \else%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar@{#4}_-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
  \fi%
 \else%
   \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar@{#4} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%
 \fi\fi\fi\fi\fi%
\fi\ignorespaces}%

% This definition shifts the diagram to the right!!! Why?
\def\XYPIC#1{{%
  \def\Axis{\axis}%
  \def\Xend{\xend}%
  \def\Yend{\yend}%
  #1%
}}

% Print on stdout all the calls to XyPic.
\def\XYPIC#1{{%
  \def\POS       {POS }%
  \def\ar        {ar }%
  \def\labelstyle{labelstyle }%
  \def\beta      {beta }%
  \def\delta     {delta }%
  \def\phantom   {phantom }%
  \def\Axis{\the\axis}%
  \def\Xend{\the\xend}%
  \def\Yend{\the\yend}%
  \directlua{print("#1")}%
}}

% Use this to typeset the original diagram.
\def\XYPIC#1{%
  \def\Axis{\axis}%
  \def\Xend{\xend}%
  \def\Yend{\yend}%
  #1%
}


$$\bfig
  \morphism(0,-675)|a|/{@{->}@<2.5pt>@/^15pt/}/<900,675>[{X}`{Y};{f}]
  \morphism(0,-675)|b|/->/<900,675>[{X}`{Y};{g}]
  \morphism(900,0)|a|/{@{->}@<2.5pt>@/^15pt/}/<900,-675>[{Y}`{Z};{h}]
  \morphism(900,0)|b|/->/<900,-675>[{Y}`{Z};{i}]
  \morphism(0,-675)|a|/{@{->}@/^15pt/}/<1800,0>[{X}`{Z};{k}]
  \morphism(0,-675)|m|/->/<1800,0>[{X}`{Z};{j}]
  \morphism(0,-675)|m|/{@{->}@<-15pt>}/<1800,0>[{X}`{Z};{hf}]
  \morphism(0,-675)|m|/{@{->}@<-15pt>@/_15pt/}/<1800,0>[{X}`{Z};{ig}]
  \morphism(225,-337)|a|/->/<225,0>[{\phantom{O}}`{\phantom{O}};{\beta}]
  \morphism(1350,-337)|a|/<-/<225,0>[{\phantom{O}}`{\phantom{O}};{\delta}]
  \morphism(900,-540)|l|/{@{<-}@<-15pt>}/<0,-450>[{\phantom{O}}`{\phantom{O}};{t}]
  \morphism(900,-652)|r|/{@{<-}@<15pt>}/<0,-225>[{\phantom{O}}`{\phantom{O}};{s}]
  \efig
$$

$$\bfig
  \morphism(1200,0)/{@{>}@`{c,(-300,0),(-600,2400),p}}/<-1200,2800>[
    t_D(h(gf))`(h(gf))t_A;t_h(gf)]
  \efig
$$

$$\bfig
  \POS (1200,0)*+!!<0ex,2.5pt>{ t_D(h(gf))}
  \ar  @{>}@`{c,(-300,0),(-600,2400),p}_-{t_h(gf)}
       (0,2800)*+!!<0ex,2.5pt>{(h(gf))t_A}
  \efig
$$



\end{document}

% Local Variables:
% coding: utf-8-unix
% End:
