{
    "mode": "man",
    "parameter": "GRN",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/man/GRN/json",
    "generated": "2026-10-22T13:18:22Z",
    "sections": {
        "Name": {
            "content": "grn - embed Gremlin images in groff documents\n",
            "subsections": []
        },
        "Synopsis": {
            "content": "grn [-C] [-T dev] [-M dir] [-F dir] [file ...]\n",
            "subsections": [
                {
                    "name": "grn -?",
                    "content": ""
                },
                {
                    "name": "grn --help",
                    "content": ""
                },
                {
                    "name": "grn -v",
                    "content": ""
                },
                {
                    "name": "grn --version",
                    "content": ""
                }
            ]
        },
        "Description": {
            "content": "grn  is a preprocessor for including gremlin pictures in troff(1) input.  grn writes to stan‐\ndard output, processing only input lines between two that start  with  .GS  and  .GE.   Those\nlines  must  contain grn commands (see below).  These macros request a gremlin file; the pic‐\nture in that file is converted and placed in the troff input stream.  .GS may be called  with\na  C,  L, or R argument to center, left-, or right-justify the whole gremlin picture (the de‐\nfault is to center).  If no file is mentioned, the standard input is read.  At the end of the\npicture, the position on the page is the bottom of the gremlin picture.  If the grn entry  is\nended with .GF instead of .GE, the position is left at the top of the picture.\n\nCurrently only the me macro package has support for .GS, .GE, and .GF.\n\ngrn  produces  drawing  escape sequences that use groff's color scheme extension (\\D'F ...'),\nand thus may not work with other troffs.\n\ngrn commands\nEach input line between .GS and .GE may have one grn command.  Commands consist of one or two\nstrings separated by white space, the first string being  the  command  and  the  second  its\noperand.  Commands may be upper- or lowercase and abbreviated down to one character.\n\nCommands  that  affect a picture's environment (those listed before “default”, see below) are\nonly in effect for the current picture: the environment is reinitialized to the  defaults  at\nthe start of the next picture.  The commands are as follows.\n\n1 N\n2 N\n3 N\n4 N    Set gremlin's text size number 1 (2, 3, or 4) to N points.  The default is 12 (16, 24,\nand 36, respectively).\n\nroman f\nitalics f\nbold f\nspecial f\nSet  the  roman  (italics,  bold, or special) font to troff's font f (either a name or\nnumber).  The default is R (I, B, and S, respectively).\n\nl f\nstipple f\nSet the stipple font to troff's stipple font f (name or number).  The command  stipple\nmay  be abbreviated down as far as “st” (to avoid confusion with “special”).  There is\nno default for stipples (unless one is set by the “default” command), and  it  is  in‐\nvalid to include a gremlin picture with polygons without specifying a stipple font.\n\nx N\nscale N\nMagnify  the picture (in addition to any default magnification) by N, a floating-point\nnumber larger than zero.  The command scale may be abbreviated down to “sc”.\n\nnarrow N\nmedium N\nthick N\nSet the thickness of gremlin's narrow (medium and  thick,  respectively)  lines  to  N\ntimes 0.15pt (this value can be changed at compile time).  The default is 1.0 (3.0 and\n5.0,  respectively), which corresponds to 0.15pt (0.45pt and 0.75pt, respectively).  A\nthickness value of zero selects the smallest available line thickness.  Negative  val‐\nues cause the line thickness to be proportional to the current point size.\n\npointscale [off|on]\nScale  text  to  match the picture.  Gremlin text is usually printed in the point size\nspecified with the commands 1, 2, 3, or 4, regardless of any scaling  factors  in  the\npicture.   Setting  pointscale  will  cause  the point sizes to scale with the picture\n(within troff's limitations, of course).  An operand of anything  but  off  will  turn\ntext scaling on.\n",
            "subsections": [
                {
                    "name": "default",
                    "content": "Reset  the  picture environment defaults to the settings in the current picture.  This\nis meant to be used as a global parameter setting mechanism at the  beginning  of  the\ntroff input file, but can be used at any time to reset the default settings.\n\nwidth N\nForce  the picture to be N inches wide.  This overrides any scaling factors present in\nthe same picture.  “width 0” is ignored.\n\nheight N\nForce the picture to be N inches high, overriding  other  scaling  factors.   If  both\nwidth and height are specified, the tighter constraint will determine the scale of the\npicture.   height  and  width  commands  are not saved with a “default” command.  They\nwill, however, affect point size scaling if that option is set.\n\nfile name\nGet picture from gremlin file name located the current directory (or  in  the  library\ndirectory;  see  the  -M option above).  If multiple file commands are given, the last\none controls.  If name doesn't exist, an error message is reported and processing con‐\ntinues from the .GE line.\n"
                },
                {
                    "name": "Usage with groff",
                    "content": "Since grn is a preprocessor, it has no access to elements of formatter state, such as  inden‐\ntation,  line  length,  type  size,  or register values.  Consequently, no troff input can be\nplaced between the .GS and .GE macros.   However,  gremlin  text  elements  are  subsequently\nprocessed  by  troff, so anything valid in a single line of troff input is valid in a line of\ngremlin text (barring the dot control character “.” at the beginning of a line).  Thus, it is\npossible to have equations within a gremlin figure by including in the gremlin file  eqn  ex‐\npressions enclosed by previously defined delimiters (e.g., “$$”).\n\nWhen  using  grn along with other preprocessors, it is best to run tbl(1) before grn, pic(1),\nand/or ideal to avoid overworking tbl.  eqn(1) should always be run last.  groff(1) will  au‐\ntomatically run preprocessors in the correct order.\n\nA  picture is considered an entity, but that doesn't stop troff from trying to break it up if\nit falls off the end of a page.  Placing the picture between “keeps” in the  me  macros  will\nensure proper placement.\n\ngrn uses troff's registers g1 through g9 and sets registers g1 and g2 to the width and height\nof  the gremlin figure (in device units) before entering the .GS macro (this is for those who\nwant to rewrite these macros).\n"
                },
                {
                    "name": "Gremlin file format",
                    "content": "There exist two distinct gremlin file formats: the original format for AED graphic terminals,\nand the Sun or X11 version.  An extension used by  the  Sun/X11  version  allowing  reference\npoints  with negative coordinates is not compatible with the AED version.  As long as a grem‐\nlin file does not contain negative coordinates, either format will be read correctly  by  ei‐\nther  version  of gremlin or grn.  The other difference in Sun/X11 format is the use of names\nfor picture objects (e.g., POLYGON, CURVE) instead of numbers.  Files representing  the  same\npicture are shown below.\n\nsungremlinfile        gremlinfile\n0 240.00 128.00       0 240.00 128.00\nCENTCENT              2\n240.00 128.00         240.00 128.00\n185.00 120.00         185.00 120.00\n240.00 120.00         240.00 120.00\n296.00 120.00         296.00 120.00\n*                     -1.00 -1.00\n2 3                   2 3\n10 A Triangle         10 A Triangle\nPOLYGON               6\n224.00 416.00         224.00 416.00\n96.00 160.00          96.00 160.00\n384.00 160.00         384.00 160.00\n*                     -1.00 -1.00\n5 1                   5 1\n0                     0\n-1                    -1\n\n• The first line of each gremlin file contains either the string “gremlinfile” (AED) or “sun‐\ngremlinfile” (Sun/X11).\n\n• The  second  line  of the file contains an orientation and x and y values for a positioning\npoint, separated by spaces.  The orientation, either 0 or 1, is ignored by the Sun/X11 ver‐\nsion.  0 means that gremlin will display things in horizontal format (a drawing area  wider\nthan  it is tall, with a menu across the top).  1 means that gremlin will display things in\nvertical format (a drawing area taller than it is wide, with a menu on the left  side).   x\nand  y  are  floating-point  values giving a positioning point to be used when this file is\nread into another file.  The stuff on this line really isn't all that important; a value of\n“1 0.00 0.00” is suggested.\n\n• The rest of the file consists of zero or more element specifications.  After the last  ele‐\nment specification is a line containing the string “-1”.\n\n• Lines longer than 127 characters are truncated to that length.\n"
                },
                {
                    "name": "Element specifications",
                    "content": "• The first line of each element contains a single decimal number giving the type of the ele‐\nment (AED) or its name (Sun/X11).\n\ngremlin File Format: Object Type Specification\n─────────────────────────────────────────────────────────\nAED Number   Sun/X11 Name           Description\n0       BOTLEFT        bottom-left-justified text\n1       BOTRIGHT       bottom-right-justified text\n2       CENTCENT       center-justified text\n3       VECTOR         vector\n4       ARC            arc\n5       CURVE          curve\n6       POLYGON        polygon\n7       BSPLINE        b-spline\n8       BEZIER         Bézier\n10       TOPLEFT        top-left-justified text\n11       TOPCENT        top-center-justified text\n12       TOPRIGHT       top-right-justified text\n13       CENTLEFT       left-center-justified text\n14       CENTRIGHT      right-center-justified text\n15       BOTCENT        bottom-center-justified text\n\n• After  the  object  type  comes a variable number of lines, each specifying a point used to\ndisplay the element.  Each line contains an x-coordinate and a  y-coordinate  in  floating-\npoint  format,  separated by spaces.  The list of points is terminated by a line containing\nthe string “-1.0 -1.0” (AED) or a single asterisk, “*” (Sun/X11).\n\n• After the points comes a line containing two decimal values, giving the brush and size  for\nthe element.  The brush determines the style in which things are drawn.  For vectors, arcs,\nand curves there are six valid brush values.\n\n1   thin dotted lines\n2   thin dot-dashed lines\n3   thick solid lines\n4   thin dashed lines\n5   thin solid lines\n6   medium solid lines\n\nFor  polygons,  one more value, 0, is valid.  It specifies a polygon with an invisible bor‐\nder.  For text, the brush selects a font as follows.\n\n1   roman (R font in troff)\n2   italics (I font in troff)\n3   bold (B font in troff)\n4   special (S font in troff)\n\nIf you're using grn to run your pictures through groff, the font is really just a  starting\nfont.  The text string can contain formatting sequences like “\\fI” or “\\d” which may change\nthe  font  (as  well as do many other things).  For text, the size field is a decimal value\nbetween 1 and 4.  It selects the size of the font in which the text  will  be  drawn.   For\npolygons, this size field is interpreted as a stipple number to fill the polygon with.  The\nnumber is used to index into a stipple font at print time.\n\n• The  last  line of each element contains a decimal number and a string of characters, sepa‐\nrated by a single space.  The number is a count of the number of characters in the  string.\nThis  information  is used only for text elements, and contains the text string.  There can\nbe spaces inside the text.  For arcs, curves, and vectors, the character count is zero (0),\nfollowed by exactly one space before the newline.\n"
                },
                {
                    "name": "Coordinates",
                    "content": "gremlin was designed for AED terminals, and its coordinates reflect the AED coordinate space.\nFor vertical pictures, x values range 116 to 511, and y values from 0 to 483.  For horizontal\npictures, x values range from 0 to 511, and y values from 0 to 367.  Although you needn't ab‐\nsolutely stick to this range, you'll get better results if you at least stay in  this  vicin‐\nity.  Also, point lists are terminated by a point of (-1, -1), so you shouldn't ever use neg‐\native  coordinates.   gremlin writes out coordinates using the printf(3) format “%f1.2”; it's\nprobably a good idea to use the same format if you want to modify the grn code.\n"
                },
                {
                    "name": "Sun/X11 coordinates",
                    "content": "There is no restriction on the range of coordinates used to create  objects  in  the  Sun/X11\nversion  of  gremlin.   However,  files with negative coordinates will cause problems if dis‐\nplayed on the AED.\n"
                }
            ]
        },
        "Options": {
            "content": "-? and --help display a usage message, while -v and --version show version  information;  all\nexit afterward.\n",
            "subsections": [
                {
                    "name": "-C",
                    "content": "newline.\n",
                    "flag": "-C"
                },
                {
                    "name": "-F _",
                    "content": "DESC  file before the default font directories /usr/share/groff/site-font, /usr/share/\ngroff/1.23.0/font, and /usr/lib/font.\n",
                    "flag": "-F"
                },
                {
                    "name": "-M _",
                    "content": "rent directory, the home directory, /usr/share/groff/site-tmac, and  /usr/share/groff/\n1.23.0/tmac, in that order.\n",
                    "flag": "-M"
                },
                {
                    "name": "-T _",
                    "content": "list of valid devices.\n",
                    "flag": "-T"
                }
            ]
        },
        "Files": {
            "content": "/usr/share/groff/1.23.0/font/devname/DESC\ndescribes the output device name.\n",
            "subsections": []
        },
        "Authors": {
            "content": "David Slattengren and Barry Roitblat wrote the original Berkeley grn.  Daniel Senderowicz and\nWerner Lemberg modified it for groff.\n\nSee also\ngremlin(1), groff(1), pic(1), ideal(1)\n\ngroff 1.23.0                                31 March 2024                                     grn(1)",
            "subsections": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}