[). The second example shows how to use the IGMETA
routine. The last example use IGRNG and IGMETA.
]
Example 1 : IOPWK, IACWK and IGQWK
DIMENSION R(2)
*
* Open a Fortran file
*
OPEN(UNIT=10,FILE='test1.ps',FORM='FORMATTED',STATUS='UNKNOWN')
*
* Open and activate a workstation with the PostScript metafile
* type -111 and with the workstation ID 5.
* Note that the UNIT used to open the Fortran (here 10)
* is given as second parameter.
*
CALL IOPWK(5,10,-111)
CALL IACWK(5)
*
* Get the size of the available space on paper. This is
* now possible because the Format is known.
*
CALL IGQWK(5,'MXDS',R)
*
* Compute the size of the viewport according to the paper
* size. Note that if the screen has not the same RATIO the
* picture on screen and on paper will be different. In this
* case the user must inquire the screen size and compute
* a new viewport with this size and redraw on the screen
* with the metafile deactivated.
*
XV=R(1)/R(2)/2.
YV=XV
CALL ISVP(2,0.,XV,0.,YV)
CALL ISWN(2,X1,X2,Y1,Y2)
CALL ISELNT(2)
.
.
Drawing
.
.
*
* Deactivate and close the metafile
*
CALL IDAWK(5)
CALL ICLWK(5)
CLOSE(10)
Example 2 : IGMETA
DIMENSION R(2)
OPEN(UNIT=10,FILE='test2.ps',FORM='FORMATTED',STATUS='UNKNOWN')
*
* IGMETA permits the opening and activating of the metafile
*
CALL IGMETA(10,-111)
CALL IGQWK(2,'MXDS',R)
XV=MIN(1.,R(1)/R(2))
YV=MIN(1.,R(2)/R(1))
CALL ISVP(2,0.,XV,0.,YV)
CALL ISWN(2,X1,X2,Y1,Y2)
CALL ISELNT(2)
.
.
Drawing
.
.
*
* Deactivate the metafile
*
CALL IGMETA(0,0)
*
* Close the metafile
*
CALL ICLWK(2)
CLOSE(10)
Example 3 : IGRNG
DIMENSION R(2)
OPEN(UNIT=10,FILE='test4.ps',FORM='FORMATTED',STATUS='UNKNOWN')
CALL IGMETA(-10,-111)
*
* IGRNG defines a size in cm centered on the page.
* Even if the RATIO of the screen and the RATIO of
* the paper are not the same the picture will appear
* exactly the same on both.
* Note that in the case of Encapsulated PostScript~(-113)
* a call to IGRNG is mandatory.
*
CALL IGRNG(10.,10.)
.
.
Drawing
.
.
CALL IGMETA(0,0)
CALL ICLWK(2)
CLOSE(10)
LaTeX metafile type
HIGZ is able to produce metafiles which are ready to be included in LaTeX
documents. These metafiles make use of the \picture environment. Compared
to other possibilities of merging graphics into documents, LaTeX metafiles
have a number of advantages:
- The dvi file is fully transportable as \special commands are not used.
This file can be output on any device for which a driver exists. Documents
can be written, formatted, and previewed on workstations while the dvi
file can be sent via the network to a central server for printing.
- The metafile can be also merged into the LaTeX file to keep the full
document in a single file.
- The power of LaTeX in text processing can be used in the primitive ITX
for example to generate complicated mathematical formulae on a document.
LaTeX metafile capabilities
The capabilities of the \picture environment are basically limited to
drawing straight horizontal or vertical lines. Slanted lines do exist but
only in a limited number of slopes and a minimum length of #4mm.
Therefore slanted lines have to be approximated by small steps of straight
lines where the step size should be close to the printer resolution.
The workstation type for LaTeX metafiles is -777 for embedded files or
-778 for stand-alone files. Coordinates written to the metafile are
integer numbers assuming a grid spacing of 0.1mm. Therefore the settings
for XSIZE and YSIZE should approximately correspond to the final picture
size.
Line and marker types
Line types 1 through 4 and marker types 1 through 5 are supported.
Text fonts
In addition to the software characters the font numbers -1 through -8 at
precision 0 can be used. They map to the TeX fonts Roman, Emphatic, Bold,
Italic, Slanted, Sans Serif, Small Caps, and Typewriter, respectively.
TeX fonts look much nicer and are faster to generate than software
characters generated by IGTEXT, but the disadvantage is that they are
available in horizontal orientation only and the character size does not
scale with the picture size.
When using TeX fonts the IGTEXT control characters ``<>[]"#^?!'' are
interpreted to obtain superscripts, greek letters, and other special
characters. If a text string contains a ``\'' or ``{'' the remaining part
is written verbatim into the metafile. This allows to use TeX formatting
commands for elaborate displays. Of course ``{'' and ``}'' must be
properly matched.
The whole text is typeset in math mode which does not allow a change of
fontsize in between. In order to format a formula on a larger size the
formula text must be preceded by ``{}$\large$''.
Configuration parameters
To some extent, the appearance of a picture can be changed at formatting
time by defining configuration parameters (in the LaTeX file) which have
the following default values:
\newdimen\higzunit \higzunit=0pt
\newcount\higzstep \higzstep=2
\newcount\higzdraft \higzdraft=0
By default the picture is automatically scaled to fill the full page
width. The picture size can be changed by setting \higzunit to the wanted
grid spacing, e.g. to get the true XSIZE:
\newdimen\higzunit \higzunit=0.1mm
Slanted lines are approximated by straight lines along the major axis. The
step size along the minor axis is \higzstepx\unitlength. By setting
\higzstep=1 curves will look smoother but if line segments come too close
to the printer resolution the dvi driver may choose not to display them. A
larger value will result in faster formatting requiring less TeX memory.
Setting \higzdraft=1 replaces the actual picture by an empty box of the
same size to save formatting time during drafting.