% (find-LATEX "2019xysyntax.tex")
% (defun c () (interactive) (find-LATEXsh "lualatex -record 2019xysyntax.tex" :end))
% (defun C () (interactive) (find-LATEXSH "lualatex 2019xysyntax.tex" "Success!!!"))
% (defun D () (interactive) (find-pdf-page      "~/LATEX/2019xysyntax.pdf"))
% (defun d () (interactive) (find-pdftools-page "~/LATEX/2019xysyntax.pdf"))
% (defun e () (interactive) (find-LATEX "2019xysyntax.tex"))
% (defun u () (interactive) (find-latex-upload-links "2019xysyntax"))
% (defun v () (interactive) (find-2a '(e) '(d)))
% (defun cv () (interactive) (C) (ee-kill-this-buffer) (v) (g))
% (defun d0 () (interactive) (find-ebuffer "2019xysyntax.pdf"))
%          (code-eec-LATEX "2019xysyntax")
% (find-pdf-page   "~/LATEX/2019xysyntax.pdf")
% (find-sh0 "cp -v  ~/LATEX/2019xysyntax.pdf /tmp/")
% (find-sh0 "cp -v  ~/LATEX/2019xysyntax.pdf /tmp/pen/")
%   file:///home/edrx/LATEX/2019xysyntax.pdf
%               file:///tmp/2019xysyntax.pdf
%           file:///tmp/pen/2019xysyntax.pdf
% http://angg.twu.net/LATEX/2019xysyntax.pdf
% (find-LATEX "2019.mk")
% (find-lualatex-links "2019xysyntax")
\documentclass[oneside]{article}
\usepackage[colorlinks,urlcolor=violet]{hyperref} % (find-es "tex" "hyperref")
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{xcolor}                % (find-es "tex" "xcolor")
%
% (find-dn6 "preamble6.lua" "preamble0")
\usepackage{proof}   % For derivation trees ("%:" lines)
\input diagxy        % For 2D diagrams ("%D" lines)
\xyoption{curve}     % For the ".curve=" feature in 2D diagrams
%
\usepackage{edrx15}               % (find-LATEX "edrx15.sty")
\input edrxaccents.tex            % (find-LATEX "edrxaccents.tex")
\input edrxchars.tex              % (find-LATEX "edrxchars.tex")
\input edrxheadfoot.tex           % (find-LATEX "edrxheadfoot.tex")
%
\begin{document}

