pic
Create troff-compatible pictures
TLDR
Process input with pictures, saving the output for future typesetting with groff to PostScript
Typeset input with pictures to PDF using the [me] macro package
SYNOPSIS
pic [-CVtwz] [-F directory] [-D number] [-S number] [-T name] [-U unit] [file...]
PARAMETERS
file...
One or more input files containing pic language commands. If no files are specified, pic reads from standard input.
-C
Enable compatibility mode with the AT&T pic, allowing some non-standard commands.
-T name
Specify the output device for groff (e.g., ps, dvi, html). This influences the generated output format.
-F directory
Add directory to the font search path. This is primarily for groff's font handling.
-U unit
Set the default unit for dimensions in the pic input (e.g., in for inches, cm for centimeters, pt for points).
-V
Print the version number of pic to standard error.
DESCRIPTION
pic is a domain-specific language and a preprocessor for the groff (or troff) typesetting system. It enables users to define simple line drawings and diagrams using a textual description. pic interprets these descriptions, which specify geometric objects like boxes, circles, ellipses, lines, and arcs, along with their positions and relationships (e.g., "box A at (1,1)", "line from A.bottom to B.top"). The output of pic is a stream of groff (or troff) commands that, when processed by groff, render the specified drawing. This allows for easy embedding of diagrams directly within documents, making it popular for technical documentation and manual pages. It provides a programmatic way to create repeatable and scalable vector graphics without direct manipulation of graphical tools.
CAVEATS
pic is a preprocessor, meaning its output needs further processing by groff or troff to produce a viewable document.
It is primarily designed for simple, schematic diagrams rather than complex, artistic illustrations.
The pic language is procedural, requiring a textual description of objects and their relationships, which can be less intuitive for users accustomed to graphical drawing tools. It does not produce standalone image files like JPEG or SVG directly.
TYPICAL USAGE WITH <I>GROFF</I>
pic code is typically embedded directly within a groff document, enclosed by the `.PS` (Pic Start) and `.PE` (Pic End) macros. For example:
`.PS`
`box "Hello";`
`line;`
`circle;`
`.PE`
When groff processes the document, it automatically passes the content between these macros to pic for processing, then integrates the resulting drawing commands back into the main document flow.
HISTORY
pic was originally developed by Brian Kernighan at Bell Labs as part of the troff typesetting system. It was designed to provide a simple, programmatic way to include diagrams in technical documents without needing to rely on external graphics software. Its integration with troff (and later groff) made it a powerful tool for creating self-contained, reproducible documents. It became a standard utility in Unix-like systems and is still actively maintained as part of the GNU groff project. Its design emphasizes textual descriptions, aligning with the philosophy of plain text processing common in early Unix environments.