The next examples show labelled images that one of the authors has used
for teaching elementary mathematics.
They were constructed using the Mathematica[9] software package
and saved in Encapsulated POSTSCRIPT
format.
In fact there is more than one way to do this with Mathematica[9],
which can produce .eps files having quite different
structure and properties.
The first example is in direct analogy with techniques discussed already.
With later examples,
we discuss extra considerations that apply when the .eps file
contains an %%AspectRatio comment.
A special feature of the Mathematica[9] Front-End software, is that it allows ``point-&-click'' on graphic images to obtain coordinates of the points clicked1, in the coordinate system used to calculate the contents of the image. This feature was exploited in creating data files for the remaining examples. They were given the extension .mbb to indicate the origin and nature of their contents.
\WARMprocessMMA{Q1}{\graphext}{mbb}
\renewcommand{\xyWARMinclude}[1]
{\scaledfig{.7}{#1}}%
\begin{xy}
\xyMarkedImport{}
\xyMarkedPos{para}*+{}
,\ar@{<-}+(.7,25)*+!D\txt{base of parabola}
\xyMarkedPos{cub1}*++{}!D(.6),\ar@{<-}-(3.5,15)
*+!U(.8)\txt{turning points\\of a cubic}="cub"
\xyMarkedPos{cub2}*++{},\ar@{<-}"cub",
\xyMarkedPos{neg1}*++{},\ar@{<-}+(.5,-25),
*+!L(.6)\txt{local minima}="min"
\xyMarkedPos{neg2}*++{},\ar@{<-}"min",
\end{xy}
After clicking at each of the four edges, extents of the image are obtained. This provides data for the first line in the following listing. With some manual editing the data can be put into the form shown below. Notice how the \WARMprocessEPS macro has been replaced by \WARMprocessMMA, for reading the size and marked-point data from this file.
LDRU:{-3.89059, -43.2333, 4.21704, 43.0523}
StartData
,{1.5145, 5.44064, para}
,{2.03422, -9.67778, cub1}
,{-1.01481, 17.6091, cub2}
,{0.96013, 2.49071, neg1}
,{-1.04945, 2.49071, neg2}
EndData
|
In this file there is just a symbolic label for each marked point. This is quite sufficient for the above figure, in which the marked points are not where labels occur, but are near the endpoints of arrows. Positions for the labels are determined relative to these arrow-ends, using XY-pic commands. Notice how a label may be positioned relative to one marked point, then used to draw an arrow to another.
%%BoundingBox comment for the square encompassing the image.
![]() |
%%AspectRatio: .61803
%LDRU:{-2.42465, -3.80861, 6.6868, 3.25092}
LDRU:{-2.18, -3.57, 6.50, 3.24}
StartData
,{2.29262, 2.27719, 3sinX}
,{1.54949, -0.927998, sin3X}
EndData
The ``aspect-ratio'' (i.e.
) of the rectangle
must be known to handle such graphics correctly with WARMreader.
This can be obtained from within Mathematica[9] or from the .eps file,
where it is given as a PostScript-like comment.
This must be supplied as the first line in the .mbb file,
preceding all other data.
The \WARMprocessMMA macro is
replaced with a variant called \WARMprocessMMAR.
Such images will be badly placed in a TEX or LATEX document, without some attempt to remove the extra space above and below when the aspect-ratio is greater than 1, or at left and right when the aspect-ratio is less than 1. In the following listing for the above figure, this has been done with \vskip commands.
\vskip-3.5\bigskipamount
\WARMprocessMMAR{QA1}{eps}{mbb}%
\renewcommand{\xyWARMinclude}[1]
{\scaledfig{.7}{#1}}%
\newcommand{\Xhair}{%
\drop[thinner][red]+[o][F-]@{x}}%
\begin{xy}
\xyMarkedImport{}
,(0,0)\Xhair,(0,3)\Xhair,(0,-3)\Xhair
,(6.2831,0)\Xhair,(-1.5708,1)\Xhair
,(-1.5708,-3)\Xhair,(1.5708,3)\Xhair
,(.5236,1)\Xhair,(3.6652,-1)\Xhair
\xyMarkedPos{3sinX},*++!L{3\sin x}
\xyMarkedPos{sin3X}*+{}
,\ar@{<-}+(.7,-1)*+!U!L(.4){\sin 3x}
\end{xy}%
\vskip-3.5\bigskipamount
In most cases this is enough for good placement of labels over the imported image; fine-tuning can be done using XY-pic modifiers, as described earlier. However, sometimes greater accuracy is required in establishing the coordinate system over the image. For this, some ``tweaking'' of the bounding-box may be done inside the .mbb file, as in the 3rd line of the above listing for the previous example. The 2nd line, which gives the coordinates obtained from the edges of the preview image, has been suppressed, allowing the following line to give modified values. Note how the cross-hairs have been accurately positioned; such accuracy is rarely required, but this example shows that it can indeed be achieved.
A further complication occurs when the graphic contains wide axis-labels or tick-marks. Now not all edges of the preview image need correspond to edges of the bounding box, when printed on the page. Mathematica[9] rescaled the preview to include the axis-labels, but on the printed page the main part of the image is larger, with the axis-labels extending into the extra space due to the aspect-ratio.
![]() |
To get best positioning, some visual estimation is required.
An extra `offset' parameter is supplied with the %%AspectRatio comment,
to measure the extent that labels would fall outside the bounding-box,
if it had been rectangular, not square.
%%AspectRatio: 1.6 :1.294
%LDRU:{-5.24417, -171.787, 8.21328, 248.046}
LDRU:{-3.95, -148, 8.21328, 226}
StartData
,{-1.13851, 16.7698, amax}
,{4.94396, -92.2394, amin}
,{2.05478, 0.565704, bflat}
EndData
In the above listing of the .mbb file for
the preceding example,
the 3rd line gives the extents of a rectangle,
with aspect-ratio 1.6, that just encloses the vertical
extent of the graphic. The left-hand edge of this rectangle
falls roughly
horizontal units
from the edge of the axis-labels on the left.