\catcode`\^^J=10
\directlua{dofile "dednat6load.lua"}  % (find-LATEX "dednat6load.lua")

% \co: a low-level way to typeset code; a poor man's "\verb"
\def\co#1{{%
  \def\\{\char92}%
  \def\^{\char94}%
  \tt#1%
  }}
\def\qco#1{`\co{#1}'}
\def\qqco#1{``\co{#1}''}

\def\ang#1{\ensuremath{\langle\text{#1}\rangle}}







% (find-dn6 "treetex.lua" "unabbrev_tatsuta")

%L unabbrev_syntree = function (str)
%L     local body, star = str:match"^<(.*)>(%*?)$"
%L     if body then
%L       body = body:gsub("_", " ")
%L       if #star > 0 then star = "^*" end
%L       return format("\\langle\\text{%s}\\rangle%s", body, star)
%L     end 
%L     return "\\text{\\co{"..str:gsub("[\\{}_]", "\\%1").."}}"
%L   end
%L unabbrev_tatsuta = unabbrev_syntree
%L -- To deactivate the hack do:
%L -- unabbrev_tatsuta = unabbrev




\title{Notes on the \Xy-pic syntax}
\author{Eduardo Ochs}
\maketitle


\section{``Mixing \Xy-pic code''}
% (find-es "xypic" "mixing-xypic-code")

Section ``5.6. Mixing XY-pic code'' of \co{xypic/barrdoc.pdf} has this
chunk of \Xy-pic code intermixed with diagxy code (with another formatting):

\begin{verbatim}
\POS(1500,1000)*+!!<0ex,.75ex>{T_{n-1}}
\ar@{-}|!{(1000,500);(1500,500)}\hole(1167,334)
\POS(1167,334)
\ar|!{(1000,500);(1000,0)}\hole_<>(.6){h_{n-1}}
(500,0)*+!!<0ex,.75ex>{S_n}
\end{verbatim}


\subsection{First line}

Its first line is:

\begin{verbatim}
\POS(1500,1000)*+!!<0ex,.75ex>{T_{n-1}}
\end{verbatim}

Its parse tree is:
%:                                              
%:      1500       1000                         
%:    --------   --------               -------
%:  ( <factor> , <factor> )      +      <empty>   
%:  -----------------------   --------  -------    
%:      <vector>              <add_op>  <size>    
%:      --------              ----------------   
%:      <coord>                 <modifier>      <object>
%:      -------   --------------------------------------
%:        <pos> * <object>
%:        ----------------
%:         <coord>
%:         -------
%:   \POS   <pos>
%:   ------------
%:    <command>
%:
%:    ^command
%:
%:
%:                0ex      .75ex         T_{n-1}      
%:              -------   -------        -------      
%:            < <dimen> , <dimen> >   {  <text>   }   
%:            ---------------------   -------------
%:         !      <vector>            <objectbox>
%:         ---------------           ------------
%:      !       <modifier>            <object>
%:  ----------  ------------------------------
%:  <modifier>      <object>        
%:  ------------------------
%:       <object>
%:
%:       ^object1
%:
\pu
$$\ded{command}$$
$$\ded{object1}$$



\subsection{Second line}

Its second line is:

\begin{verbatim}
\ar@{-}|!{(1000,500);(1500,500)}
\end{verbatim}

Let's start by two subexpressions:
%:
%:                                      -
%:                                 ----------
%:                                 <connchar>
%:       -------       ----------  -----------  ----------
%:       <empty>       <tipchar>*  <connchar>*  <tipchar>*
%:       ---------     ----------  -----------  -----
%:    @  <variant>  {  <tip>         <conn>     <tip>  }
%:    --------------------------------------------------
%:          <form>
%:
%:          ^form1
%:
%:
%:         1000         500              
%:       --------     --------
%:    (  <factor>  ,  <factor>  )       1500          500
%:    ---------------------------      --------     --------
%:      <vector>                    (  <factor>  ,  <factor>  )
%:      --------                    ---------------------------
%:       <coord>                    <vector>
%:       -------     -----------------------
%:         <pos>  ;  <coord>
%:         -----------------
%:               <pos>      
%:               
%:               ^pos1       
%:
%:                                   -------
%:         (1000,500);(1500,500)     <empty>
%:         =====================     -------
%:   !  {  <pos>                  }  <slide>  ????
%:   ---------------------------------------  ----  -------  -------
%:         <place>                            <cs>  <empty>  <empty>
%:        --------                            ----  -------  --------
%:     |  <anchor>                            <it>  <alias>  <labels>
%:     --------------------------------------------------------------
%:     <labels>
%:   
%:     ^labels1
%:
\pu
$$\ded{form1}$$

$$\ded{pos1}$$

$$\ded{labels1}$$

I don't know what is a \ang{cs}, I'm guessing that it can expand to
\ang{empty}.

Then, if a \ang{pos} can expand to \ang{empty}, then:
%:
%:                      ????
%:                      -----    -------
%:          @{-}        <pos>    <empty>    |!{(1000,500);(1500,500)}
%:         =======   ----------  -------   =========================
%:         <form>    <path-pos>  <slide>   <labels>
%:         -------   ------------------------------
%:         <form>*   <segment>
%:         -------   ---------
%:    \ar  <arrow>   <path>
%:    ---------------------
%:      <\TeX{}_commands>
%:      -----------------
%:      <command>
%:
%:      ^command2
%:
\pu
$$\ded{command2}$$


%-- Revert:
%L unabbrev_tatsuta = unabbrev

% (find-xyreferpage  8 "Figure 1: hposiitions.")
% (find-xyrefertext  8 "Figure 1: hposiitions.")
% (find-xyreferpage 12 "Figure 3: hobjectis")
% (find-xyrefertext 12 "Figure 3: hobjectis")
% (find-xyreferpage 16 "Figure 4: hdecoriations")
% (find-xyrefertext 16 "Figure 4: hdecoriations")
% (find-xyreferpage 17 "Figure 5: Kernel library hdiriectionals")
% (find-xyrefertext 17 "Figure 5: Kernel library hdiriectionals")
% (find-xyreferpage 19 "Figure 6: hciricles")
% (find-xyrefertext 19 "Figure 6: hciricles")
% (find-xyreferpage 22 "Figure 7: Syntax for curves")
% (find-xyrefertext 22 "Figure 7: Syntax for curves")
% (find-xyreferpage 39 "Figure 14: hpathis")
% (find-xyrefertext 39 "Figure 14: hpathis")
% (find-xyreferpage 42 "Figure 15: harrowis")
% (find-xyrefertext 42 "Figure 15: harrowis")


\newpage

\section{Hyperlinks to the syntax tables in xyrefer.pdf}

A sexp like \co{(find-xyreferpage 8 "<pos>")} opens \co{xyrefer.pdf}
at page 8 using xpdf. See the section about ``elisp hyperlinks'' here
for the general idea:

\url{http://angg.twu.net/eev-intros/find-eev-quick-intro.html}

The \co{"<pos>"} is ignored.

I use this as an index for the \Xy-pic syntax.

{\scriptsize

\begin{verbatim}
;; (find-xyreferpage  8   "<pos>")
;; (find-xyreferpage  8   "<coord>")
;; (find-xyreferpage  8   "<vector>")
;; (find-xyreferpage  8   "<corner>")
;; (find-xyreferpage  8   "<place>")
;; (find-xyreferpage  8   "<slide>")
;; (find-xyreferpage  8 "Figure 1: <pos>itions.")
;;
;; (find-xyreferpage 12   "<object>")
;; (find-xyreferpage 12   "<objectbox>")
;; (find-xyreferpage 12   "<modifier>")
;; (find-xyreferpage 12   "<add op>")
;; (find-xyreferpage 12   "<size>")
;; (find-xyreferpage 12   "<direction>")
;; (find-xyreferpage 12   "<diag>")
;; (find-xyreferpage 12   "<composite>")
;; (find-xyreferpage 12 "Figure 3: <object>s.")
;;
;; (find-xyreferpage 16   "<decor>")
;; (find-xyreferpage 16   "<command>")
;; (find-xyreferpage 16 "Figure 4: <decor>ations.")
;;
;; (find-xyreferpage 19   "\\cir <radius> { <cir> }")
;; (find-xyreferpage 19   "<radius>")
;; (find-xyreferpage 19   "<cir>")
;; (find-xyreferpage 19   "<orient>")
;; (find-xyreferpage 19 "Figure 6: <cir>cles.")
;;
;; (find-xyreferpage 22   "\\curve <modifier> { <curve-object> <poslist> }")
;; (find-xyreferpage 22   "<modifier>")
;; (find-xyreferpage 22   "<curve-option>")
;; (find-xyreferpage 22   "<curve-object>")
;; (find-xyreferpage 22   "<poslist>")
;; (find-xyreferpage 22   "<delim>")
;; (find-xyreferpage 22 "Figure 7: Syntax for curves.")
;;
;; (find-xyreferpage 39   "\PATH <path>")
;; (find-xyreferpage 39   "\afterPATH { <decor> } <path>")
;; (find-xyreferpage 39   "<path>")
;; (find-xyreferpage 39   "<turn>")
;; (find-xyreferpage 39   "<turnradius>")
;; (find-xyreferpage 39   "<segment>")
;; (find-xyreferpage 39   "<slide>")
;; (find-xyreferpage 39   "<labels>")
;; (find-xyreferpage 39   "<anchor>")
;; (find-xyreferpage 39   "<it>")
;; (find-xyreferpage 39   "<alias>")
;; (find-xyreferpage 39 "Figure 14: <path>s")
;;
;; (find-xyreferpage 42   "\\ar <arrow> <path>")
;; (find-xyreferpage 42   "<arrow>")
;; (find-xyreferpage 42   "<form>")
;; (find-xyreferpage 42   "<variant>")
;; (find-xyreferpage 42   "<tip>")
;; (find-xyreferpage 42   "<tipchar>")
;; (find-xyreferpage 42   "<conn>")
;; (find-xyreferpage 42   "<connchar>")
;; (find-xyreferpage 42 "Figure 15: <arrow>s.")
\end{verbatim}

}



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

\end{document}



$\bfig
 \POS(1500,1000)*+
 !!<0ex,.75ex>{T_{n-1}}
 \ar@{-}|!{(1000,500);(1500,500)}\hole(1167,334)
 \POS(1167,334)\ar|!{(1000,500);(1000,0)}\hole_<>(.6){h_{n-1}}
  (500,0)*+!!<0ex,.75ex>{S_n}
 \efig
$

% \POS(1500,1000)*+
% !!<0ex,.75ex>{T_{n-1}}
% \ar@{-}|!{(1000,500);(1500,500)}\hole(1167,334)
% \POS(1167,334)\ar|!{(1000,500);(1000,0)}\hole_<>(.6){h_{n-1}}
%  (500,0)*+!!<0ex,.75ex>{S_n}




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