1537 lines
25 KiB
HTML
1537 lines
25 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of PIC</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>PIC</H1>
|
|
Section: User Commands (1)<BR>Updated: 21 March 2020<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
pic - compile pictures for troff or TeX
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
|
|
[ <B>-nvCSU</B> ]
|
|
|
|
[<I>file</I>
|
|
|
|
...]
|
|
|
|
|
|
<B>-t</B>
|
|
|
|
[ <B>-cvzCSU</B> ]
|
|
|
|
[<I>file</I>
|
|
|
|
...]
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
This manual page describes the GNU version of
|
|
<B>pic</B>,
|
|
|
|
which is part of the groff document formatting system.
|
|
<B>pic</B>
|
|
|
|
compiles descriptions of pictures embedded within
|
|
<B>troff</B>
|
|
|
|
or TeX input files into commands that are understood by TeX or
|
|
<B>troff</B>.
|
|
|
|
Each picture starts with a line beginning with
|
|
<B>.PS</B>
|
|
|
|
and ends with a line beginning with
|
|
<B>.PE</B>.
|
|
|
|
Anything outside of
|
|
<B>.PS</B>
|
|
|
|
and
|
|
<B>.PE</B>
|
|
|
|
is passed through without change.
|
|
<P>
|
|
|
|
It is the user's responsibility to provide appropriate definitions
|
|
of the
|
|
<B>PS</B>
|
|
|
|
and
|
|
<B>PE</B>
|
|
|
|
macros.
|
|
When the macro package being used does not supply such definitions
|
|
(for example, old versions of -ms), appropriate definitions can be
|
|
obtained with
|
|
<B>-mpic</B>:
|
|
|
|
These will center each picture.
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
|
|
Options that do not take arguments may be grouped behind a single
|
|
<B>-</B>.
|
|
|
|
The special option
|
|
<B>--</B>
|
|
|
|
can be used to mark the end of the options.
|
|
A filename of
|
|
<B>-</B>
|
|
|
|
refers to the standard input.
|
|
<DL COMPACT>
|
|
<DT id="1"><B>-C</B>
|
|
|
|
<DD>
|
|
Recognize
|
|
<B>.PS</B>
|
|
|
|
and
|
|
<B>.PE</B>
|
|
|
|
even when followed by a character other than space or newline.
|
|
<DT id="2"><B>-S</B>
|
|
|
|
<DD>
|
|
Safer mode; do not execute
|
|
<B>sh</B>
|
|
|
|
commands.
|
|
This can be useful when operating on untrustworthy input (enabled by
|
|
default).
|
|
<DT id="3"><B>-U</B>
|
|
|
|
<DD>
|
|
Unsafe mode; revert the default option
|
|
<B>-S</B>.
|
|
|
|
<DT id="4"><B>-n</B>
|
|
|
|
<DD>
|
|
Don't use the groff extensions to the troff drawing commands.
|
|
You should use this if you are using a postprocessor that doesn't
|
|
support these extensions.
|
|
The extensions are described in
|
|
<B><A HREF="/cgi-bin/man/man2html?5+groff_out">groff_out</A></B>(5).
|
|
|
|
The
|
|
<B>-n</B>
|
|
|
|
option also causes
|
|
<B>pic</B>
|
|
|
|
not to use zero-length lines to draw dots in troff mode.
|
|
<DT id="5"><B>-t</B>
|
|
|
|
<DD>
|
|
TeX mode.
|
|
<DT id="6"><B>-c</B>
|
|
|
|
<DD>
|
|
Be more compatible with
|
|
<B>tpic</B>.
|
|
|
|
Implies
|
|
<B>-t</B>.
|
|
|
|
Lines beginning with
|
|
<B>\</B>
|
|
|
|
are not passed through transparently.
|
|
Lines beginning with
|
|
<B>.</B>
|
|
|
|
are passed through with the initial
|
|
<B>.</B>
|
|
|
|
changed to
|
|
<B>\</B>.
|
|
|
|
A line beginning with
|
|
<B>.ps</B>
|
|
|
|
is given special treatment:
|
|
it takes an optional integer argument specifying
|
|
the line thickness (pen size) in milliinches;
|
|
a missing argument restores the previous line thickness;
|
|
the default line thickness is 8 milliinches.
|
|
The line thickness thus specified takes effect only when a
|
|
non-negative line thickness has not been specified by use of the
|
|
<B>thickness</B>
|
|
|
|
attribute or by setting the
|
|
<B>linethick</B>
|
|
|
|
variable.
|
|
<DT id="7"><B>-v</B>
|
|
|
|
<DD>
|
|
Print the version number.
|
|
<DT id="8"><B>-z</B>
|
|
|
|
<DD>
|
|
In TeX mode draw dots using zero-length lines.
|
|
</DL>
|
|
<P>
|
|
|
|
The following options supported by other versions of
|
|
<B>pic</B>
|
|
|
|
are ignored:
|
|
<DL COMPACT>
|
|
<DT id="9"><B>-D</B>
|
|
|
|
<DD>
|
|
Draw all lines using the \D escape sequence.
|
|
<B>pic</B>
|
|
|
|
always does this.
|
|
<DT id="10"><B>-T</B><I> dev</I>
|
|
|
|
<DD>
|
|
Generate output for the
|
|
<B>troff</B>
|
|
|
|
device
|
|
<I>dev</I>.
|
|
|
|
This is unnecessary because the
|
|
<B>troff</B>
|
|
|
|
output generated by
|
|
<B>pic</B>
|
|
|
|
is device-independent.
|
|
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>USAGE</H2>
|
|
|
|
|
|
This section describes only the differences between GNU
|
|
<B>pic</B>
|
|
|
|
and the original version of
|
|
<B>pic</B>.
|
|
|
|
Many of these differences also apply to newer versions of Unix
|
|
<B>pic</B>.
|
|
|
|
A complete documentation is available in the file
|
|
<P>
|
|
|
|
<DL COMPACT><DT id="11"><DD>
|
|
<I>/usr/:share/:doc/:groff-base/pic.ms.gz</I>
|
|
|
|
</DL>
|
|
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H3>TeX mode</H3>
|
|
|
|
|
|
TeX mode is enabled by the
|
|
<B>-t</B>
|
|
|
|
option.
|
|
In TeX mode,
|
|
<B>pic</B>
|
|
|
|
will define a vbox called
|
|
<B>\graph</B>
|
|
|
|
for each picture.
|
|
Use the
|
|
<B>figname</B>
|
|
|
|
command to change the name of the vbox.
|
|
You must yourself print that vbox using, for example, the command
|
|
<DL COMPACT><DT id="12"><DD>
|
|
<P>
|
|
|
|
<B>\centerline{\box\graph}</B>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
Actually, since the vbox has a height of zero (it is defined with
|
|
\vtop) this will produce slightly more vertical space above the
|
|
picture than below it;
|
|
<DL COMPACT><DT id="13"><DD>
|
|
<P>
|
|
|
|
<B>\centerline{\raise 1em\box\graph}</B>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
would avoid this.
|
|
<P>
|
|
|
|
To make the vbox having a positive height and a depth of zero
|
|
(as used e.g. by LaTeX's
|
|
<B>graphics.sty</B>),
|
|
|
|
define the following macro in your document:
|
|
<DL COMPACT><DT id="14"><DD>
|
|
<P>
|
|
|
|
<B>\def\gpicbox#1{%</B>
|
|
|
|
<BR>
|
|
|
|
<B> \vbox{\unvbox\csname #1\endcsname\kern 0pt}}</B>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
Now you can simply say
|
|
<B>\gpicbox{graph}</B>
|
|
|
|
instead of \box\graph.
|
|
<P>
|
|
|
|
You must use a TeX driver that supports the
|
|
<B>tpic</B>
|
|
|
|
specials, version 2.
|
|
<P>
|
|
|
|
Lines beginning with
|
|
<B>\</B>
|
|
|
|
are passed through transparently; a
|
|
<B>%</B>
|
|
|
|
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
|
|
<B>\baselineskip</B>.
|
|
|
|
Anything else may well produce undesirable results; use at your own risk.
|
|
Lines beginning with a period are not given any special treatment.
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H3>Commands</H3>
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="15"><B>for</B> <I>variable</I> <B>=</B> <I>expr1</I> <B>to</B> <I>expr2</I> [<B>by</B> [<B>*</B>],<I>expr3/</I>] <B>do</B> <I>X</I> <I>body</I> <I>X</I><DD>
|
|
Set
|
|
<I>variable</I>
|
|
|
|
to
|
|
<I>expr1</I>.
|
|
|
|
While the value of
|
|
<I>variable</I>
|
|
|
|
is less than or equal to
|
|
<I>expr2</I>,
|
|
|
|
do
|
|
<I>body</I>
|
|
|
|
and increment
|
|
<I>variable</I>
|
|
|
|
by
|
|
<I>expr3</I>;
|
|
|
|
if
|
|
<B>by</B>
|
|
|
|
is not given, increment
|
|
<I>variable</I>
|
|
|
|
by 1.
|
|
If
|
|
<I>expr3</I>
|
|
|
|
is prefixed by
|
|
<B>*</B>
|
|
|
|
then
|
|
<I>variable</I>
|
|
|
|
will instead be multiplied by
|
|
<I>expr3</I>.
|
|
|
|
The value of
|
|
<I>expr3</I>
|
|
|
|
can be negative for the additive case;
|
|
<I>variable</I>
|
|
|
|
is then tested whether it is greater than or equal to
|
|
<I>expr2</I>.
|
|
|
|
For the multiplicative case,
|
|
<I>expr3</I>
|
|
|
|
must be greater than zero.
|
|
If the constraints aren't met, the loop isn't executed.
|
|
<I>X</I>
|
|
|
|
can be any character not occurring in
|
|
<I>body</I>.
|
|
|
|
<DT id="16"><B>if</B> <I>expr</I> <B>then</B> <I>X</I> <I>if-true</I> <I>X</I> [<B>else</B> <I>Y</I> <I>if-false</I> <I>Y</I>]<DD>
|
|
Evaluate
|
|
<I>expr</I>;
|
|
|
|
if it is non-zero then do
|
|
<I>if-true</I>,
|
|
|
|
otherwise do
|
|
<I>if-false</I>.
|
|
|
|
<I>X</I>
|
|
|
|
can be any character not occurring in
|
|
<I>if-true</I>.
|
|
|
|
<I>Y</I>
|
|
|
|
can be any character not occurring in
|
|
<I>if-false</I>.
|
|
|
|
<DT id="17"><B>print</B> <I>arg</I>...<DD>
|
|
Concatenate the arguments and print as a line on stderr.
|
|
Each
|
|
<I>arg</I>
|
|
|
|
must be an expression, a position, or text.
|
|
This is useful for debugging.
|
|
<DT id="18"><B>command</B> <I>arg</I>...<DD>
|
|
Concatenate the arguments
|
|
and pass them through as a line to troff or TeX.
|
|
Each
|
|
<I>arg</I>
|
|
|
|
must be an expression, a position, or text.
|
|
This has a similar effect to a line beginning with
|
|
<B>.</B>
|
|
|
|
or
|
|
<B>\</B>,
|
|
|
|
but allows the values of variables to be passed through.
|
|
For example,
|
|
<DL COMPACT><DT id="19"><DD>
|
|
<DL COMPACT>
|
|
<DT id="20"><DD>
|
|
<B>
|
|
</B><PRE>
|
|
.PS
|
|
x = 14
|
|
command ".ds string x is " x "."
|
|
.PE
|
|
\*[string]
|
|
</PRE>
|
|
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="21"><DD>
|
|
prints
|
|
<DL COMPACT><DT id="22"><DD>
|
|
<DL COMPACT>
|
|
<DT id="23"><DD>
|
|
<B>x is 14.</B>
|
|
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="24"><B>sh</B> <I>X</I> <I>command</I> <I>X</I><DD>
|
|
Pass
|
|
<I>command</I>
|
|
|
|
to a shell.
|
|
<I>X</I>
|
|
|
|
can be any character not occurring in
|
|
<I>command</I>.
|
|
|
|
<DT id="25"><B>copy</B> <B>",</B><I>filename/</I><B>"</B><DD>
|
|
Include
|
|
<I>filename</I>
|
|
|
|
at this point in the file.
|
|
<DT id="26"><B>copy</B> [<B>",</B><I>filename/</I><B>"</B>] <B>thru</B> <I>X</I> <I>body</I> <I>X</I> [<B>until</B> <B>",</B><I>word</I><B>"</B>]<DD>
|
|
|
|
<DT id="27"><B>copy</B> [<B>",</B><I>filename/</I><B>"</B>] <B>thru</B> <I>macro</I> [<B>until</B> <B>",</B><I>word</I><B>"</B>]<DD>
|
|
This construct does
|
|
<I>body</I>
|
|
|
|
once for each line of
|
|
<I>filename</I>;
|
|
|
|
the line is split into blank-delimited words,
|
|
and occurrences of
|
|
<B>$</B><I>i</I>
|
|
|
|
in
|
|
<I>body</I>,
|
|
|
|
for
|
|
<I>i</I>
|
|
|
|
between 1 and 9,
|
|
are replaced by the
|
|
<I>i</I>-th
|
|
|
|
word of the line.
|
|
If
|
|
<I>filename</I>
|
|
|
|
is not given, lines are taken from the current input up to
|
|
<B>.PE</B>.
|
|
|
|
If an
|
|
<B>until</B>
|
|
|
|
clause is specified,
|
|
lines will be read only until a line the first word of which is
|
|
<I>word</I>;
|
|
|
|
that line will then be discarded.
|
|
<I>X</I>
|
|
|
|
can be any character not occurring in
|
|
<I>body</I>.
|
|
|
|
For example,
|
|
<DL COMPACT><DT id="28"><DD>
|
|
<DL COMPACT>
|
|
<DT id="29"><DD>
|
|
<B>
|
|
</B><PRE>
|
|
.PS
|
|
copy thru % circle at ($1,$2) % until "END"
|
|
1 2
|
|
3 4
|
|
5 6
|
|
END
|
|
box
|
|
.PE
|
|
</PRE>
|
|
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="30"><DD>
|
|
is equivalent to
|
|
<DL COMPACT><DT id="31"><DD>
|
|
<DL COMPACT>
|
|
<DT id="32"><DD>
|
|
<B>
|
|
</B><PRE>
|
|
.PS
|
|
circle at (1,2)
|
|
circle at (3,4)
|
|
circle at (5,6)
|
|
box
|
|
.PE
|
|
</PRE>
|
|
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="33"><DD>
|
|
The commands to be performed for each line can also be taken
|
|
from a macro defined earlier by giving the name of the macro
|
|
as the argument to
|
|
<B>thru</B>.
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
<B>reset</B>
|
|
|
|
<BR>
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="34"><B>reset</B><I> variable1/</I>[<B>,</B>]<I> variable2 ...<DD>
|
|
Reset pre-defined variables
|
|
variable1</I>,
|
|
|
|
<I>variable2</I>
|
|
|
|
... to their default values.
|
|
If no arguments are given, reset all pre-defined variables to their
|
|
default values.
|
|
Note that assigning a value to
|
|
<B>scale</B>
|
|
|
|
also causes all pre-defined variables that control dimensions to be
|
|
reset to their default values times the new value of scale.
|
|
<DT id="35"><B>plot</B> <I>expr</I> [<B>",</B><I>text</I><B>"</B>]<DD>
|
|
This is a text object which is constructed by using
|
|
<I>text</I>
|
|
|
|
as a format string for sprintf
|
|
with an argument of
|
|
<I>expr</I>.
|
|
|
|
If
|
|
<I>text</I>
|
|
|
|
is omitted a format string of
|
|
<B>s%gs</B>
|
|
|
|
is used.
|
|
Attributes can be specified in the same way as for a normal text
|
|
object.
|
|
Be very careful that you specify an appropriate format string;
|
|
<B>pic</B>
|
|
|
|
does only very limited checking of the string.
|
|
This is deprecated in favour of
|
|
<B>sprintf</B>.
|
|
|
|
<DT id="36"><I>variable </I><B>:=</B><I> expr</I>
|
|
|
|
<DD>
|
|
This is similar to
|
|
<B>=</B>
|
|
|
|
except
|
|
<I>variable</I>
|
|
|
|
must already be defined,
|
|
and
|
|
<I>expr</I>
|
|
|
|
will be assigned to
|
|
<I>variable</I>
|
|
|
|
without creating a variable local to the current block.
|
|
(By contrast,
|
|
<B>=</B>
|
|
|
|
defines the variable in the current block if it is not already defined
|
|
there, and then changes the value in the current block only.)
|
|
For example, the following:
|
|
<DL COMPACT><DT id="37"><DD>
|
|
<DL COMPACT>
|
|
<DT id="38"><DD>
|
|
<B>
|
|
</B><PRE>
|
|
.PS
|
|
x = 3
|
|
y = 3
|
|
[
|
|
x := 5
|
|
y = 5
|
|
]
|
|
print x " " y
|
|
.PE
|
|
</PRE>
|
|
|
|
</DL>
|
|
</DL>
|
|
|
|
<DT id="39"><DD>
|
|
prints
|
|
<DL COMPACT><DT id="40"><DD>
|
|
<DL COMPACT>
|
|
<DT id="41"><DD>
|
|
<B>5 3</B>
|
|
|
|
</DL>
|
|
</DL>
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
Arguments of the form
|
|
<DL COMPACT>
|
|
<DT id="42"><DD>
|
|
<I>X anything X</I>
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
are also allowed to be of the form
|
|
<DL COMPACT>
|
|
<DT id="43"><DD>
|
|
<B>{ </B><I>anything </I><B>}</B>
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
In this case
|
|
<I>anything</I>
|
|
|
|
can contain balanced occurrences of
|
|
<B>{</B>
|
|
|
|
and
|
|
<B>}</B>.
|
|
|
|
Strings may contain
|
|
<I>X</I>
|
|
|
|
or imbalanced occurrences of
|
|
<B>{</B>
|
|
|
|
and
|
|
<B>}</B>.
|
|
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H3>Expressions</H3>
|
|
|
|
|
|
The syntax for expressions has been significantly extended:
|
|
<P>
|
|
|
|
<I>x </I><B>^ </B><I>y</I>
|
|
|
|
(exponentiation)
|
|
<BR>
|
|
|
|
<B>sin(</B><I>x</I><B>)</B>
|
|
|
|
<BR>
|
|
|
|
<B>cos(</B><I>x</I><B>)</B>
|
|
|
|
<BR>
|
|
|
|
<B>atan2(</B><I>y</I><B>,</B><I> x</I><B>)</B>
|
|
|
|
<BR>
|
|
|
|
<B>log(</B><I>x</I><B>)</B>
|
|
|
|
(base 10)
|
|
<BR>
|
|
|
|
<B>exp(</B><I>x</I><B>)</B>
|
|
|
|
(base 10, i.e.
|
|
|
|
10^<I>x</I>)
|
|
<BR>
|
|
|
|
<B>sqrt(</B><I>x</I><B>)</B>
|
|
|
|
<BR>
|
|
|
|
<B>int(</B><I>x</I><B>)</B>
|
|
|
|
<BR>
|
|
|
|
<B>rand()</B>
|
|
|
|
(return a random number between 0 and 1)
|
|
<BR>
|
|
|
|
<B>rand(</B><I>x</I><B>)</B>
|
|
|
|
(return a random number between 1 and
|
|
<I>x</I>;
|
|
|
|
deprecated)
|
|
<BR>
|
|
|
|
<B>srand(</B><I>x</I><B>)</B>
|
|
|
|
(set the random number seed)
|
|
<BR>
|
|
|
|
<B>max(</B><I>e1</I><B>,</B><I> e2</I><B>)</B>
|
|
|
|
<BR>
|
|
|
|
<B>min(</B><I>e1</I><B>,</B><I> e2</I><B>)</B>
|
|
|
|
<BR>
|
|
|
|
<B>!</B><I>e</I>
|
|
|
|
<BR>
|
|
|
|
<I>e1</I><B> && </B><I>e2</I>
|
|
<BR>
|
|
|
|
<I>e1</I><B> || </B><I>e2</I>
|
|
<BR>
|
|
|
|
<I>e1</I><B> == </B><I>e2</I>
|
|
<BR>
|
|
|
|
<I>e1</I><B> != </B><I>e2</I>
|
|
<BR>
|
|
|
|
<I>e1</I><B> >= </B><I>e2</I>
|
|
<BR>
|
|
|
|
<I>e1</I><B> > </B><I>e2</I>
|
|
<BR>
|
|
|
|
<I>e1</I><B> <= </B><I>e2</I>
|
|
<BR>
|
|
|
|
<I>e1</I><B> < </B><I>e2</I>
|
|
<BR>
|
|
|
|
<B>",</B><I>str1</I><B>" == ",</B><I>str2</I><B>"</B>
|
|
<BR>
|
|
|
|
<B>",</B><I>str1</I><B>" != ",</B><I>str2</I><B>"</B>
|
|
<BR>
|
|
|
|
<P>
|
|
|
|
String comparison expressions must be parenthesised in some contexts
|
|
to avoid ambiguity.
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H3>Other Changes</H3>
|
|
|
|
|
|
A bare expression,
|
|
<I>expr</I>,
|
|
|
|
is acceptable as an attribute;
|
|
it is equivalent to
|
|
<I>dir expr</I>,
|
|
|
|
where
|
|
<I>dir</I>
|
|
|
|
is the current direction.
|
|
For example
|
|
<P>
|
|
|
|
<DL COMPACT><DT id="44"><DD>
|
|
<B>line 2i</B>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
means draw a line 2 inches long in the current direction.
|
|
The 'i' (or 'I') character is ignored; to use another
|
|
measurement unit, set the
|
|
<I>scale</I>
|
|
|
|
variable to an appropriate value.
|
|
<P>
|
|
|
|
The maximum width and height of the picture are taken from the variables
|
|
<B>maxpswid</B>
|
|
|
|
and
|
|
<B>maxpsht</B>.
|
|
|
|
Initially these have values 8.5 and 11.
|
|
<P>
|
|
|
|
Scientific notation is allowed for numbers.
|
|
For example
|
|
<DL COMPACT><DT id="45"><DD>
|
|
<P>
|
|
|
|
<B>x = 5e-2</B>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
Text attributes can be compounded.
|
|
For example,
|
|
<DL COMPACT><DT id="46"><DD>
|
|
<P>
|
|
|
|
<B>"foo" above ljust</B>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
is valid.
|
|
<P>
|
|
|
|
There is no limit to the depth to which blocks can be examined.
|
|
For example,
|
|
<DL COMPACT><DT id="47"><DD>
|
|
<P>
|
|
|
|
<B>[A: [B: [C: box ]]] with .A.B.C.sw at 1,2</B>
|
|
|
|
<BR>
|
|
|
|
<B>circle at last [].A.B.C</B>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
is acceptable.
|
|
<P>
|
|
|
|
Arcs now have compass points determined by the circle of which the arc
|
|
is a part.
|
|
<P>
|
|
|
|
Circles, ellipses, and arcs can be dotted or dashed.
|
|
In TeX mode splines can be dotted or dashed also.
|
|
<P>
|
|
|
|
Boxes can have rounded corners.
|
|
The
|
|
<B>rad</B>
|
|
|
|
attribute specifies the radius of the quarter-circles at each corner.
|
|
If no
|
|
<B>rad</B>
|
|
|
|
or
|
|
<B>diam</B>
|
|
|
|
attribute is given, a radius of
|
|
<B>boxrad</B>
|
|
|
|
is used.
|
|
Initially,
|
|
<B>boxrad</B>
|
|
|
|
has a value of 0.
|
|
A box with rounded corners can be dotted or dashed.
|
|
<P>
|
|
|
|
Boxes can have slanted sides.
|
|
This effectively changes the shape of a box from a rectangle to an
|
|
arbitrary parallelogram.
|
|
The
|
|
<B>xslanted</B>
|
|
|
|
and
|
|
<B>yslanted</B>
|
|
|
|
attributes specify the x and y~offset of the box's upper right
|
|
corner from its default position.
|
|
<P>
|
|
|
|
The
|
|
<B>.PS</B>
|
|
|
|
line can have a second argument specifying a maximum height for
|
|
the picture.
|
|
If the width of zero is specified the width will be ignored in computing
|
|
the scaling factor for the picture.
|
|
Note that GNU
|
|
<B>pic</B>
|
|
|
|
will always scale a picture by the same amount vertically as well as
|
|
horizontally.
|
|
This is different from the DWB
|
|
2.0
|
|
<B>pic</B>
|
|
|
|
which may scale a picture by a different amount vertically than
|
|
horizontally if a height is specified.
|
|
<P>
|
|
|
|
Each text object has an invisible box associated with it.
|
|
The compass points of a text object are determined by this box.
|
|
The implicit motion associated with the object is also determined
|
|
by this box.
|
|
The dimensions of this box are taken from the width and height attributes;
|
|
if the width attribute is not supplied then the width will be taken to be
|
|
<B>textwid</B>;
|
|
|
|
if the height attribute is not supplied then the height will be taken to be
|
|
the number of text strings associated with the object
|
|
times
|
|
<B>textht</B>.
|
|
|
|
Initially
|
|
<B>textwid</B>
|
|
|
|
and
|
|
<B>textht</B>
|
|
|
|
have a value of 0.
|
|
<P>
|
|
|
|
In (almost all) places where a quoted text string can be used,
|
|
an expression of the form
|
|
<DL COMPACT>
|
|
<DT id="48"><DD>
|
|
<B>sprintf(s</B><I>format</I><B>s, </B><I>arg</I><B>,</B>...<B>)</B>
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
can also be used;
|
|
this will produce the arguments formatted according to
|
|
<I>format</I>,
|
|
|
|
which should be a string as described in
|
|
<B><A HREF="/cgi-bin/man/man2html?3+printf">printf</A></B>(3)
|
|
|
|
appropriate for the number of arguments supplied.
|
|
<P>
|
|
|
|
The thickness of the lines used to draw objects is controlled by the
|
|
<B>linethick</B>
|
|
|
|
variable.
|
|
This gives the thickness of lines in points.
|
|
A negative value means use the default thickness:
|
|
in TeX output mode, this means use a thickness of 8 milliinches;
|
|
in TeX output mode with the
|
|
<B>-c</B>
|
|
|
|
option, this means use the line thickness specified by
|
|
<B>.ps</B>
|
|
|
|
lines;
|
|
in troff output mode, this means use a thickness proportional
|
|
to the pointsize.
|
|
A zero value means draw the thinnest possible line supported by
|
|
the output device.
|
|
Initially it has a value of -1.
|
|
There is also a
|
|
<B>thick</B>[<B>ness</B>]
|
|
|
|
attribute.
|
|
For example,
|
|
<DL COMPACT><DT id="49"><DD>
|
|
<P>
|
|
|
|
<B>circle thickness 1.5</B>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
would draw a circle using a line with a thickness of 1.5 points.
|
|
The thickness of lines is not affected by the
|
|
value of the
|
|
<B>scale</B>
|
|
|
|
variable, nor by the width or height given in the
|
|
<B>.PS</B>
|
|
|
|
line.
|
|
<P>
|
|
|
|
Boxes (including boxes with rounded corners or slanted sides),
|
|
circles and ellipses can be filled by giving them an attribute of
|
|
<B>fill</B>[<B>ed</B>].
|
|
|
|
This takes an optional argument of an expression with a value between
|
|
0 and 1; 0 will fill it with white, 1 with black, values in between
|
|
with a proportionally gray shade.
|
|
A value greater than 1 can also be used:
|
|
this means fill with the
|
|
shade of gray that is currently being used for text and lines.
|
|
Normally this will be black, but output devices may provide
|
|
a mechanism for changing this.
|
|
Without an argument, then the value of the variable
|
|
<B>fillval</B>
|
|
|
|
will be used.
|
|
Initially this has a value of 0.5.
|
|
The invisible attribute does not affect the filling of objects.
|
|
Any text associated with a filled object will be added after the
|
|
object has been filled, so that the text will not be obscured
|
|
by the filling.
|
|
<P>
|
|
|
|
Three additional modifiers are available to specify colored objects:
|
|
<B>outline</B>[<B>d</B>]
|
|
|
|
sets the color of the outline,
|
|
<B>shaded</B>
|
|
|
|
the fill color, and
|
|
<B>colo</B>[u]r[ed]
|
|
|
|
sets both.
|
|
All three keywords expect a suffix specifying the color, for example
|
|
<DL COMPACT><DT id="50"><DD>
|
|
<P>
|
|
|
|
<B>circle shaded green outline black</B>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
Currently, color support isn't available in TeX mode.
|
|
Predefined color names for
|
|
<B>groff</B>
|
|
|
|
are in the device macro files, for example
|
|
<B>ps.tmac</B>;
|
|
|
|
additional colors can be defined with the
|
|
<B>.defcolor</B>
|
|
|
|
request (see the manual page of
|
|
<B><A HREF="/cgi-bin/man/man2html?1+troff">troff</A></B>(1)
|
|
|
|
for more details).
|
|
<P>
|
|
|
|
To change the name of the vbox in TeX mode, set the pseudo-variable
|
|
<B>figname</B>
|
|
|
|
(which is actually a specially parsed command) within a picture.
|
|
Example:
|
|
<DL COMPACT><DT id="51"><DD>
|
|
<P>
|
|
|
|
<B>.PS</B>
|
|
|
|
<BR>
|
|
|
|
<B>figname = foobar;</B>
|
|
|
|
<BR>
|
|
|
|
<B>...</B>
|
|
|
|
<BR>
|
|
|
|
<B>.PE</B>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
The picture is then available in the box
|
|
<B>\foobar</B>.
|
|
|
|
<P>
|
|
|
|
<B>pic</B>
|
|
|
|
assumes that at the beginning of a picture both glyph and fill color are
|
|
set to the default value.
|
|
<P>
|
|
|
|
Arrow heads will be drawn as solid triangles if the variable
|
|
<B>arrowhead</B>
|
|
|
|
is non-zero and either TeX mode is enabled or the
|
|
<B>-n</B>
|
|
|
|
option has not been given.
|
|
Initially
|
|
<B>arrowhead</B>
|
|
|
|
has a value of 1.
|
|
Note that solid arrow heads are always filled with the current outline
|
|
color.
|
|
<P>
|
|
|
|
The troff output of
|
|
<B>pic</B>
|
|
|
|
is device-independent.
|
|
The
|
|
<B>-T</B>
|
|
|
|
option is therefore redundant.
|
|
All numbers are taken to be in inches; numbers are never interpreted
|
|
to be in troff machine units.
|
|
<P>
|
|
|
|
Objects can have an
|
|
<B>aligned</B>
|
|
|
|
attribute.
|
|
This will only work if the postprocessor is
|
|
<B>grops</B>,
|
|
|
|
or
|
|
<B>gropdf</B>.
|
|
|
|
Any text associated with an object having the
|
|
<B>aligned</B>
|
|
|
|
attribute will be rotated about the center of the object
|
|
so that it is aligned in the direction from the start point
|
|
to the end point of the object.
|
|
Note that this attribute will have no effect for objects whose start
|
|
and end points are coincident.
|
|
<P>
|
|
|
|
In places where
|
|
<I>n</I><B>th</B>
|
|
|
|
is allowed
|
|
<B>'</B><I>expr</I><B>'th</B>
|
|
|
|
is also allowed.
|
|
Note that
|
|
<B>'th</B>
|
|
|
|
is a single token: no space is allowed between the
|
|
<B>'</B>
|
|
|
|
and the
|
|
<B>th</B>.
|
|
|
|
For example,
|
|
<DL COMPACT>
|
|
<DT id="52"><DD>
|
|
<B>
|
|
</B><PRE>
|
|
for i = 1 to 4 do {
|
|
line from 'i'th box.nw to 'i+1'th box.se
|
|
}
|
|
</PRE>
|
|
|
|
|
|
</DL>
|
|
<A NAME="lbAK"> </A>
|
|
<H2>CONVERSION</H2>
|
|
|
|
|
|
To obtain a stand-alone picture from a
|
|
<B>pic</B>
|
|
|
|
file, enclose your
|
|
<B>pic</B>
|
|
|
|
code with
|
|
<B>.PS</B>
|
|
|
|
and
|
|
<B>.PE</B>
|
|
|
|
requests;
|
|
<B>roff</B>
|
|
|
|
configuration commands may be added at the beginning of the file, but no
|
|
<B>roff</B>
|
|
|
|
text.
|
|
<P>
|
|
|
|
It is necessary to feed this file into
|
|
<B>groff</B>
|
|
|
|
without adding any page information, so you must check which
|
|
<B>.PS</B>
|
|
|
|
and
|
|
<B>.PE</B>
|
|
|
|
requests are actually called.
|
|
For example, the mm macro package adds a page number, which is very
|
|
annoying.
|
|
At the moment, calling standard
|
|
<B>groff</B>
|
|
|
|
without any macro package works.
|
|
Alternatively, you can define your own requests, e.g. to do nothing:
|
|
<P>
|
|
|
|
<DL COMPACT><DT id="53"><DD>
|
|
<PRE>
|
|
<B>.de PS
|
|
..
|
|
.de PE
|
|
..
|
|
</B></PRE>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>groff</B>
|
|
|
|
itself does not provide direct conversion into other graphics file
|
|
formats.
|
|
But there are lots of possibilities if you first transform your
|
|
picture into PostScript® format using the
|
|
<B>groff</B>
|
|
|
|
option
|
|
<B>-Tps</B>.
|
|
|
|
Since this
|
|
<I>ps</I>-file
|
|
|
|
lacks BoundingBox information it is not very useful by itself, but it
|
|
may be fed into other conversion programs, usually named
|
|
<B>ps2</B><I>other</I>
|
|
|
|
or
|
|
<B>psto</B><I>other</I>
|
|
|
|
or the like.
|
|
Moreover, the PostScript interpreter
|
|
<B>ghostscript</B>
|
|
|
|
(<B>gs</B>)
|
|
|
|
has built-in graphics conversion devices that are called with the option
|
|
<P>
|
|
|
|
<DL COMPACT><DT id="54"><DD>
|
|
<B>gs -sDEVICE=</B><I><devname></I>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
Call
|
|
<P>
|
|
|
|
<DL COMPACT><DT id="55"><DD>
|
|
<B>gs --help</B>
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
for a list of the available devices.
|
|
<P>
|
|
|
|
An alternative may be to use the
|
|
<B>-Tpdf</B>
|
|
|
|
option to convert your picture directly into
|
|
<B>PDF</B>
|
|
|
|
format.
|
|
The MediaBox of the file produced can be controlled by passing a
|
|
<B>-P-p</B>
|
|
|
|
papersize to groff.
|
|
<P>
|
|
|
|
As the Encapsulated PostScript File Format
|
|
<B>EPS</B>
|
|
|
|
is getting more and more important, and the conversion wasn't
|
|
regarded trivial in the past you might be interested to know that
|
|
there is a conversion tool named
|
|
<B>ps2eps</B>
|
|
|
|
which does the right job.
|
|
It is much better than the tool
|
|
<B>ps2epsi</B>
|
|
|
|
packaged with
|
|
<B>gs</B>.
|
|
|
|
<P>
|
|
|
|
For bitmapped graphic formats, you should use
|
|
<B>pstopnm</B>;
|
|
|
|
the resulting (intermediate)
|
|
<B>PNM</B>
|
|
|
|
file can be then converted to virtually any graphics format using the
|
|
tools of the
|
|
<B>netpbm</B>
|
|
|
|
package.
|
|
|
|
<A NAME="lbAL"> </A>
|
|
<H2>FILES</H2>
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="56"><I>/usr/:share/:groff/:1.22.4/:tmac/pic.tmac</I>
|
|
|
|
<DD>
|
|
Example definitions of the
|
|
<B>PS</B>
|
|
|
|
and
|
|
<B>PE</B>
|
|
|
|
macros.
|
|
|
|
</DL>
|
|
<A NAME="lbAM"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+troff">troff</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+groff_out">groff_out</A></B>(5),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+tex">tex</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+gs">gs</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ps2eps">ps2eps</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pstopnm">pstopnm</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ps2epsi">ps2epsi</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+pnm">pnm</A></B>(5)
|
|
|
|
<P>
|
|
|
|
Eric S. Raymond,
|
|
<I>Making Pictures With GNU PIC.</I>
|
|
|
|
<BR>
|
|
|
|
<I>/usr/:share/:doc/:groff-base/pic.ps</I>
|
|
|
|
(this file, together with its source file, pic.ms, is part
|
|
of the groff documentation)
|
|
<P>
|
|
|
|
Tpic: Pic for TeX
|
|
<P>
|
|
|
|
Brian W. Kernighan,
|
|
|
|
<I>PIC --- A Graphics Language for Typesetting (User Manual)</I>
|
|
|
|
|
|
AT&T Bell Laboratories, Computing Science Technical Report No. 116
|
|
(revised May, 1991).
|
|
<P>
|
|
|
|
<B>ps2eps</B>
|
|
|
|
is available from CTAN mirrors, e.g.
|
|
|
|
|
|
<P>
|
|
|
|
W. Richard Stevens,
|
|
|
|
<I>Turning PIC into HTML</I>
|
|
|
|
|
|
<P>
|
|
|
|
W. Richard Stevens,
|
|
|
|
<I>Examples of </I>pic<I> Macros</I>
|
|
|
|
|
|
|
|
<A NAME="lbAN"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
|
|
Input characters that are invalid for
|
|
<B>groff</B>
|
|
|
|
(i.e., those with ASCII code 0,
|
|
or 013 octal, or between 015 and 037 octal, or between 0200 and 0237
|
|
octal) are rejected even in TeX mode.
|
|
<P>
|
|
|
|
The interpretation of
|
|
<B>fillval</B>
|
|
|
|
is incompatible with the pic in 10th edition Unix,
|
|
which interprets 0 as black and 1 as white.
|
|
<P>
|
|
|
|
PostScript® is a registered trademark of Adobe Systems Incorporation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="57"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="58"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="59"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="60"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="61"><A HREF="#lbAF">USAGE</A><DD>
|
|
<DL>
|
|
<DT id="62"><A HREF="#lbAG">TeX mode</A><DD>
|
|
<DT id="63"><A HREF="#lbAH">Commands</A><DD>
|
|
<DT id="64"><A HREF="#lbAI">Expressions</A><DD>
|
|
<DT id="65"><A HREF="#lbAJ">Other Changes</A><DD>
|
|
</DL>
|
|
<DT id="66"><A HREF="#lbAK">CONVERSION</A><DD>
|
|
<DT id="67"><A HREF="#lbAL">FILES</A><DD>
|
|
<DT id="68"><A HREF="#lbAM">SEE ALSO</A><DD>
|
|
<DT id="69"><A HREF="#lbAN">BUGS</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:23 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|