[ prev | next | top ]

## 18. Interface to TeX

TeX mode is enabled by the −t option. In TeX mode, pic defines a vbox called \graph for each picture; the name can be changed with the pseudo-variable figname (which is actually a specially parsed command). You must yourself print that vbox using, for example, the command

`\centerline{\box\graph}`

Actually, since the vbox has a height of zero (it is defined with \vtop) this produces slightly more vertical space above the picture than below it;

`\centerline{\raise 1em\box\graph}`

would avoid this.

To make the vbox having a positive height and a depth of zero (as used e.g. by LaTeX’s `graphics.sty`), define the following macro in your document:

    \def\gpicbox#1{%
      \vbox{\unvbox\csname #1\endcsname\kern 0pt}}

Now you can simply say \gpicbox{graph} instead of \box\graph.

You must use a TeX driver that supports the tpic specials, version 2.

Lines beginning with \ are passed through transparently; a % is added to the end of the line to avoid unwanted spaces. You can safely use this feature to change fonts or to change the value of \baselineskip. Anything else may well produce undesirable results; use at your own risk. Lines beginning with a period are not given any special treatment.

The TeX mode of pic(1) does not translate troff font and size changes included in text strings!

Here an example how to use figname.

    .PS
    figname = foo;
    ...
    .PE

    .PS
    figname = bar;
    ...
    .PE

    \centerline{\box\foo \hss \box\bar}

Use this feature sparsingly and only if really needed: A different name means a new box register in TeX, and the maximum number of box registers is only 256. Also be careful not to use a predefined TeX or LaTeX macro name as an argument to figname since this inevitably causes an error.

[ prev | next | top ]