next up previous
Next: Same locations, different labels. Up: Detailed Example with Marked Previous: Fine Adjustment of Labels.

Subsections

Strategies for marking points.

The previous example shows how labels can be accurately positioned, using the locations of the marked points of the first example. The marked points are away from ``busy'' parts of the graphic. They indicate where labels can be placed near to that part of the image being labelled, but not interfere unduly with other parts of the image.

While this is an intuitive strategy for selecting places to be marked, it can mean that adjustments, by ``nudging'', are required to position the labels to best effect. Some trial-and-error is usually required before finalising the positions of all labels by choosing the best <factor>s.

Marking the busy places.

In many cases it is a better strategy to put marked anchor points much closer to the places to which the labels refer, rather than to where the labels themselves are desired. The next example we see the same image as previously, but with a different set of marked-points for the same labels. For this set it is sufficient to use just a new file (Fig5.4.1.bb2) for the labels while retaining the same file (Fig5.4.1.eps) for the image itself. Indeed that image is used 6 times in this paper, yet only one copy of the file is required.

Figure 6: Attaching labels by corners and edges to places near to what they refer.
\begin{figure}
\WARMprocessEPS{Fig541}{eps}{bb2}
\renewedcommand{labelmathstyle}...
...edMath +!L{5}
\xyMarkedMath +!UR{6}
\xyMarkedMath +!DL{7}
\end{xy}\end{figure}

\WARMprocessEPS{Fig5.4.1}{eps}{bb2}
\renewcommand{\labelmathstyle}{\scriptstyle}
\renewcommand{\labeltextstyle}{\footnotesize}
\begin{xy}
 \xyMarkedImport{}
\xyShowMarkPoints{*++[red][F-:red]@{*}}{-}
 \xyMarkedMath +!DR{1}
 \xyMarkedMath +++!D{2}
 \xyMarkedMath +!U{3}
 \xyMarkedTxt +!DL{4}
 \xyMarkedMath +!L{5}
 \xyMarkedMath +!UR{6}
 \xyMarkedMath +!DL{7}
\end{xy}

When the marked points are chosen this way, the labels can usually be well-positioned by specifying just margins, and an edge or corner to be where the reference point of the label should occur. There is little need for delicate ``nudging'' and <factor>s.

On the other hand, extreme accuracy is not at all necessary when choosing positions for the marked points. Indeed the .bb files for all the examples in this paper were generated using low-resolution preview images. In practice these are not accurately scaled-down versions of the higher resolution images rendered by POSTSCRIPT. The resulting inaccuracies can be accommodated using XY-pic adjustments.


Adjusting sizes and styles.

Another significant advantage of this strategy becomes apparent when the image or labels need to be resized or restyled, perhaps for use in a different context. This will almost certainly change the relative size of the labels and the image. Smaller-sized labels remain anchored to places near to what they refer. On the other hand, relatively larger labels can have been anchored so as to expand over portions of the image that are otherwise empty. In either case there may be no need to make any adjustments to the coding of labels.

Figure 7: Labels remain well-positioned with relative changes of scale.
\begin{figure}
\WARMprocessEPS{Fig541}{eps}{bb2}
\renewedcommand{labelmathstyl...
...edMath +!L{5}
\xyMarkedMath +!UR{6}
\xyMarkedMath +!DL{7}
\end{xy}\end{figure}

\WARMprocessEPS{Fig5.4.1}{eps}{bb2}
\renewcommand{\labelmathstyle}{\displaystyle}
\renewcommand{\labeltextstyle}
  {\large\bfseries\sffamily}
\begin{xy}
 \xyMarkedImport{}
 ...
 ... (same as previous) ...
 ...
\end{xy}

To LATEX or not to LATEX.

Although the above examples have used LATEX, the WARMreader macros work equally well with Plain-TEX, and most other formats, as does XY-pic. The only requirement is to be able to import the graphic, and customise the expansion of a single macro, \xyWARMinclude, to suit. This macro takes as argument the name of the image file. As a practical default, it expects to be able to use the \includegraphics command from LATEX's graphics package; e.g.


\def\xyWARMinclude#1{\includegraphics{#1}}


This definition can be overridden, by replacing the \includegraphics with \psfig or \epsfig or \epsfbox or whatever other command the user chooses, for placing imported graphics within the TEX or LATEX document.

There must be just a single argument for the filename. The result should be an \hbox of exactly the size required for the image to occupy. (This is so that \xyWARMinclude{<filename>} can be used as the argument to an \xyimport command.)

Note that some macros for including graphics are not suitable. For example, the \centerpicture macro from TEXTURES' picmacs.sty file cannot be used, since it puts stretchable `glue' to span the whole page-width; whereas \picture from the same file can be used.


Rotations and Scaling.

The requirements stated in the previous subsection allow scaling, rotating and resizing of imported graphics. For example, a rescaling can be achieved using LATEX as follows:


\newcommand{\scaledfig}[2]
  {\scalebox{#1}{\includegraphics{#2}}}
\renewcommand{\xyWARMinclude}[1]
  {\scaledfig{.7}{#1}}


It is only the image which is resized or rescaled; the size and style of labels is controlled independently, as discussed [*]sizstyle. When different images require different scale-factors, then the definition of \scaledfig belongs in the document preamble, and a re-definition of \xyWARMinclude should precede a figure, if needed. (See a later figure for an example.) Optional arguments to \includegraphics, or other command, can be incorporated in a similar way.


next up previous
Next: Same locations, different labels. Up: Detailed Example with Marked Previous: Fine Adjustment of Labels.
Ross Moore 1999-08-12