LinuxCommandLibrary

pic

Create troff-compatible pictures

TLDR

Process input with pictures, saving the output for future typesetting with groff to PostScript

$ pic [path/to/input.pic] > [path/to/output.roff]
copy

Typeset input with pictures to PDF using the [me] macro package
$ pic -T [pdf] [path/to/input.pic] | groff -[me] -T [pdf] > [path/to/output.pdf]
copy

SYNOPSIS

pic [options] [file ...]

PARAMETERS

-T dev
    Specify the device dev for troff. Needed only if pic can't determine the target device from troff's options. Use of this option is highly discouraged.

-F dir
    Search the directory dir for macro files. If not specified, the current directory is searched first.

-g
    Enable GNU pic extensions to the language.

-w
    Suppress warnings.

-x
    Accept lines beginning with .[0-9] as troff input without warning.

-W n
    Set the warning level to n.

file ...
    Input file(s) containing PIC code. If no files are specified, pic reads from standard input.

DESCRIPTION

The pic command is a preprocessor for the troff typesetting system, designed specifically for creating diagrams and pictures. It translates a specialized, high-level language describing graphical elements into troff commands that can be processed to produce visual output in documents. Pic allows users to define shapes like boxes, lines, circles, arcs, and text labels, then position and connect them to build complex diagrams relatively easily. It excels at automating the creation of graphics that would be tedious or difficult to draw by hand using raw troff commands. The output of pic is typically piped to troff or nroff for final rendering. Pic's syntax is declarative, focusing on what to draw rather than how to draw it, which simplifies the process of creating technical illustrations, flowcharts, circuit diagrams, and other visual aids. It provides variables and loops, making it a programming language by itself. A powerful option is also that the output of pic is device independent.

INVOCATION

Pic is typically invoked as a preprocessor in a pipeline before troff. For example:

pic mydiagram.pic | troff -ms

This would process 'mydiagram.pic' with pic, then pass the output to troff for typesetting using the 'ms' macro package.

LANGUAGE OVERVIEW

The pic language supports drawing basic shapes like boxes, circles, ellipses, lines, and arrows. It also supports text labels, variables, loops, and conditional statements. Diagrams are built by positioning and connecting these elements using coordinates and relative positions. Elements can have attributes such as color, line width, and fill patterns. Pic provides a rich set of features for creating complex and customized diagrams.

HISTORY

The pic preprocessor was originally developed by Brian Kernighan at Bell Labs in the late 1970s as part of the Unix document processing suite. It was designed to provide a user-friendly way to create diagrams within troff documents. Over time, pic has been reimplemented and extended in various forms, including GNU pic, which offers additional features and capabilities compared to the original version. The GNU version is commonly found in modern Linux distributions and is widely used for generating technical illustrations and other graphical elements.

SEE ALSO

troff(1), nroff(1), eqn(1), refer(1), soelim(1)

Copied to clipboard