  %%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %%
 %%%%%   LabelFig.tex FOR LABELLING FIGURE INSERTS %%%%%
  %%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %%
 %%%  AUTHORS: Raymond S\'eroul and Laurent Siebenmann
  %%    A18645@FRCCSC21.bitnet and lcs@matups.matups.fr
  %%
 %%%  VERSIONS: July, October, December 1991
  %%
 %%%  PURPOSE:
  %%  Occasionally, figures imported into TeX lack some labels.
  %%  It may then be most appropriate to use TeX to provide
  %%  the labels.  Several macro sets, notably the 
  %%  LaTeX picture environment, provide means to insert 
  %%  labels.  LabelFig.tex is a macro set offering 
  %%  labelling capability for other TeX formats such
  %%  as Plain and AmSTeX. Unlike most graphics tools it is 
  %%  fast and of moderate size (costing about 1 Ko of main 
  %%  memory and 60 control sequences). Hopefully it will work 
  %%  in essentially all TeX environments.
  %%
 %%%  THE IDEA:
  %%  A grid is laid down on the figure, as in the LaTeX
  %%  picture environment, and the labels are then
  %%  located with respect to the grid.
  %%  There are two auxiliary devices that give this 
  %%  macro package a touch of novelty even for LateX users.
  %%  (a)  the grid appears on the preview/preprint.
  %%  For users with a fast preview this makes 
  %%  labeling an interactive process.
  %%  (b)  the grid is canonical, i.e. so naturally chosen
  %%  that labels will probably remain well placed
  %%  if the figure scale is changed.
  %% 
 %%%  MAIN POSTINGS : anonymous ftp
  %%  ---  ftp 129.69.1.12 (alias
  %%  rusinfo.rus.uni-stuttgart.de); login: anonymous;  
  %%  password: <anything>. 
  %%  ---  ftp 130.84.128.100 (alias rsovax.circe.fr);
  %%  login: anonymous; password: <anything>; directory
  %%  [anonymous.siebenmann]
  %%  ---  ftp 28.146.7.200 (alias shape.mps.ohio-state.edu);
  %%  login: anonymous;  password: <anything>; 
  %%  directory pub/osutex
  %%
 %%%% DOCUMENTATION:
  %%  --- see LabelFig.doc 
  %% (may be included at end, after \endinput)
  %%
 %%%% EXAMPLE OF USAGE:
  %%    \input \LabelFig.tex
  %%    \SetLabels
  %%      (.3*.7) first label\\
  %%         % center of baseline of the label
  %%         % will go to position .3 from left 
  %%         % and .7 from bottom
  %%      \L(.61*.333) $\Lambda_1\leq\Gamma$\\
  %%         % \L places left edge of label 
  %%         % (rather than the center)
  %%         % similarly use \R for right edge;
  %%         % and \B for bottom, \E for equator, and \T for top
  %%      \T\R(.3*.7) last label \\
  %%    \endSetLabels
  %%    \ShowGrid
  %%         % lays grid on figure to label; 
  %%         % delete for final printing
  %%    \AffixLabels{\BoxedEPSF{MyFigure}}
  %%         % argument of \AffixLabels#1 should be a TeX box;
  %%         % the grid will cover exactly that box.
  %%         % (Here \BoxedEPSF is the figure insertion macro
  %%         % of the package \BoxedEPS.tex (same sources) 
  %%         % for inserting encapsulated PostScript graphics. 
  %%         % But any other means of inserting 
  %%         % the figure can be used.)
  %%         


 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 %%%%% FORBID REREADING %%%%%
  %
  \ifx\LabelFigloaded\MYundefined\relax
  \else
    \message{ !!! LabelFig.tex ALREADY loaded !!!}
  \endinput\fi

  \def\LabelFigloaded{\relax}% now loaded

  %%% Beyond this point we use some control sequences
  %%% that are 'padlocked'  with @ of category 11

  \chardef\LabelFigCatAt\the\catcode`\@
  \catcode`\@=11

 %%temporarily suppress Plain's logging of allocations
 \let\LabelFigwlog@ld\wlog
 \def\wlog#1{\relax}

 \ifx\\\MYundefined@
    \let\\\relax
 \fi

 %%%%%%% end of preamble

  \def\ms@g{\immediate\write16}

 \def\N@wif{\csname newif\endcsname }
 \def\Temp@ {\N@wif\ifIN@}
 \ifx\INN@\MYundefined@
    \else \let\Temp@\relax
 \fi
 \Temp@

  %%% \IN@0#1@#2@ : Is 1st exp of #1 in 1st exp of #2 ??
   %% Answer in \ifIN@
  %\newif\ifIN@ %% conserve if's
  \def\IN@{\expandafter\INN@\expandafter}
  \long\def\INN@0#1@#2@{\long\def\NI@##1#1##2##3\ENDNI@
    {\ifx\m@rker##2\IN@false\else\IN@true\fi}%
     \expandafter\NI@#2@@#1\m@rker\ENDNI@}
  \def\m@rker{\m@@rker}
 
  %%%  \SPLIT@0#1@#2@  :  Split 1st exp of #2 at 1st exp of #1
   %%  \Initialtoks@ , \Terminaltoks@ will contain pieces
  \newtoks\Initialtoks@  \newtoks\Terminaltoks@
  \def\SPLIT@{\expandafter\SPLITT@\expandafter}
  \def\SPLITT@0#1@#2@{\def\TTILPS@##1#1##2@{%
     \Initialtoks@{##1}\Terminaltoks@{##2}}\expandafter\TTILPS@#2@}

   %%% \Shifted@@#1#2#3 puts #3 in \hbox
   %% leaves basepoint as is
   %% then translates ink only by dims #1,#2
   %% with Postscript convention
   %% For simplicity use only on scrunched boxes
 \def\Shifted@@#1#2#3{\setbox0=\hbox{#3}%
   \raise -\dp0\vbox {\kern-#2%
       \hbox {\kern#1\unhbox0\kern-#1}%
           \kern#2}}

 \newcount\gridcount
 \newbox\auxGridbox@ \newbox\hGridbox@ \newbox\vGridbox@
 \newbox\Labelbox@ \newbox\auxLabelbox@
 \newbox\Coordinatebox@
 \newtoks\Labeltoks@
 \newdimen\Wdd@ \newdimen\Htt@

 \def\hRule@{\advance\gridcount -2%
   \vskip-.2pt\hrule\vskip-.2pt\vfil
   \llap{\smash{\raise -2.5pt
     \hbox{.\number\gridcount\kern2pt}}}%
           \vskip-.2pt\hrule\vskip-.2pt\vfil}

 \def\vRule@{\advance\gridcount 2%
   \hskip-.2pt\vrule\hskip-.2pt\hfil
   \setbox\auxGridbox@=\vbox to 0pt
      {\vskip \Htt@\vskip 2pt
        \hbox{\kern-3.5pt.\number\gridcount}\vss}%
      \wd\auxGridbox@=0pt \box\auxGridbox@
   \hskip-.2pt\vrule\hskip-.2pt\hfil}

 \def\PlaceGrid@@{\gridcount=10%
  \setbox\hGridbox@=%
    \hbox{\hbox{\hskip-.4pt\vrule
             \vbox to \Htt@{\offinterlineskip\parindent=\z@\relax
                \vskip-.4pt\hrule\vfil
                \hRule@\hRule@\hRule@\hRule@
                  \vskip-.2pt\hrule\vskip-.2pt\vfil
                \hbox to \Wdd@{\hfil}%
             \hrule\vskip-.4pt}%
         \vrule\hskip-.4pt}}%
  \gridcount=0%
  \setbox\vGridbox@=
     \hbox{\vbox{\offinterlineskip\parindent=0pt\hsize=0pt
       \vskip-.4pt\hrule%
             \hbox to \Wdd@{%
                \hskip-.4pt\vrule\hfil
                \vtop to \Htt@{\vfil}%
                     \vRule@\vRule@\vRule@\vRule@
                     \hskip-.2pt\vrule\hskip-.2pt\hfil
             \vrule\hskip-.4pt}%
         \hrule\vskip-.4pt}}%
  %
  \wd\hGridbox@=0pt\ht\hGridbox@=0pt
  \wd\vGridbox@=0pt\ht\vGridbox@=0pt
  %
  \hbox{\box\hGridbox@\box\vGridbox@}%
  }

 \def\LabelsGlobal{\def\LabGl@b{\global}}
 \def\LabelsLocal{\def\LabGl@b{}}
 \LabelsGlobal %% default

 \def\SetLabels#1\endSetLabels{%
   \LabGl@b\Labeltoks@={#1()\\}%
   }

 \LabGl@b\Labeltoks@={()\\}

 \let\PlaceGrid@\relax
 \def\ShowGrid{\let\PlaceGrid@\PlaceGrid@@}

 \def\bAdjust@@{%
     \setbox\auxLabelbox@=\hbox{\raise \dp\auxLabelbox@
            \box\auxLabelbox@}}
 \def\bAdjust@{\let\vAdjust@\bAdjust@@}

 \def\eAdjust@@{\dimen0=-.5\ht\auxLabelbox@
     \advance\dimen0 by .5\dp\auxLabelbox@
     \setbox\auxLabelbox@=
            \hbox{\raise\dimen0\box\auxLabelbox@}}
 \def\eAdjust@{\let\vAdjust@\eAdjust@@}

 \def\tAdjust@@{%
     \setbox\auxLabelbox@=\hbox{\raise-\ht\auxLabelbox@
            \box\auxLabelbox@}}
 \def\tAdjust@{\let\vAdjust@\tAdjust@@}

 \let\vAdjust@\relax

 \def\lAdjust@{\let\hAdjust@\rlap}
 \def\rAdjust@{\let\hAdjust@\llap}

 \let\hAdjust@\relax\let\vAdjust@\relax

 \def\FetchLabel@#1(#2)#3\\{%
     \IN@0#2@@\ifIN@
        \setbox0=\hbox{\ignorespaces#1#3\unskip}%
        \ifdim\wd0>0pt
           \ms@g{}%
           \ms@g{ !!! Bad label(s)? !!!}%
           \message{ #1(#2)#3}%
        \fi
        \def\LabelMole@##1\endFetchLabel@{%
            \IN@0()\\@##1@%
            \ifIN@\def\Temp@{\FetchLabel@##1\endFetchLabel@}%
            \else\def\Temp@{}%
            \fi
            \Temp@
           }%
     \else
       \ignorespaces#1\unskip
       \setbox\auxLabelbox@=%
         \hbox to 0pt{\hss\ignorespaces\hAdjust@
          {\ignorespaces#3\unskip}\hss}%
       \vAdjust@
       \let\hAdjust@\relax\let\vAdjust@\relax
       \AugmentLabelBox@@{#2}%
       \ht\Labelbox@=0pt\dp\Labelbox@=0pt
       \let\LabelMole@\FetchLabel@%
     \fi\LabelMole@}

 \newtoks\XYSep@ %\XYSep@{*}
 \def\SetXYSeparator#1{%
     \IN@0#1@@\ifIN@\XYSep@{*}%
     \else
     \XYSep@{#1}%
     \fi
     }

 \SetXYSeparator*

 \def\AugmentLabelBox@@#1{%
     \IN@0\the\XYSep@ @#1@\ifIN@
       \SPLIT@0\the\XYSep@ @#1@%
       \setbox\Labelbox@=\hbox to 0pt{%
         \unhbox\Labelbox@
         \Shifted@@{\the\Initialtoks@\Wdd@}%
         {\the\Terminaltoks@\Htt@}%
         {\box\auxLabelbox@}}%
     \else
         \ms@g{}%
         \ms@g{ !!! Bad insertion point. !!!}%
         \message{ (#1\ this point was rejected.)}%
     \fi
    }
 

 \def\PlaceLabels@@{\bgroup\mathsurround=0pt%
     \def\Cr@{\\}%
     \let\L\lAdjust@\let\R\rAdjust@
     \let\B\bAdjust@\let\E\eAdjust@\let\T\tAdjust@
     \expandafter\FetchLabel@\the\Labeltoks@\endFetchLabel@
     \box\Labelbox@\egroup
     }%

 \let \PlaceLabels@\PlaceLabels@@

 \def\AffixLabels#1{\setbox\Coordinatebox@=\hbox{#1}%
      \Wdd@=\wd\Coordinatebox@ \Htt@=\ht\Coordinatebox@
      \advance\Htt@ \dp\Coordinatebox@
      \hbox{\copy\Coordinatebox@\kern-\Wdd@ 
           \Shifted@@{0pt}{-\dp\Coordinatebox@}%
            {\PlaceGrid@\PlaceLabels@}\kern\Wdd@}%
      \let\PlaceGrid@\relax
      \LabGl@b\Labeltoks@{()\\}%
      }
 
 %%% Restoring
   \let\wlog\LabelFigwlog@ld   %%restore logging
   \catcode`\@=\LabelFigCatAt  %%12 or 13

  \endinput

 %% end of  LabelFig.tex
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %% LabelFig.doc
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  %%
 %%%%%   LabelFig.tex FOR LABELLING TEX FIGURE INSERTS %%%%%
  %%
  %%                        DOCUMENTATION
  %%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
                                By

              Raymond S\'eroul <A18645@FRCCSC21.BITNET>
                                and 
              Laurent Siebenmann <lcs@matups.matups.fr>
    
                VERSIONS: July 1991, Oct 1991, Jan 1992


INTRODUCTION

      This labelling package is intended for TeX users who
rely on non-TeX sources for for their graphics inserts.  It
provides means for adding TeX labels to such inserts with a
minimum of fuss. 

       For most labels, TeX users have in the past found it
reasonably convenient to rely on non-TeX sources. Typical
occasions when an inescapable need for TeX labels seemed to
arise are

 (a) when the graphics program lacks certain exotic or complex
mathematical symbols
 (b) when the very highest typographical quality is wanted for the
labels

       Since this package first appeared, many users, who in the
past scarcely dreamed of using TeX labels, have come to use
nothing but.  So it is now appropriate to add

Intoxication Warning:  TeX labels may be addictive and expensive. 

     If you have a fast preview you may disagree, and even find
that this package provides an agreeable paste-up environment; see
extra applications at end.

     The authors are grateful to Patrick Ion of Math Reviews for
helpful comments and encouragement.


BASIC INSTRUCTIONS

    After reading in the macro file using

    \input LabelFig.tex

preview or proof your figure with a coordinate grid printed on
top, by typing the following:

    \ShowGrid  % without this the grid will be absent
    \AffixLabels{<the graphics insertion>}

Here <the graphics insertion> is what you would type to insert
the graphics object alone without the grid.  This must provide
for the space around it. For example <the graphics insertion>
might well be \BoxedEPSF{MyFigure scaled 700} using the
BoxedEPSF.tex macro package (from same source); this provides a
TeX box containing the encapsulated PostScript insert specified by
the file MyFigure. \AffixLabels{...} provides the grid (supposing
\ShowGrid is present) and later, once you have specified labels
using the grid, it will "tack on" the labels.

        The grid is a sort of (usually elongated) checkerboard of
ten rows and ten columns and its (internal) partitions are
numbered  .1, ... ,.9  both horizontally (X-coordinate running
left to right) and vertically (Y-coordinate running bottom to
top).  Thus the points enclosed by the grid correspond to the
points of the unit square in the cartesian "X-Y" plane, the lower
left corner corresponding to the origin (0,0).  By extrapolation,
the full page corresponds to a larger rectangle in the plane.

        These coordinates serve to position labels as follows.
Before the \AffixLabels{...} command type label specifications:

  \SetLabels
   (<X-coordinate>*<Y-coordinate>) <first label> \\
   .
   .
   .
   (<X-coordinate>*<Y-coordinate>)  <last label> \\
  \endSetLabels

Each row specifies one label and is terminated by \\.  In each
row, the position indicator comes first; it is written as a
standard cartesian point except that the X- and Y- coordinates
are separated by * rather than a comma because TeX allows a
comma as decimal point. There are no dimension units to specify
as the unit is the grid itself.

        By default, this cartesian point specifies where the middle
of the baseline of the label will be located.  However if you precede
the point by \L [or \R] the left [or right] edge of the baseline will
be located there. Similarly you may also precede the point by \T, \E,
or \B to vertically align the top equator or bottom of the label box
at the specified point.  This gives nine standard positions of
the label with respect to the insertion point --- corresponding to
the eight principle points of the compas and the center

                     \L\T     \T      \R\T

                     \L\E     \E      \R\E

                     \L\B     \B      \R\B

But this neglects the default "baseline" level of TeX,
giving potentially three more positions

                     \L    <no tag>   \R

For text, the baseline level is often the preferred. Its relation to
the others is variable. It will often coincide with the bottom level,
as happens for "X".  But it is often distinct, as for "g", in which
case you have in all 12 distinct positions rather than 9.

        It is convenient to think of this specification of label
position as attaching the label by a thumb-tack to the coordinate
grid. There are up to twelve positions of the thumb-tack on the
label, while the position of the thumb-tack on the coordinate grid is
arbitrary.  Normally, one choses the position of the thumb-tack on
the label to be the one that is the closest to the item being
labeled.  There are good reasons for this "rule of thumb":

   (a)  It facilitates correct positioning at first try.

   (b)  If the scale of the figure must be altered after labels
have been affixed, the labels have a good chance of remaining well
positioned.

   (c)  The visible grid need not extend beyond the "bounding box"
for the figure, because the best preferred position is always
(at least almost) within the bounding box .

The second reason is particularly important. Indeed it often
happens that scale has to be altered after labelling begins, in
order to either provide space for the labels, or to adjust
proportions between the labels and the figure.  (The size of labels
is unaffected by scaling.)

        Here is an artificial but self-contained test which uses
TeX rules to make a graphics object.

TEST

    Do not skip this!

 %%%%%%%%%%%%%%%%%%  --- cut
\input LabelFig

 %%%%%% useful ad hoc macros

 %%% \FrameIt#1 frames what it finds in #1
 \def\FrameIt#1{\hbox{\vrule$\vcenter {\hrule\kern3pt%
             \hbox {\kern3pt #1\kern3pt}%
               \kern3pt\hrule}$\vrule}}

 %%% \Caption#1#2 gives framed caption width #1
  %%  containing #2
 \def\Caption#1#2{\FrameIt{%
       \vtop {\hsize=#1\relax \parindent=0pt
         \leftskip=0pt \rightskip=0pt plus15pt
         \parfillskip=0pt
         \lineskip=1pt\baselineskip=0pt
         #2}}}

 \def\FirstQuadrant{\hbox to 100pt{\vrule\vbox to 100pt{%
        \hbox to 100pt{\hfil}\vfil\hrule}\hss}}

 %%% the test proper begins

  \SetLabels
    \R(.5*.2) $\zeta\,\cdot$\\
    (.9*-.10) $\xi$\\
    \R(-.03*.9) $\eta$\\
    \T(.5*.9) \Caption{70pt}{%
          \it The norm of
          $g(\xi+i\eta)$ is indicated on
          contours of this invisible surface.}\\
  \endSetLabels

  %\ShowGrid  % this makes the grid visible (once)
  \AffixLabels{\FirstQuadrant}

  \end

 %%%%%%%%%%%%%%%%%% --- cut

 
GETTING IT DOWN PAT

        Complicated labeling deserves the same respect as
complicated mathematics.  Do not expect it to come out perfect the
first time!  What is needed in either case is a mechanism to
repeatedly typeset troublesome pieces.

        One mechanism is always available.  One does complicated
labelling in a separate "test" file involving just the figure being
labelled;  a texpert will know how to \dump TeX's current state as
a temporary format that restarts rapidly at each retry.  Usually,
one then pastes the completed labelled figure back into the main
TeX file, but, of course, one can also \input it as an auxiliary
file.

        If you do not have a TeXpert at handy, here is a first
approximation to an efficient setup. By deletions reduce a copy
of your article to just a few lines before and after the figure.
Now label the figure, and finally, copy and paste the labelled
figure to the original article. Then copy the next figure to label
into this testbed and repeat. The TeXpert can improve the  speed
at which TeX starts up, by compiling a format specifically for
your article; just one caution: best NOT include in the format
ephemeral details of setup like \Set<mydriver>ArtSpecials (from
BoxedEPS.tex because this reads  figure dimensions which you may
change during your work session.

        An improved mechanism to repeatedly typeset troublesome
pieces is now available on the Macintosh; it is called LinoTeX;
see the same ftp sources.  It could be set up on many types
of computer.

        Before using LabelFig.tex to attach labels to a graphics
object inserted using BoxedEPSF.tex or BoxedArt.tex, make it a
firm rule to carefully adjust the bounding box using the trimming
commands of these packages, and also at least tentatively scale
and position the object. Beware of changing the grid inadvertently
after the labels have been positioned.  For example, correcting
the bounding box of a PostScript graphics object can foul up the
labels by changing the coordinate grid to which the labels are
attached. This is particularly true for the trimming  commands of
BoxedEPSF.tex and BoxedArt.tex; however, as noted already, change
of scale is much less disruptive, and modest adjustments should be
well tolerated.

        Sometimes the labels protrude so far from the bounding box
of a figure that the figure has to be repositioned.  Best do this
by ad hoc spacing, say using \hglue and \vglue; altering the
bounding box would create a vicious circle.

        Remember that you are responsible for preventing labels
from overlapping. You are responsible for all label typography
including size and style. A label is really just about anything
that can be put in a TeX box. Note that spaces at the beginning
and end of labels will normally be suppressed; if you really want
them you must protect them with TeX braces.

        This package temporarily sets the \mathsurround parameter
of TeX to zero  while the labels are being affixed. This is done
because nonzero \mathsurround space would influence the position
of left and right aligned labels; then, when a texpert or printer
modifies mathsurround, diagram labeling might be disastrously
altered. There is a small price to pay involving labels that are
formatted as caption boxes including mathematics: you  may want or
need to specify an explicit mathsurround space within the caption
box; it will not influence anything outside.

        Those hostile to the use of * as separator between
the X and Y coordinates of label insertion points, are free to
impose another using \SetXYSeparator{<the new separator>}.  
Americans may prefer "," to "*" since they never use a 
comma as a decimal point; but * may be more visible.


SOME EXOTIC APPLICATIONS

        The grid of LabelFig.tex is analogous to a light-table in
classical page makeup with wax or latex glue.  In principle you
can use it to compose any page from its indivisible parts.  This
even has some of the artisanal charm of classical paste-up
provided you have a fast screen preview to make the process
"interactive".

        In practice LabelFig.tex is a tool for nonstandard jobs.
Here are a few going beyond the labelling already discussed.


(I)  GRAPHICS INTEGRATION.

        This is accomplished by treating the imported graphics
objects as labels.  The underlying graphics object is then
typically an empty  \vbox to <dimension>{\vfill} in a TeX
\midinsert...\endinsert construction.  A label line
might be of the form

   (.1*.1) \special{... MyFigure ...}\\

The exact form of the special command varies from driver to
driver.  However, in the case of encapsulated PostScript graphics
(EPSF norn), by relying on \BoxedEPS.tex, one can have the
following standard syntax (independant of driver  (see
\BoxedEPS.doc for details.
  
  (.1*.1) \BoxedEPSF{MyFigure scaled <scale in mils>}\\

This may be slow since it requires TeX to read the PostScript
file to read bounding box using many complex macros.  So you
may want to try

  (.1*.1) \EPSFSpecial{MyFigure}{<scale in mils>}\\

which is fast and driver independant, but it squashes the
bounding box, normally to its lower left corner.

        Similarly for graphics of the Macintosh PICT norm ---
using \BoxedArt.tex (same sources) in place of \BoxedEPS.tex.

        This approach to integration is to be recommended when
one is assembling a composite graphics object.


 (II)  COMMUTATIVE DIAGRAM ENHANCEMENT

        Commutative diagrams or arrays of mathematical objects
connected by arrows of various sorts are common in mathematics.
The mathematical objects require the use of TeX.  Recently TeX
acquired a good collection of arrows of all slopes --- that of
LamSTeX --- plus pwerful macros to build the diagrams.

        However, even the LamSTeX collection is often
inadequate; it lacks for example double shafted arrows, dotted
arrows and curved arrows. Fortunately it is possible to produce
such arrows on an individual basis using sophisticated graphics
programs such as Illustrator and AldusFreehand (both serving
the EPSF norm) or using Metafont (with its public domain norm).
Since the creation of each new arrow is a work of love, you
probably want to limit the number of arrows by using LamSTeX
for most arrows. The 40K commutative diagram module of LamSTeX
has been adapted to work with AmSTeX and a copy may be posted
with LabelFig and related files. Unfortunately no one has yet
offered a version that works with Plain TeX or LaTeX.

       Suffice it here to say that when the exotic arrow has
been somehow imported into TeX, LabelFig.tex treats it as a
label that one affixes to the commutative diagram.  Two other
steps will be treated in separate notes, namely the matter of
extracting the dimension specifications for the arrow and the
construction of the arrow --- for these steps are far from
unique and often depend intimately on your computer environment. 
Notes for the Macintosh-Textures-Illustrator combination are
found in the file ExoticArrows.doc.


 (III) NESTING 

Ingenuity pays off in exploiting \LabelFig.tex. One can
mix graphics and typography quite freely.  \LabelFig.tex is good
for freeform or overlapping arrangements, while BoxedEPS.tex (or
BoxedArt.tex) is best for regimented non-overlapping
arrangements --- and the two can be combined.

        The default behavior of LabelFig.tex is not ideal 
for nesting objects, because to prevent trouble for beginners
the register for labels is globally cleared when \AffixLabels
concludes.  But there are switches available

      \LabelsGlobal      \LabelsLocal

which change this.  To understand this, extend the above test 
by something like:

 %%%%%%%%%%%%%%%%%% --- cut
 %%% Test extension

 \LabelsLocal
 %\LabelsGlobal

 \SetLabels
    (.5*.5) AAA\\
 \endSetLabels

 {%%% Watch for influence of braces!!
 \SetLabels
    (.5*.5) ZZZ\\
 \endSetLabels
   \AffixLabels{\FirstQuadrant}
 }

   \AffixLabels{\FirstQuadrant}

 %%%%%%%%%%%%%%%%%% --- cut

        There are however potential pitfalls.  Neither
\LabelFig.tex nor BoxedEPSF.tex has been tested under extreme
conditions. Problems may occur if their procedures are
indiscriminately nested. For BoxedEPSF.tex (not \LabelFig.tex)
there is a precise cause for worry, namely many of its
variables are "global", which means that TeX braces will not
provide the protection one might expect.
 

COMMAND SUMMARY FOR LabelFig.tex

  Here [...] means optional (one or zero)
        [...]* means any number of such constructs

  \SetLabels
    [[<P>](<X><Sep><Y>) <label> \\]*
  \endSetLabels
  \ShowGrid  % this makes the grid visible (once)
  \AffixLabels{<the figure>}

   --- <P> is tack position, one of eight or empty
              order irrelevant

                   \L\T      \T    \R\T

                      \L               \R

                     \L\B      \B    \R\B

   --- (<X><Sep><Y>) insertion point;
  <Sep> is separator = * by default;
  \SetXYSeparator{<Sep>} changes it.
   <X> and <Y> are real numbers

  --- <label> a label to attach 

  --- <the figure> the figure to label 

  \GlobalLabelClearing (default)     
  \LocalLabelClearing  setting for nested constructs.



Address for bugs and other feedback:

        Raymond S\'eroul
        IREM and Lab. de Typographie Informatise
        Univ. Rene Descartes
        Strasbourg

    Tel 33-88-41-63-45
    Email:  A18645@FRCCSC21.BITNET


        Laurent Siebenmann
        Mathematique, Bat. 425,
        Univ de Paris-Sud,
        91405-Orsay,
        France

    Tel 33-1-6941-7949; 
    Fax number: 33-1-6941-6221
    Email: lcs@matups.matups.fr  
