Preprocesses troff command input for the purpose of drawing pictures.
pic [ -T Name ] [ - | File ... ]
The pic command is a troff command preprocessor for drawing simple figures on a typesetter. The basic objects are a box, circle, ellipse, line, spline, arrow, arc, and the text specified by the Text variable. The top-level object is the picture.
|File||Specifies the output from a troff command that is processed by the pic command to draw pictures.|
The top-level object in the pic command is the picture.
.PS OptionalWidth OptionalHeight
If the .PF macro is used instead of the .PE macro, the position after printing is restored to what it was upon entry.
|OptionalWidth||Specifies the width, in inches, of the picture, if present, regardless of any dimensions used internally. The maximum value is 8.5.|
|OptionalHeight||Specifies a height value, in inches, different from the default, which is scaled to the same proportion. The maximum value is 14.|
|ElementList|| Represents the following list of elements:
Variable names begin with a lowercase letter, followed by zero or more letters or numbers. Place names begin with an uppercase letter, followed by zero or more letters or numbers. Place and variable names retain their values from one picture to the next.
Elements in a list must be separated by new-line characters or ; (semicolon); a long element can be continued by ending the line with a \ (backslash). Comments are introduced by a # (comment character) and ended by a new-line character.
The arrow object is the same as the line object with the -> attribute.
|h(eigh)t Expression||wid(th) Expression|
|rad(ius) Expression||diam(eter) Expression|
|up OptionalExpression||down OptionalExpression|
|right OptionalExpression||left OptionalExpression|
|from Position||to Position|
|at Position||with Corner|
|by Expression, Expression||then|
|dotted OptionalExpression||dashed OptionalExpression|
|chop OptionalExpression||-> <- <->|
Missing attributes and values are filled in from defaults. Not all attributes make sense for all primitives; irrelevant ones are not processed. The following are the currently meaningful attributes:
|box||h(eigh)t, wid(th), at, same, dotted, dashed, invis, Text|
|circle, ellipse||rad(ius), diam(eter), h(eigh)t, wid(th), at, same, invis, Text|
|arc||up, down, left, right, h(eigh)t, wid(th), from, to, at, rad(ius), invis, ccw, cw, <-, ->, <->, Text|
|line, arrow||up, down, left, right, h(eigh)t, wid(th), from, to, by, then, at, same, dotted, dashed, invis, <-, ->, <->, Text|
|spline||up, down, left, right, h(eigh)t, wid(th), from, to, by, then, at, same, invis, <-, ->, <->, Text|
|move||up, down, left, right, to, by, same, Text|
The at attribute implies placing the geometrical center at the specified place. For lines, splines, and arcs, the h(eigh)t and wid(th) attributes refer to arrowhead size.
The Text-item variable is normally an attribute of some primitive; by default, it is placed at the geometrical center of the object. Stand-alone text is also permitted. A Text-list primitive is a list of text items; a text item is a quoted string optionally followed by a positioning request, as follows:
If there are multiple text items for some primitives, they are centered vertically except as qualified. Positioning requests apply to each item independently.
Text items can contain troff commands that control, for example, size and font changes and local motions. Make sure these commands are balanced so that the entering state is restored before exiting.
|Positions/Places||A position is ultimately an X,Y coordinate pair, but it can also be specified in the following ways:|
Each object in a picture has an ordinal number; Nth refers to this, as follows:
The pic command is flexible enough to accept names like 1th and 3th. Usage like 1st and 3st are accepted as well.
The built-in variables and their default values are as follows:
These default values can be changed at any time, and the new values remain in force from picture to picture until changed again.
The textht and textwid variables can be set to any value to control positioning. The width and height of the generated picture can be set independently from the .PS macro line. Variables changed within the [ (left bracket) delimiter and the ] (right bracket) delimiter revert to their previous value upon exit from the block. Dimensions are divided by scale during output.
Note: The pic command has an eight inch by eight inch limitation on picture sizes generated and sent to troff, even when the .ps (size) line specifies a size greater than eight inches.
The following pic command expressions are evaluated in floating point. All numbers representing dimensions are taken to be in inches.
Expression + Expression
Expression - Expression
Expression * Expression
Expression / Expression
Expression % Expression (modulus)
( Expression )
sin(Expression) cos(Expression) atan2(Expression, Expression) log(Expression) sqrt(Expression) int(Expression) max(Expression, Expression) min(Expression,Expression) rand(Expression)
The pic command provides the following operators for logical evaluation:
|>/=||Greater than or equal to|
|</=||Less than or equal to|
|!=||Not equal to|
The following define statement is not part of the grammar:
define Name X Replacement text X
Occurrences of values such as $1 and $2 in the Replacement text variable are replaced by the corresponding options if the Name variable is called, as follows:
Name(Option1, Option2, ...)
Non-existent options are replaced by null strings. The Replacement text variable can contain newline characters.
The copy statement includes data from a file or values that immediately follow, such as:
copy thru Macro
copy File thru Macro
copy File thru Macro until String
The Macro parameter value can be either the name of a defined macro or the body of a macro enclosed in some character not part of the body. If no file name is given, the copy statement copies the input until the next .PE macro line.
The for and if statements provide for loops and decision-making, as follows:
Variable=Expression to Expression by Expression do X anything X
if Expression then X anything X else X anything X
The by and else clauses are optional. The Expression variable in an if statement can use the usual relational operators or the String1 == (or !=) String2 string tests.
The sh command runs a command line, as follows:
sh X Commandline X
It is possible to plot the value of an expression, as follows:
plot Expression OptionalFormat Attributes
The Expression variable value is evaluated and converted to a string (using the format specification, if provided).
The state of fill or no-fill mode is preserved with respect to pictures.
Input numbers can be expressed in E (exponential) notation.
|-TName|| Prepares the output for the specified printing device. Possible values for Name are:
|-||Reverts to standard input.|
The grap command, troff command.
The .PE macro, .PF macro, .PS macro, me macro package.