[Xy-pic] On how diagxy calls XyPic

Ross Moore ross.moore at mq.edu.au
Wed Feb 6 22:49:51 CET 2019

Hello Eduardo,

On 3 Feb 2019, at 6:25 pm, Eduardo Ochs <eduardoochs at gmail.com<mailto:eduardoochs at gmail.com>> wrote:

Hi list,

this idea is on the frontier between diagxy and XyPic, but I thought
that this would be the best place to discuss it.

It seems you want to partially compile the diagxy coding
into the purely Xy-pic coding, on which it is based.

That’s a pretty tricky thing to do in full generality.

If we take a look at diagxy.tex, that in my machine is in this path,


we see that the high-level macro "\morphism" can be called with some
of its arguments omitted; it calls "\morphismp", that calls
"\morphismpp", that calls "\morphismppp", that calls "\morphismppp",
that call "\domorphism", and "\domorphism" has lots of "if"s and lots
of calls to XyPic. The first of them is:

  \POS(#1,#2)*+!!<0ex,\axis>{#7}\ar#4^-{#9} (\xend,\yend)*+!!<0ex,\axis>{#8}%

If we replace it by

  \XYPIC{\POS(#1,#2)*+!!<0ex,\Axis>{#7}\ar#4^-{#9} (\Xend,\Yend)*+!!<0ex,\Axis>{#8}}%

and do the same for all the other calls to XyPic, and define

    \def\POS       {POS }%
    \def\ar        {ar }%
    \def\labelstyle{labelstyle }%
    \def\beta      {beta }%
    \def\delta     {delta }%
    \def\phantom   {phantom }%

then we get this on stdout:

  POS (0,-675)*+!!<0ex,2.5pt>{X}ar @{->}@<2.5pt>@/^15pt/^-{f} (900,0)*+!!<0ex,2.5pt>{Y}
  POS (0,-675)*+!!<0ex,2.5pt>{X}ar @{->}_-{g} (900,0)*+!!<0ex,2.5pt>{Y}
  POS (900,0)*+!!<0ex,2.5pt>{Y}ar @{->}@<2.5pt>@/^15pt/^-{h} (1800,-675)*+!!<0ex,2.5pt>{Z}
  POS (900,0)*+!!<0ex,2.5pt>{Y}ar @{->}_-{i} (1800,-675)*+!!<0ex,2.5pt>{Z}
  POS (0,-675)*+!!<0ex,2.5pt>{X}ar @{->}@/^15pt/^-{k} (1800,-675)*+!!<0ex,2.5pt>{Z}
  POS (0,-675)*+!!<0ex,2.5pt>{X}ar @{->}|-*+<1pt,4pt>{labelstyle j}(1800,-675)*+!!<0ex,2.5pt>{Z}
  POS (0,-675)*+!!<0ex,2.5pt>{X}ar @{->}@<-15pt>|-*+<1pt,4pt>{labelstyle hf}(1800,-675)*+!!<0ex,2.5pt>{Z}
  POS (0,-675)*+!!<0ex,2.5pt>{X}ar @{->}@<-15pt>@/_15pt/|-*+<1pt,4pt>{labelstyle ig}(1800,-675)*+!!<0ex,2.5pt>{Z}
  POS (225,-337)*+!!<0ex,2.5pt>{phantom {O}}ar @{->}^-{beta } (450,-337)*+!!<0ex,2.5pt>{phantom {O}}
  POS (1350,-337)*+!!<0ex,2.5pt>{phantom {O}}ar @{<-}^-{delta } (1575,-337)*+!!<0ex,2.5pt>{phantom {O}}
  POS (900,-540)*+!!<0ex,2.5pt>{phantom {O}}ar @{<-}@<-15pt>_-{t} (900,-990)*+!!<0ex,2.5pt>{phantom {O}}
  POS (900,-652)*+!!<0ex,2.5pt>{phantom {O}}ar @{<-}@<15pt>^-{s} (900,-877)*+!!<0ex,2.5pt>{phantom {O}}

that is ALMOST the XyPic code that diagxy calls, except for the
missing backslashes - that I don't know how to add.

This can be done if you replace the directlua  call with TeX’s  \message
and use the following, with calls to the \string primitive:

% Print on stdout all the calls to XyPic.
  \edef\POS       {\string\POS }%
  \def\ar        {\string\ar }%
  \def\labelstyle{\string\labelstyle\space }%
  \def\beta      {\string\beta }%
  \def\delta     {\string\delta }%
  \def\phantom   {\string\phantom }%
%  \directlua{print("#1")}%

Using \edef  is slightly more efficient, since it produces the expansion with \string
only once, rather than every time \POS is called.
You can do this with all the macros that need to be expanded into letters.
Note also the need for a space after some of them, depending upon how they are used.

It’s such considerations that need to be taken into account, to be able to make this idea
fully general.

The code is here:


I needed this to be able to reproduce what you posted.

    Eduardo Ochs

Hope this helps.


Dr Ross Moore
Department of Mathematics and Statistics
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.moore at mq.edu.au<mailto:ross.moore at mq.edu.au>
[cid:image001.png at 01D030BE.D37A46F0]
CRICOS Provider Number 00002J. Think before you print.
Please consider the environment before printing this email.

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University. <http://mq.edu.au/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/xy-pic/attachments/20190206/5980d8fd/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4605 bytes
Desc: image001.png
URL: <https://tug.org/pipermail/xy-pic/attachments/20190206/5980d8fd/attachment-0001.png>

More information about the xy-pic mailing list