{
    "mode": "man",
    "parameter": "gpic",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/gpic/1/json",
    "generated": "2026-09-04T22:07:31Z",
    "sections": {
        "Name": {
            "content": "pic - compile pictures for troff or TeX\n",
            "subsections": []
        },
        "Synopsis": {
            "content": "pic [-CnSU] [file ...]\n\npic -t [-cCSUz] [file ...]\n",
            "subsections": [
                {
                    "name": "pic --help",
                    "content": ""
                },
                {
                    "name": "pic -v",
                    "content": ""
                },
                {
                    "name": "pic --version",
                    "content": ""
                }
            ]
        },
        "Description": {
            "content": "The  GNU  implementation of pic is part of the \u001b]8;;man:groff(1)\u001b\\groff(1)\u001b]8;;\u001b\\ document formatting system.  pic is a\n\u001b]8;;man:troff(1)\u001b\\troff(1)\u001b]8;;\u001b\\ preprocessor that translates  descriptions  of  diagrammatic  pictures  embedded  in\n\u001b]8;;man:roff(7)\u001b\\roff(7)\u001b]8;;\u001b\\  or TeX input files into the language understood by TeX or troff.  It copies the con‐\ntents of each file to the standard output stream, except that lines between .PS  and  any  of\n.PE, .PF, or .PY are interpreted as picture descriptions in the pic language.  End a pic pic‐\nture with .PE to leave the drawing position at the bottom of the picture, and with .PF or .PY\nto  leave  it at the top.  Normally, pic is not executed directly by the user, but invoked by\nspecifying the -p option to \u001b]8;;man:groff(1)\u001b\\groff(1)\u001b]8;;\u001b\\.  If no file operands are given on the command line,  or\nif file is “-”, the standard input stream is read.\n\nIt  is the user's responsibility to provide appropriate definitions of the PS, PE, and one or\nboth of the PF and PY macros.  When a macro package does not supply these, obtain simple def‐\ninitions with the groff option -mpic; these will center each picture.\n\nGNU pic supports PY as a synonym of PF to work around a name  space  collision  with  the  mm\nmacro package, which defines PF as a page footer management macro.  Use PF preferentially un‐\nless a similar problem faces your document.\n",
            "subsections": []
        },
        "Options": {
            "content": "--help  displays  a  usage message, while -v and --version show version information; all exit\nafterward.\n",
            "subsections": [
                {
                    "name": "-c      -t",
                    "content": "through  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\n8  milliinches.   The line thickness thus specified takes effect only when a non-nega‐\ntive line thickness has not been specified by use of the  thickness  attribute  or  by\nsetting the linethick variable.\n",
                    "flag": "-t"
                },
                {
                    "name": "-C",
                    "content": "newline.\n",
                    "flag": "-C"
                },
                {
                    "name": "-n",
                    "content": "postprocessor  you're  using  doesn't   support   these   extensions,   described   in\n\u001b]8;;man:groffout(5)\u001b\\groffout(5)\u001b]8;;\u001b\\.   This  option also causes pic not to use zero-length lines to draw dots\nin troff mode.\n",
                    "flag": "-n"
                },
                {
                    "name": "-S",
                    "content": "useful when operating on untrustworthy input.\n",
                    "flag": "-S"
                },
                {
                    "name": "-t",
                    "content": "",
                    "flag": "-t"
                },
                {
                    "name": "-U",
                    "content": "",
                    "flag": "-U"
                },
                {
                    "name": "-z",
                    "content": "The following options supported by other versions of pic are ignored.\n",
                    "flag": "-z"
                },
                {
                    "name": "-D",
                    "content": "",
                    "flag": "-D"
                },
                {
                    "name": "-T _",
                    "content": "put generated by GNU pic is device-independent.\n",
                    "flag": "-T"
                }
            ]
        },
        "Usage": {
            "content": "This  section  primarily discusses the differences between GNU pic and the Eighth Edition Re‐\nsearch Unix version of AT&T pic (1985).  Many of these differences also apply to  later  ver‐\nsions of AT&T pic.\n",
            "subsections": [
                {
                    "name": "TeX mode",
                    "content": "TeX-compatible output is produced when the -t option is specified.  You must use a TeX driver\nthat  supports  tpic  version  2 specials.  (tpic was a fork of AT&T pic by Tim Morgan of the\nUniversity of California at Irvine that diverged from its source around  1984.   It  is  best\nknown today for lending its name to a group of \\special commands it produced for TeX.)\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  the  value  of\n\\baselineskip.  Anything else may well produce undesirable results; use at your own risk.  By\ndefault, lines beginning with a dot are not treated specially—but see the -c option.\n\nIn  TeX  mode,  pic will define a vbox called \\graph for each picture.  Use GNU pic's figname\ncommand to change the name of the vbox.  You must print that vbox yourself using the command\n\\centerline{\\box\\graph}\nfor instance.  Since the vbox has a height of zero (it is defined with \\vtop) this will  pro‐\nduce slightly more vertical space above the picture than below it;\n\\centerline{\\raise 1em\\box\\graph}\nwould avoid this.  To give the vbox a positive height and a depth of zero (as used by LaTeX's\ngraphics.sty, for example) define the following macro in your document.\n\\def\\gpicbox#1{%\n\\vbox{\\unvbox\\csname #1\\endcsname\\kern 0pt}}\nYou can then simply say \\gpicbox{graph} instead of \\box\\graph.\n"
                },
                {
                    "name": "Commands",
                    "content": "Several  commands  new  to  GNU pic accept delimiters, shown in their synopses as braces { }.\nNesting of braces is supported.  Any other characters (except a space, tab, or  newline)  may\nbe  used as alternative delimiters, in which case the members of a given pair must be identi‐\ncal.  Strings are recognized within delimiters of either kind; they may contain the delimiter\ncharacter or unbalanced braces.\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 and write arguments to the standard error stream followed  by  a  newline.\nEach arg must be an expression, a position, or text.  This is useful for debugging.\n\ncommand arg ...\nConcatenate  arguments  and  pass them as a line to troff or TeX.  Each arg must be an\nexpression, a position, or text.  command allows the values of  pic  variables  to  be\npassed to the formatter.  For example,\n.PS\nx = 14\ncommand \".ds string x is \" x \".\"\n.PE\n\\*[string]\nproduces\nx is 14.\nwhen formatted with troff.\n\nsh X command X\nPass command to a shell.\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.PS\ncopy thru % circle at ($1,$2) % until \"END\"\n1 2\n3 4\n5 6\nEND\nbox\n.PE\nand\n.PS\ncircle at (1,2)\ncircle at (3,4)\ncircle at (5,6)\nbox\n.PE\nare  equivalent.   The commands to be performed for each line can also be taken from a\nmacro defined earlier by giving the name of the macro as the argument  to  thru.   The\nargument  after  thru  is  looked  up as a macro name first; if not defined, its first\ncharacter is interpreted as a delimiter.\n"
                },
                {
                    "name": "reset",
                    "content": "reset pvar1[,] pvar2 ...\nReset predefined variables pvar1, pvar2 ... to their default values; if  no  arguments\nare given, reset all predefined variables to their default values.  Variable names may\nbe  separated  by commas, spaces, or both.  Assigning a value to scale also causes all\npredefined variables that control dimensions to be reset to their default values times\nthe 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\nvar := expr\nThis  syntax  resembles variable assignment with = except that var must already be de‐\nfined, and expr will be assigned to var without creating a variable local to the  cur‐\nrent block.  (By contrast, = defines var in the current block if it is not already de‐\nfined there, and then changes the value in the current block only.)  For example,\n.PS\nx = 3\ny = 3\n[\nx := 5\ny = 5\n]\nprint x   y\n.PE\nwrites\n5 3\nto the standard error stream.\n"
                },
                {
                    "name": "Expressions",
                    "content": "The 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"
                },
                {
                    "name": "Other changes",
                    "content": "A  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.   GNU pic will always scale a picture by the same amount vertically as well as hori‐\nzontally.  This is different from DWB 2.0 pic which may scale a picture by a different amount\nvertically 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 attrib‐\nutes; if the width attribute is not supplied then the width will be taken to be  textwid;  if\nthe  height  attribute is not supplied then the height will be taken to be the number of text\nstrings associated with the object times textht.  Initially, textwid and textht have a  value\nof 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 \u001b]8;;man:printf(3)\u001b\\printf(3)\u001b]8;;\u001b\\ appropriate for the number of arguments supplied.  Only\nthe  modifiers “#”, “-”, “+”, and “ ” [space]), a minimum field width, an optional precision,\nand the conversion specifiers %e, %E, %f, %g, %G, and %% are supported.\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\nAdditional  modifiers are available to draw colored objects: outline[d] sets the color of the\noutline, shaded the fill color, and colo[u]r[ed] sets both.  All expect a  subsequent  string\nargument specifying the color.\ncircle shaded \"green\" outline \"black\"\nColor is not yet supported in TeX mode.  Device macro files like ps.tmac declare color names;\nyou can define additional ones with the defcolor request (see \u001b]8;;man:groff(7)\u001b\\groff(7)\u001b]8;;\u001b\\).\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.  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  \u001b]8;;man:grops(1)\u001b\\grops(1)\u001b]8;;\u001b\\\nor  \u001b]8;;man:gropdf(1)\u001b\\gropdf(1)\u001b]8;;\u001b\\.   Any  text associated with an object having the aligned attribute will be ro‐\ntated about the center of the object so that it is aligned in the direction  from  the  start\npoint  to  the  end point of the object.  This attribute will have no effect on objects whose\nstart and end points are coincident.\n\nIn places where nth is allowed, 'expr'th is also allowed.  “'th“ is a single token: no  space\nis allowed between the apostrophe 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"
                }
            ]
        },
        "Conversion": {
            "content": "To  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(1)) 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) \u001b]8;;man:pnm(5)\u001b\\pnm(5)\u001b]8;;\u001b\\\nfile can be then converted to virtually any graphics format using the  tools  of  the  netpbm\npackage.\n",
            "subsections": []
        },
        "Files": {
            "content": "/usr/share/groff/1.23.0/tmac/pic.tmac\noffers simple definitions of the PS, PE, PF, and PY macros.\n",
            "subsections": []
        },
        "Bugs": {
            "content": "Characters  that  are  invalid  as  input  to  GNU  troff  (see  the  groff Texinfo manual or\n\u001b]8;;man:groffchar(7)\u001b\\groffchar(7)\u001b]8;;\u001b\\ for a list) are rejected even in TeX mode.\n\nThe interpretation of fillval is incompatible with the pic in Tenth  Edition  Research  Unix,\nwhich interprets 0 as black and 1 as white.\n\nSee also\n/usr/share/doc/groff-base/pic.ps.gz\n“Making  Pictures  with  GNU  pic”,  by Eric S. Raymond.  This file, together with its\nsource, pic.ms, is part of the groff distribution.\n\n“PIC—A Graphics Language for Typesetting: User Manual”, by Brian W. Kernighan, 1984  (revised\n1991), AT&T Bell Laboratories Computing Science Technical Report No. 116\n\nps2eps is available from CTAN mirrors, e.g., \u001b]8;;ftp://ftp.dante.de/tex-archive/support/ps2eps/\u001b\\ftp://ftp.dante.de/tex-archive/support/ps2eps/\u001b]8;;\u001b\\\n\nW. Richard Stevens, \u001b]8;;http://www.kohala.com/start/troff/pic2html.html\u001b\\Turning PIC into HTML\u001b]8;;\u001b\\\n\nW. Richard Stevens, \u001b]8;;http://www.kohala.com/start/troff/pic.examples.ps\u001b\\Examples of pic Macros\u001b]8;;\u001b\\\n\n\u001b]8;;man:troff(1)\u001b\\troff(1)\u001b]8;;\u001b\\, \u001b]8;;man:groffout(5)\u001b\\groffout(5)\u001b]8;;\u001b\\, \u001b]8;;man:tex(1)\u001b\\tex(1)\u001b]8;;\u001b\\, \u001b]8;;man:gs(1)\u001b\\gs(1)\u001b]8;;\u001b\\, \u001b]8;;man:ps2eps(1)\u001b\\ps2eps(1)\u001b]8;;\u001b\\, \u001b]8;;man:pstopnm(1)\u001b\\pstopnm(1)\u001b]8;;\u001b\\, \u001b]8;;man:ps2epsi(1)\u001b\\ps2epsi(1)\u001b]8;;\u001b\\, \u001b]8;;man:pnm(5)\u001b\\pnm(5)\u001b]8;;\u001b\\\n\ngroff 1.23.0                                31 March 2024                                     pic(1)",
            "subsections": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}