{
    "content": [
        {
            "type": "text",
            "text": "# pic(1) (man)\n\n**Summary:** pic - compile pictures for troff or TeX\n\n**Synopsis:** pic [-nvCSU] [file ...]\npic -t [-cvzCSU] [file ...]\n\n## Flags\n\n| Flag | Long | Arg | Description |\n|------|------|-----|-------------|\n| -C | — | — |  |\n| -S | — | — | worthy input (enabled by default). |\n| -S | — | — |  |\n| -n | — | — | you are using a postprocessor that doesn't support these extensions. The extensions are described in groffout(5). The -n |\n| -t | — | — |  |\n| -t | — | — | through transparently. Lines beginning with . are passed through with the initial . changed to \\. A line beginning with  |\n| -v | — | — |  |\n| -z | — | — | The following options supported by other versions of pic are ignored: |\n| -D | — | — |  |\n| -T | — | — | put generated by pic is device-independent. |\n\n## See Also\n\n- troff(1)\n- groffout(5)\n- tex(1)\n- gs(1)\n- ps2eps(1)\n- pstopnm(1)\n- ps2epsi(1)\n- pnm(5)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (4 lines)\n- **DESCRIPTION** (10 lines)\n- **OPTIONS** (3 lines) — 10 subsections\n  - -C (1 lines)\n  - -S (2 lines)\n  - -U -S (1 lines)\n  - -n (4 lines)\n  - -t (1 lines)\n  - -c -t (8 lines)\n  - -v (1 lines)\n  - -z (2 lines)\n  - -D (1 lines)\n  - -T (2 lines)\n- **USAGE** (6 lines) — 5 subsections\n  - TeX mode (28 lines)\n  - Commands (69 lines)\n  - reset (44 lines)\n  - Expressions (29 lines)\n  - Other Changes (131 lines)\n- **CONVERSION** (41 lines)\n- **FILES** (3 lines)\n- **SEE ALSO** (19 lines)\n- **BUGS** (11 lines)\n\n## Full Content\n\n### NAME\n\npic - compile pictures for troff or TeX\n\n### SYNOPSIS\n\npic [-nvCSU] [file ...]\n\npic -t [-cvzCSU] [file ...]\n\n### DESCRIPTION\n\nThis  manual  page describes the GNU version of pic, which is part of the groff document for‐\nmatting system.  pic compiles descriptions of pictures embedded within  troff  or  TeX  input\nfiles into commands that are understood by TeX or troff.  Each picture starts with a line be‐\nginning with .PS and ends with a line beginning with .PE.  Anything outside of .PS and .PE is\npassed through without change.\n\nIt  is  the user's responsibility to provide appropriate definitions of the PS and PE macros.\nWhen the macro package being used does not supply such definitions (for example, old versions\nof -ms), appropriate definitions can be obtained with -mpic: These will center each picture.\n\n### OPTIONS\n\nOptions  that  do not take arguments may be grouped behind a single -.  The special option --\ncan be used to mark the end of the options.  A filename of - refers to the standard input.\n\n#### -C\n\n#### -S\n\nworthy input (enabled by default).\n\n#### -U -S\n\n#### -n\n\nyou are using a postprocessor that doesn't support these extensions.   The  extensions\nare  described  in groffout(5).  The -n option also causes pic not to use zero-length\nlines to draw dots in troff mode.\n\n#### -t\n\n#### -c -t\n\nthrough  transparently.  Lines beginning with .  are passed through with the initial .\nchanged to \\.  A line beginning with .ps is given special treatment: it takes  an  op‐\ntional  integer  argument  specifying  the line thickness (pen size) in milliinches; a\nmissing argument restores the previous line thickness; the default line thickness is 8\nmilliinches.   The line thickness thus specified takes effect only when a non-negative\nline thickness has not been specified by use of the thickness attribute or by  setting\nthe linethick variable.\n\n#### -v\n\n#### -z\n\nThe following options supported by other versions of pic are ignored:\n\n#### -D\n\n#### -T\n\nput generated by pic is device-independent.\n\n### USAGE\n\nThis section describes only the differences between GNU pic and the original version of  pic.\nMany of these differences also apply to newer versions of Unix pic.  A complete documentation\nis available in the file\n\n/usr/share/doc/groff-base/pic.ms.gz\n\n#### TeX mode\n\nTeX mode is enabled by the -t option.  In TeX mode, pic will define a vbox called \\graph  for\neach  picture.   Use  the  figname command to change the name of the vbox.  You must yourself\nprint that vbox using, for example, the command\n\n\\centerline{\\box\\graph}\n\nActually, since the vbox has a height of zero (it is defined with \\vtop)  this  will  produce\nslightly more vertical space above the picture than below it;\n\n\\centerline{\\raise 1em\\box\\graph}\n\nwould avoid this.\n\nTo  make  the  vbox  having  a  positive  height and a depth of zero (as used e.g. by LaTeX's\ngraphics.sty), define the following macro in your document:\n\n\\def\\gpicbox#1{%\n\\vbox{\\unvbox\\csname #1\\endcsname\\kern 0pt}}\n\nNow you can simply say \\gpicbox{graph} instead of \\box\\graph.\n\nYou must use a TeX driver that supports the tpic specials, version 2.\n\nLines beginning with \\ are passed through transparently; a % is added to the end of the  line\nto  avoid  unwanted spaces.  You can safely use this feature to change fonts or to change the\nvalue of \\baselineskip.  Anything else may well produce undesirable results; use at your  own\nrisk.  Lines beginning with a period are not given any special treatment.\n\n#### Commands\n\nfor variable = expr1 to expr2 [by [*]expr3] do X body X\nSet variable to expr1.  While the value of variable is less than or equal to expr2, do\nbody and increment variable by expr3; if by is not given, increment variable by 1.  If\nexpr3  is  prefixed by * then variable will instead be multiplied by expr3.  The value\nof expr3 can be negative for the additive case; variable is then tested whether it  is\ngreater  than  or  equal to expr2.  For the multiplicative case, expr3 must be greater\nthan zero.  If the constraints aren't met, the loop isn't  executed.   X  can  be  any\ncharacter not occurring in body.\n\nif expr then X if-true X [else Y if-false Y]\nEvaluate expr; if it is non-zero then do if-true, otherwise do if-false.  X can be any\ncharacter not occurring in if-true.  Y can be any character not occurring in if-false.\n\nprint arg...\nConcatenate the arguments and print as a line on stderr.  Each arg must be an  expres‐\nsion, a position, or text.  This is useful for debugging.\n\ncommand arg...\nConcatenate  the  arguments and pass them through as a line to troff or TeX.  Each arg\nmust be an expression, a position, or text.  This has a similar effect to a  line  be‐\nginning with . or \\, but allows the values of variables to be passed through.  For ex‐\nample,\n\n.PS\nx = 14\ncommand \".ds string x is \" x \".\"\n.PE\n\\*[string]\n\nprints\n\nx is 14.\n\nsh X command X\nPass command to a shell.  X can be any character not occurring in command.\n\ncopy \"filename\"\nInclude filename at this point in the file.\n\ncopy [\"filename\"] thru X body X [until \"word\"]\ncopy [\"filename\"] thru macro [until \"word\"]\nThis construct does body once for each line of filename; the line is split into blank-\ndelimited words, and occurrences of $i in body, for i between 1 and 9, are replaced by\nthe i-th word of the line.  If filename is not given, lines are taken from the current\ninput  up  to  .PE.   If an until clause is specified, lines will be read only until a\nline the first word of which is word; that line will then be discarded.  X can be  any\ncharacter not occurring in body.  For example,\n\n.PS\ncopy thru % circle at ($1,$2) % until \"END\"\n1 2\n3 4\n5 6\nEND\nbox\n.PE\n\nis equivalent to\n\n.PS\ncircle at (1,2)\ncircle at (3,4)\ncircle at (5,6)\nbox\n.PE\n\nThe commands to be performed for each line can also be taken from a macro defined ear‐\nlier by giving the name of the macro as the argument to thru.\n\n#### reset\n\nreset variable1[,] variable2 ...\nReset pre-defined variables variable1, variable2 ... to their default values.   If  no\narguments  are  given,  reset all pre-defined variables to their default values.  Note\nthat assigning a value to scale also causes all pre-defined variables that control di‐\nmensions to be reset to their default values times the new value of scale.\n\nplot expr [\"text\"]\nThis  is  a  text  object  which  is  constructed by using text as a format string for\nsprintf with an argument of expr.  If text is omitted a format string of \"%g\" is used.\nAttributes  can  be  specified  in  the same way as for a normal text object.  Be very\ncareful that you specify an appropriate format string;  pic  does  only  very  limited\nchecking of the string.  This is deprecated in favour of sprintf.\n\nvariable := expr\nThis  is  similar  to  = except variable must already be defined, and expr will be as‐\nsigned to variable without creating a variable local to the current block.   (By  con‐\ntrast, = defines the variable in the current block if it is not already defined there,\nand then changes the value in the current block only.)  For example, the following:\n\n.PS\nx = 3\ny = 3\n[\nx := 5\ny = 5\n]\nprint x \" \" y\n.PE\n\nprints\n\n5 3\n\nArguments of the form\n\nX anything X\n\nare also allowed to be of the form\n\n{ anything }\n\nIn this case anything can contain balanced occurrences of { and }.  Strings may contain X  or\nimbalanced occurrences of { and }.\n\n#### Expressions\n\nThe syntax for expressions has been significantly extended:\n\nx ^ y (exponentiation)\nsin(x)\ncos(x)\natan2(y, x)\nlog(x) (base 10)\nexp(x) (base 10, i.e. 10^x)\nsqrt(x)\nint(x)\nrand() (return a random number between 0 and 1)\nrand(x) (return a random number between 1 and x; deprecated)\nsrand(x) (set the random number seed)\nmax(e1, e2)\nmin(e1, e2)\n!e\ne1 && e2\ne1 || e2\ne1 == e2\ne1 != e2\ne1 >= e2\ne1 > e2\ne1 <= e2\ne1 < e2\n\"str1\" == \"str2\"\n\"str1\" != \"str2\"\n\nString comparison expressions must be parenthesised in some contexts to avoid ambiguity.\n\n#### Other Changes\n\nA  bare  expression, expr, is acceptable as an attribute; it is equivalent to dir expr, where\ndir is the current direction.  For example\n\nline 2i\n\nmeans draw a line 2 inches long in the current direction.  The ‘i’ (or ‘I’) character is  ig‐\nnored; to use another measurement unit, set the scale variable to an appropriate value.\n\nThe  maximum  width and height of the picture are taken from the variables maxpswid and maxp‐‐\nsht.  Initially these have values 8.5 and 11.\n\nScientific notation is allowed for numbers.  For example\n\nx = 5e-2\n\nText attributes can be compounded.  For example,\n\n\"foo\" above ljust\n\nis valid.\n\nThere is no limit to the depth to which blocks can be examined.  For example,\n\n[A: [B: [C: box ]]] with .A.B.C.sw at 1,2\ncircle at last [].A.B.C\n\nis acceptable.\n\nArcs now have compass points determined by the circle of which the arc is a part.\n\nCircles, ellipses, and arcs can be dotted or dashed.  In TeX mode splines can  be  dotted  or\ndashed also.\n\nBoxes  can  have rounded corners.  The rad attribute specifies the radius of the quarter-cir‐\ncles at each corner.  If no rad or diam attribute is given, a radius of boxrad is used.  Ini‐\ntially, boxrad has a value of 0.  A box with rounded corners can be dotted or dashed.\n\nBoxes  can  have slanted sides.  This effectively changes the shape of a box from a rectangle\nto an arbitrary parallelogram.  The xslanted and yslanted attributes specify the x and y off‐\nset of the box's upper right corner from its default position.\n\nThe  .PS line can have a second argument specifying a maximum height for the picture.  If the\nwidth of zero is specified the width will be ignored in computing the scaling factor for  the\npicture.  Note that GNU pic will always scale a picture by the same amount vertically as well\nas horizontally.  This is different from the DWB 2.0 pic which may scale a picture by a  dif‐\nferent amount vertically than horizontally if a height is specified.\n\nEach  text  object has an invisible box associated with it.  The compass points of a text ob‐\nject are determined by this box.  The implicit motion associated with the object is also  de‐\ntermined  by  this  box.   The dimensions of this box are taken from the width and height at‐\ntributes; if the width attribute is not supplied then the width will be taken to be  textwid;\nif  the  height  attribute  is not supplied then the height will be taken to be the number of\ntext strings associated with the object times textht.  Initially textwid and  textht  have  a\nvalue of 0.\n\nIn (almost all) places where a quoted text string can be used, an expression of the form\n\nsprintf(\"format\", arg,...)\n\ncan also be used; this will produce the arguments formatted according to format, which should\nbe a string as described in printf(3) appropriate for the number of arguments supplied.\n\nThe thickness of the lines used to draw objects is  controlled  by  the  linethick  variable.\nThis  gives  the thickness of lines in points.  A negative value means use the default thick‐\nness: in TeX output mode, this means use a thickness of 8 milliinches;  in  TeX  output  mode\nwith the -c option, this means use the line thickness specified by .ps lines; in troff output\nmode, this means use a thickness proportional to the pointsize.  A zero value means draw  the\nthinnest  possible  line  supported  by  the  output device.  Initially it has a value of -1.\nThere is also a thick[ness] attribute.  For example,\n\ncircle thickness 1.5\n\nwould draw a circle using a line with a thickness of 1.5 points.  The thickness of  lines  is\nnot  affected by the value of the scale variable, nor by the width or height given in the .PS\nline.\n\nBoxes (including boxes with rounded corners or slanted sides), circles and  ellipses  can  be\nfilled  by  giving  them an attribute of fill[ed].  This takes an optional argument of an ex‐\npression with a value between 0 and 1; 0 will fill it with white, 1 with black, values in be‐\ntween  with a proportionally gray shade.  A value greater than 1 can also be used: this means\nfill with the shade of gray that is currently being used for text and lines.   Normally  this\nwill  be black, but output devices may provide a mechanism for changing this.  Without an ar‐\ngument, then the value of the variable fillval will be used.  Initially this has a  value  of\n0.5.   The  invisible  attribute does not affect the filling of objects.  Any text associated\nwith a filled object will be added after the object has been filled, so that  the  text  will\nnot be obscured by the filling.\n\nThree  additional  modifiers  are  available  to specify colored objects: outline[d] sets the\ncolor of the outline, shaded the fill color, and colo[u]r[ed] sets both.  All three  keywords\nexpect a suffix specifying the color, for example\n\ncircle shaded \"green\" outline \"black\"\n\nCurrently,  color  support isn't available in TeX mode.  Predefined color names for groff are\nin the device macro files, for example ps.tmac; additional colors can  be  defined  with  the\n.defcolor request (see the manual page of troff(1) for more details).\n\nTo  change  the name of the vbox in TeX mode, set the pseudo-variable figname (which is actu‐\nally a specially parsed command) within a picture.  Example:\n\n.PS\nfigname = foobar;\n...\n.PE\n\nThe picture is then available in the box \\foobar.\n\npic assumes that at the beginning of a picture both glyph and fill color are set to  the  de‐\nfault value.\n\nArrow heads will be drawn as solid triangles if the variable arrowhead is non-zero and either\nTeX mode is enabled or the -n option has not been given.  Initially  arrowhead  has  a  value\nof 1.  Note that solid arrow heads are always filled with the current outline color.\n\nThe  troff  output  of pic is device-independent.  The -T option is therefore redundant.  All\nnumbers are taken to be in inches; numbers are never  interpreted  to  be  in  troff  machine\nunits.\n\nObjects can have an aligned attribute.  This will only work if the postprocessor is grops, or\ngropdf.  Any text associated with an object having the  aligned  attribute  will  be  rotated\nabout the center of the object so that it is aligned in the direction from the start point to\nthe end point of the object.  Note that this attribute will have no effect for objects  whose\nstart and end points are coincident.\n\nIn places where nth is allowed ‘‘expr’’th is also allowed.  Note that ’’th is a single token: no\nspace is allowed between the ’’ and the th.  For example,\n\nfor i = 1 to 4 do {\nline from ‘‘i’’th box.nw to ‘‘i+1’’th box.se\n}\n\n### CONVERSION\n\nTo obtain a stand-alone picture from a pic file, enclose your pic code with .PS and  .PE  re‐\nquests;  roff  configuration  commands may be added at the beginning of the file, but no roff\ntext.\n\nIt is necessary to feed this file into groff without adding any page information, so you must\ncheck which .PS and .PE requests are actually called.  For example, the mm macro package adds\na page number, which is very annoying.  At the moment, calling  standard  groff  without  any\nmacro package works.  Alternatively, you can define your own requests, e.g. to do nothing:\n\n.de PS\n..\n.de PE\n..\n\ngroff  itself does not provide direct conversion into other graphics file formats.  But there\nare lots of possibilities if you first transform your picture into PostScript®  format  using\nthe  groff option -Tps.  Since this ps-file lacks BoundingBox information it is not very use‐\nful by itself, but it may be fed into other conversion programs, usually  named  ps2other  or\npstoother  or  the  like.  Moreover, the PostScript interpreter ghostscript (gs) has built-in\ngraphics conversion devices that are called with the option\n\ngs -sDEVICE=<devname>\n\nCall\n\ngs --help\n\nfor a list of the available devices.\n\nAn alternative may be to use the -Tpdf option to convert your picture directly into PDF  for‐\nmat.   The  MediaBox  of  the  file produced can be controlled by passing a -P-p papersize to\ngroff.\n\nAs the Encapsulated PostScript File Format EPS is getting more and more  important,  and  the\nconversion  wasn't regarded trivial in the past you might be interested to know that there is\na conversion tool named ps2eps which does the right job.  It is much  better  than  the  tool\nps2epsi packaged with gs.\n\nFor  bitmapped graphic formats, you should use pstopnm; the resulting (intermediate) PNM file\ncan be then converted to virtually any graphics format using the tools of the netpbm package.\n\n### FILES\n\n/usr/share/groff/1.22.4/tmac/pic.tmac\nExample definitions of the PS and PE macros.\n\n### SEE ALSO\n\ntroff(1), groffout(5), tex(1), gs(1), ps2eps(1), pstopnm(1), ps2epsi(1), pnm(5)\n\nEric S. Raymond, Making Pictures With GNU PIC.\n/usr/share/doc/groff-base/pic.ps (this file, together with its source file, pic.ms,  is  part\nof the groff documentation)\n\nTpic: Pic for TeX\n\nBrian  W.  Kernighan,  PIC  —  A  Graphics  Language  for  Typesetting (User Manual) ⟨http://\ncm.bell-labs.com/cm/cs/cstr/116.ps.gz⟩.  AT&T Bell Laboratories, Computing Science  Technical\nReport No. 116 (revised May, 1991).\n\nps2eps is available from CTAN mirrors, e.g. ⟨ftp://ftp.dante.de/tex-archive/support/ps2eps/⟩\n\nW. Richard Stevens, Turning PIC into HTML ⟨http://www.kohala.com/start/troff/pic2html.html⟩\n\nW.    Richard   Stevens,   Examples   of   pic   Macros   ⟨http://www.kohala.com/start/troff/\npic.examples.ps⟩\n\n### BUGS\n\nInput characters that are invalid for groff (i.e., those with ASCII code 0, or 013 octal,  or\nbetween 015 and 037 octal, or between 0200 and 0237 octal) are rejected even in TeX mode.\n\nThe interpretation of fillval is incompatible with the pic in 10th edition Unix, which inter‐\nprets 0 as black and 1 as white.\n\nPostScript® is a registered trademark of Adobe Systems Incorporation.\n\n\n\ngroff 1.22.4                                23 March 2022                                     PIC(1)\n\n"
        }
    ],
    "structuredContent": {
        "command": "pic",
        "section": "1",
        "mode": "man",
        "summary": "pic - compile pictures for troff or TeX",
        "synopsis": "pic [-nvCSU] [file ...]\npic -t [-cvzCSU] [file ...]",
        "flags": [
            {
                "flag": "-C",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-S",
                "long": null,
                "arg": null,
                "description": "worthy input (enabled by default)."
            },
            {
                "flag": "-S",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-n",
                "long": null,
                "arg": null,
                "description": "you are using a postprocessor that doesn't support these extensions. The extensions are described in groffout(5). The -n option also causes pic not to use zero-length lines to draw dots in troff mode."
            },
            {
                "flag": "-t",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-t",
                "long": null,
                "arg": null,
                "description": "through transparently. Lines beginning with . are passed through with the initial . changed to \\. A line beginning with .ps is given special treatment: it takes an op‐ tional 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 thickness attribute or by setting the linethick variable."
            },
            {
                "flag": "-v",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-z",
                "long": null,
                "arg": null,
                "description": "The following options supported by other versions of pic are ignored:"
            },
            {
                "flag": "-D",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-T",
                "long": null,
                "arg": null,
                "description": "put generated by pic is device-independent."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "troff",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/troff/1/json"
            },
            {
                "name": "groffout",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/groffout/5/json"
            },
            {
                "name": "tex",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/tex/1/json"
            },
            {
                "name": "gs",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/gs/1/json"
            },
            {
                "name": "ps2eps",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ps2eps/1/json"
            },
            {
                "name": "pstopnm",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pstopnm/1/json"
            },
            {
                "name": "ps2epsi",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ps2epsi/1/json"
            },
            {
                "name": "pnm",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/pnm/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 3,
                "subsections": [
                    {
                        "name": "-C",
                        "lines": 1,
                        "flag": "-C"
                    },
                    {
                        "name": "-S",
                        "lines": 2,
                        "flag": "-S"
                    },
                    {
                        "name": "-U -S",
                        "lines": 1,
                        "flag": "-S"
                    },
                    {
                        "name": "-n",
                        "lines": 4,
                        "flag": "-n"
                    },
                    {
                        "name": "-t",
                        "lines": 1,
                        "flag": "-t"
                    },
                    {
                        "name": "-c -t",
                        "lines": 8,
                        "flag": "-t"
                    },
                    {
                        "name": "-v",
                        "lines": 1,
                        "flag": "-v"
                    },
                    {
                        "name": "-z",
                        "lines": 2,
                        "flag": "-z"
                    },
                    {
                        "name": "-D",
                        "lines": 1,
                        "flag": "-D"
                    },
                    {
                        "name": "-T",
                        "lines": 2,
                        "flag": "-T"
                    }
                ]
            },
            {
                "name": "USAGE",
                "lines": 6,
                "subsections": [
                    {
                        "name": "TeX mode",
                        "lines": 28
                    },
                    {
                        "name": "Commands",
                        "lines": 69
                    },
                    {
                        "name": "reset",
                        "lines": 44
                    },
                    {
                        "name": "Expressions",
                        "lines": 29
                    },
                    {
                        "name": "Other Changes",
                        "lines": 131
                    }
                ]
            },
            {
                "name": "CONVERSION",
                "lines": 41,
                "subsections": []
            },
            {
                "name": "FILES",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 11,
                "subsections": []
            }
        ]
    }
}