1GROFF(1) General Commands Manual GROFF(1)
2
3
4
6 groff - front-end for the groff document formatting system
7
9 groff [-abcegiklpstzCEGNRSUVXZ] [-d cs] [-D arg] [-f fam] [-F dir]
10 [-I dir] [-K arg] [-L arg] [-m name] [-M dir] [-n num] [-o list]
11 [-P arg] [-r cn] [-T dev] [-w name] [-W name] [file ...]
12 groff -h | --help
13 groff -v | --version [option ...]
14
16 This document describes the groff program, the main front-end for the
17 groff document formatting system. The groff program and macro suite is
18 the implementation of a roff(7) system within the free software collec‐
19 tion GNU ⟨http://www.gnu.org⟩. The groff system has all features of
20 the classical roff, but adds many extensions.
21
22 The groff program allows to control the whole groff system by command
23 line options. This is a great simplification in comparison to the
24 classical case (which uses pipes only).
25
27 The command line is parsed according to the usual GNU convention. The
28 whitespace between a command line option and its argument is optional.
29 Options can be grouped behind a single `-' (minus character). A file‐
30 name of - (minus character) denotes the standard input.
31
32 As groff is a wrapper program for troff both programs share a set of
33 options. But the groff program has some additional, native options and
34 gives a new meaning to some troff options. On the other hand, not all
35 troff options can be fed into groff.
36
37 Native groff Options
38 The following options either do not exist for troff or are differently
39 interpreted by groff.
40
41 -D arg Set default input encoding used by preconv to arg. Implies -k.
42
43 -e Preprocess with eqn.
44
45 -g Preprocess with grn.
46
47 -G Preprocess with grap.
48
49 -h
50 --help Print a help message.
51
52 -I dir This option may be used to specify a directory to search for
53 files (both those on the command line and those named in .psbb
54 and .so requests, and \X'ps: import' and \X'ps: file' escapes).
55 The current directory is always searched first. This option may
56 be specified more than once; the directories are searched in the
57 order specified. No directory search is performed for files
58 specified using an absolute path. This option implies the -s
59 option.
60
61 -k Preprocess with preconv. This is run before any other pre‐
62 processor. Please refer to preconv's manual page for its behav‐
63 iour if no -K (or -D) option is specified.
64
65 -K arg Set input encoding used by preconv to arg. Implies -k.
66
67 -l Send the output to a spooler program for printing. The command
68 that should be used for this is specified by the print command
69 in the device description file, see groff_font(5). If this com‐
70 mand is not present, the output is piped into the lpr(1) program
71 by default. See options -L and -X.
72
73 -L arg Pass arg to the spooler program. Several arguments should be
74 passed with a separate -L option each. Note that groff does not
75 prepend `-' (a minus sign) to arg before passing it to the
76 spooler program.
77
78 -N Don't allow newlines within eqn delimiters. This is the same as
79 the -N option in eqn.
80
81 -p Preprocess with pic.
82
83 -P -option
84 -P -option -P arg
85 Pass -option or -option arg to the postprocessor. The option
86 must be specified with the necessary preceding minus sign(s) ‘-’
87 or ‘--’ because groff does not prepend any dashes before passing
88 it to the postprocessor. For example, to pass a title to the
89 gxditview postprocessor, the shell command
90
91 groff -X -P -title -P 'groff it' foo
92
93 is equivalent to
94
95 groff -X -Z foo | gxditview -title 'groff it' -
96
97 -R Preprocess with refer. No mechanism is provided for passing
98 arguments to refer because most refer options have equivalent
99 language elements that can be specified within the document.
100 See refer(1) for more details.
101
102 -s Preprocess with soelim.
103
104 -S Safer mode. Pass the -S option to pic and disable the following
105 troff requests: .open, .opena, .pso, .sy, and .pi. For security
106 reasons, safer mode is enabled by default.
107
108 -t Preprocess with tbl.
109
110 -T dev Set output device to dev. For this device, troff generates the
111 intermediate output; see groff_out(5). Then groff calls a post‐
112 processor to convert troff's intermediate output to its final
113 format. Real devices in groff are
114
115 dvi TeX DVI format (postprocessor is grodvi).
116
117 html
118 xhtml HTML and XHTML output (preprocessors are soelim
119 and pre-grohtml, postprocessor is post-grohtml).
120
121 lbp Canon CAPSL printers (LBP-4 and LBP-8 series laser
122 printers; postprocessor is grolbp).
123
124 lj4 HP LaserJet4 compatible (or other PCL5 compatible)
125 printers (postprocessor is grolj4).
126
127 ps PostScript output (postprocessor is grops).
128
129 For the following TTY output devices (postprocessor is always
130 grotty), -T selects the output encoding:
131
132 ascii 7bit ASCII.
133
134 cp1047 Latin-1 character set for EBCDIC hosts.
135
136 latin1 ISO 8859-1.
137
138 utf8 Unicode character set in UTF-8 encoding.
139
140 The following arguments select gxditview as the `postprocessor'
141 (it is rather a viewing program):
142
143 X75 75dpi resolution, 10pt document base font.
144
145 X75-12 75dpi resolution, 12pt document base font.
146
147 X100 100dpi resolution, 10pt document base font.
148
149 X100-12
150 100dpi resolution, 12pt document base font.
151
152 The default device is ps.
153
154 -U Unsafe mode. Reverts to the (old) unsafe behaviour; see option
155 -S.
156
157 -v
158 --version
159 Output version information of groff and of all programs that are
160 run by it; that is, the given command line is parsed in the
161 usual way, passing -v to all subprograms.
162
163 -V Output the pipeline that would be run by groff (as a wrapper
164 program) on the standard output, but do not execute it. If
165 given more than once, the commands are both printed on the stan‐
166 dard error and run.
167
168 -X Use gxditview instead of using the usual postprocessor to
169 (pre)view a document. The printing spooler behavior as outlined
170 with options -l and -L is carried over to gxditview(1) by deter‐
171 mining an argument for the -printCommand option of gxditview(1).
172 This sets the default Print action and the corresponding menu
173 entry to that value. -X only produces good results with -Tps,
174 -TX75, -TX75-12, -TX100, and -TX100-12. The default resolution
175 for previewing -Tps output is 75dpi; this can be changed by
176 passing the -resolution option to gxditview, for example
177
178 groff -X -P-resolution -P100 -man foo.1
179
180 -z Suppress output generated by troff. Only error messages are
181 printed.
182
183 -Z Do not automatically postprocess groff intermediate output in
184 the usual manner. This will cause the troff output to appear on
185 standard output, replacing the usual postprocessor output; see
186 groff_out(5).
187
188 Transparent Options
189 The following options are transparently handed over to the formatter
190 program troff that is called by groff subsequently. These options are
191 described in more detail in troff(1).
192
193 -a ASCII approximation of output.
194
195 -b Backtrace on error or warning.
196
197 -c Disable color output. Please consult the grotty(1) man page for
198 more details.
199
200 -C Enable compatibility mode.
201
202 -d cs
203 -d name=s
204 Define string.
205
206 -E Disable troff error messages.
207
208 -f fam Set default font family.
209
210 -F dir Set path for font DESC files.
211
212 -i Process standard input after the specified input files.
213
214 -m name
215 Include macro file name.tmac (or tmac.name); see also
216 groff_tmac(5).
217
218 -M dir Path for macro files.
219
220 -n num Number the first page num.
221
222 -o list
223 Output only pages in list.
224
225 -r cn
226 -r name=n
227 Set number register.
228
229 -w name
230 Enable warning name.
231
232 -W name
233 disable warning name.
234
236 The groff system implements the infrastructure of classical roff; see
237 roff(7) for a survey on how a roff system works in general. Due to the
238 front-end programs available within the groff system, using groff is
239 much easier than classical roff. This section gives an overview of the
240 parts that constitute the groff system. It complements roff(7) with
241 groff-specific features. This section can be regarded as a guide to
242 the documentation around the groff system.
243
244 Paper Size
245 The virtual paper size used by troff to format the input is controlled
246 globally with the requests .po, .pl, and .ll. See groff_tmac(5) for
247 the `papersize' macro package which provides a convenient interface.
248
249 The physical paper size, giving the actual dimensions of the paper
250 sheets, is controlled by output devices like grops with the command
251 line options -p and -l. See groff_font(5) and the man pages of the
252 output devices for more details. groff uses the command line option -P
253 to pass options to output devices; for example, the following selects
254 A4 paper in landscape orientation for the PS device:
255
256 groff -Tps -P-pa4 -P-l ...
257
258 Front-ends
259 The groff program is a wrapper around the troff(1) program. It allows
260 to specify the preprocessors by command line options and automatically
261 runs the postprocessor that is appropriate for the selected device.
262 Doing so, the sometimes tedious piping mechanism of classical roff(7)
263 can be avoided.
264
265 The grog(1) program can be used for guessing the correct groff command
266 line to format a file.
267
268 The groffer(1) program is an allround-viewer for groff files and man
269 pages.
270
271 Preprocessors
272 The groff preprocessors are reimplementations of the classical pre‐
273 processors with moderate extensions. The standard preprocessors dis‐
274 tributed with the groff package are
275
276 eqn(1) for mathematical formulæ,
277
278 grn(1) for including gremlin(1) pictures,
279
280 pic(1) for drawing diagrams,
281
282 chem(1)
283 for chemical structure diagrams,
284
285 refer(1)
286 for bibliographic references,
287
288 soelim(1)
289 for including macro files from standard locations,
290
291 and
292
293 tbl(1) for tables.
294
295 A new preprocessor not available in classical troff is preconv(1) which
296 converts various input encodings to something groff can understand. It
297 is always run first before any other preprocessor.
298
299 Besides these, there are some internal preprocessors that are automati‐
300 cally run with some devices. These aren't visible to the user.
301
302 Macro Packages
303 Macro packages can be included by option -m. The groff system imple‐
304 ments and extends all classical macro packages in a compatible way and
305 adds some packages of its own. Actually, the following macro packages
306 come with groff:
307
308 man The traditional man page format; see groff_man(7). It can be
309 specified on the command line as -man or -m man.
310
311 mandoc The general package for man pages; it automatically recognizes
312 whether the documents uses the man or the mdoc format and
313 branches to the corresponding macro package. It can be speci‐
314 fied on the command line as -mandoc or -m mandoc.
315
316 mdoc The BSD-style man page format; see groff_mdoc(7). It can be
317 specified on the command line as -mdoc or -m mdoc.
318
319 me The classical me document format; see groff_me(7). It can be
320 specified on the command line as -me or -m me.
321
322 mm The classical mm document format; see groff_mm(7). It can be
323 specified on the command line as -mm or -m mm.
324
325 ms The classical ms document format; see groff_ms(7). It can be
326 specified on the command line as -ms or -m ms.
327
328 www HTML-like macros for inclusion in arbitrary groff documents; see
329 groff_www(7).
330
331 Details on the naming of macro files and their placement can be found
332 in groff_tmac(5); this man page also documents some other, minor auxil‐
333 iary macro packages not mentioned here.
334
335 Programming Language
336 General concepts common to all roff programming languages are described
337 in roff(7).
338
339 The groff extensions to the classical troff language are documented in
340 groff_diff(7).
341
342 The groff language as a whole is described in the (still incomplete)
343 groff info file; a short (but complete) reference can be found in
344 groff(7).
345
346 Formatters
347 The central roff formatter within the groff system is troff(1). It
348 provides the features of both the classical troff and nroff, as well as
349 the groff extensions. The command line option -C switches troff into
350 compatibility mode which tries to emulate classical roff as much as
351 possible.
352
353 There is a shell script nroff(1) that emulates the behavior of classi‐
354 cal nroff. It tries to automatically select the proper output encod‐
355 ing, according to the current locale.
356
357 The formatter program generates intermediate output; see groff_out(7).
358
359 Devices
360 In roff, the output targets are called devices. A device can be a
361 piece of hardware, e.g., a printer, or a software file format. A
362 device is specified by the option -T. The groff devices are as fol‐
363 lows.
364
365 ascii Text output using the ascii(7) character set.
366
367 cp1047 Text output using the EBCDIC code page IBM cp1047 (e.g., OS/390
368 Unix).
369
370 dvi TeX DVI format.
371
372 html HTML output.
373
374 latin1 Text output using the ISO Latin-1 (ISO 8859-1) character set;
375 see iso_8859_1(7).
376
377 lbp Output for Canon CAPSL printers (LBP-4 and LBP-8 series laser
378 printers).
379
380 lj4 HP LaserJet4-compatible (or other PCL5-compatible) printers.
381
382 ps PostScript output; suitable for printers and previewers like
383 gv(1).
384
385 utf8 Text output using the Unicode (ISO 10646) character set with
386 UTF-8 encoding; see unicode(7).
387
388 xhtml XHTML output.
389
390 X75 75dpi X Window System output suitable for the previewers
391 xditview(1x) and gxditview(1). A variant for a 12pt document
392 base font is X75-12.
393
394 X100 100dpi X Window System output suitable for the previewers
395 xditview(1x) and gxditview(1). A variant for a 12pt document
396 base font is X100-12.
397
398 The postprocessor to be used for a device is specified by the postpro
399 command in the device description file; see groff_font(5). This can be
400 overridden with the -X option.
401
402 The default device is ps.
403
404 Postprocessors
405 groff provides 3 hardware postprocessors:
406
407 grolbp(1)
408 for some Canon printers,
409
410 grolj4(1)
411 for printers compatible to the HP LaserJet 4 and PCL5,
412
413 grotty(1)
414 for text output using various encodings, e.g., on text-oriented
415 terminals or line-printers.
416
417 Today, most printing or drawing hardware is handled by the operating
418 system, by device drivers, or by software interfaces, usually accepting
419 PostScript. Consequently, there isn't an urgent need for more hardware
420 device postprocessors.
421
422 The groff software devices for conversion into other document file for‐
423 mats are
424
425 grodvi(1)
426 for the DVI format,
427
428 grohtml(1)
429 for HTML and XHTML formats,
430
431 grops(1)
432 for PostScript.
433
434 Combined with the many existing free conversion tools this should be
435 sufficient to convert a troff document into virtually any existing data
436 format.
437
438 Utilities
439 The following utility programs around groff are available.
440
441 addftinfo(1)
442 Add information to troff font description files for use with
443 groff.
444
445 afmtodit(1)
446 Create font description files for PostScript device.
447
448 eqn2graph(1)
449 Convert an eqn image into a cropped image.
450
451 gdiffmk(1)
452 Mark differences between groff, nroff, or troff files.
453
454 grap2graph(1)
455 Convert a grap diagram into a cropped bitmap image.
456
457 groffer(1)
458 General viewer program for groff files and man pages.
459
460 gxditview(1)
461 The groff X viewer, the GNU version of xditview.
462
463 hpftodit(1)
464 Create font description files for lj4 device.
465
466 indxbib(1)
467 Make inverted index for bibliographic databases.
468
469 lkbib(1)
470 Search bibliographic databases.
471
472 lookbib(1)
473 Interactively search bibliographic databases.
474
475 pdfroff(1)
476 Create PDF documents using groff.
477
478 pfbtops(1)
479 Translate a PostScript font in .pfb format to ASCII.
480
481 pic2graph(1)
482 Convert a pic diagram into a cropped image.
483
484 tfmtodit(1)
485 Create font description files for TeX DVI device.
486
487 xditview(1x)
488 roff viewer distributed with X window.
489
490 xtotroff(1)
491 Convert X font metrics into GNU troff font metrics.
492
494 Normally, the path separator in the following environment variables is
495 the colon; this may vary depending on the operating system. For exam‐
496 ple, DOS and Windows use a semicolon instead.
497
498 GROFF_BIN_PATH
499 This search path, followed by $PATH, is used for commands that
500 are executed by groff. If it is not set then the directory
501 where the groff binaries were installed is prepended to PATH.
502
503 GROFF_COMMAND_PREFIX
504 When there is a need to run different roff implementations at
505 the same time groff provides the facility to prepend a prefix to
506 most of its programs that could provoke name clashings at run
507 time (default is to have none). Historically, this prefix was
508 the character g, but it can be anything. For example, gtroff
509 stood for groff's troff, gtbl for the groff version of tbl. By
510 setting GROFF_COMMAND_PREFIX to different values, the different
511 roff installations can be addressed. More exactly, if it is set
512 to prefix xxx then groff as a wrapper program internally calls
513 xxxtroff instead of troff. This also applies to the preproces‐
514 sors eqn, grn, pic, refer, tbl, soelim, and to the utilities
515 indxbib and lookbib. This feature does not apply to any pro‐
516 grams different from the ones above (most notably groff itself)
517 since they are unique to the groff package.
518
519 GROFF_ENCODING
520 The value of this environment value is passed to the preconv
521 preprocessor to select the encoding of input files. Setting
522 this option implies groff's command line option -k (this is,
523 groff actually always calls preconv). If set without a value,
524 groff calls preconv without arguments. An explicit -K command
525 line option overrides the value of GROFF_ENCODING. See pre‐
526 conv(1) for details.
527
528 GROFF_FONT_PATH
529 A list of directories in which to search for the devname direc‐
530 tory in addition to the default ones. See troff(1) and
531 groff_font(5) for more details.
532
533 GROFF_TMAC_PATH
534 A list of directories in which to search for macro files in
535 addition to the default directories. See troff(1) and
536 groff_tmac(5) for more details.
537
538 GROFF_TMPDIR
539 The directory in which temporary files are created. If this is
540 not set but the environment variable TMPDIR instead, temporary
541 files are created in the directory $TMPDIR. On MS-DOS and Win‐
542 dows 32 platforms, the environment variables TMP and TEMP (in
543 that order) are searched also, after GROFF_TMPDIR and TMPDIR.
544 Otherwise, temporary files are created in /tmp. The refer(1),
545 groffer(1), grohtml(1), and grops(1) commands use temporary
546 files.
547
548 GROFF_TYPESETTER
549 Preset the default device. If this is not set the ps device is
550 used as default. This device name is overwritten by the option
551 -T.
552
554 There are some directories in which groff installs all of its data
555 files. Due to different installation habits on different operating
556 systems, their locations are not absolutely fixed, but their function
557 is clearly defined and coincides on all systems.
558
559 groff Macro Directory
560 This contains all information related to macro packages. Note that
561 more than a single directory is searched for those files as documented
562 in groff_tmac(5). For the groff installation corresponding to this
563 document, it is located at /usr/share/groff/1.20.1/tmac. The following
564 files contained in the groff macro directory have a special meaning:
565
566 troffrc
567 Initialization file for troff. This is interpreted by troff
568 before reading the macro sets and any input.
569
570 troffrc-end
571 Final startup file for troff. It is parsed after all macro sets
572 have been read.
573
574 name.tmac
575 tmac.name
576 Macro file for macro package name.
577
578 groff Font Directory
579 This contains all information related to output devices. Note that
580 more than a single directory is searched for those files; see troff(1).
581 For the groff installation corresponding to this document, it is
582 located at /usr/share/groff/1.20.1/font. The following files contained
583 in the groff font directory have a special meaning:
584
585 devname/DESC
586 Device description file for device name, see groff_font(5).
587
588 devname/F
589 Font file for font F of device name.
590
592 The following example illustrates the power of the groff program as a
593 wrapper around troff.
594
595 To process a roff file using the preprocessors tbl and pic and the me
596 macro set, classical troff had to be called by
597
598 pic foo.me | tbl | troff -me -Tlatin1 | grotty
599
600 Using groff, this pipe can be shortened to the equivalent command
601
602 groff -p -t -me -T latin1 foo.me
603
604 An even easier way to call this is to use grog(1) to guess the pre‐
605 processor and macro options and execute the generated command (by using
606 backquotes to specify shell command substitution)
607
608 `grog -Tlatin1 foo.me`
609
610 The simplest way is to view the contents in an automated way by calling
611
612 groffer foo.me
613
615 On EBCDIC hosts (e.g., OS/390 Unix), output devices ascii and latin1
616 aren't available. Similarly, output for EBCDIC code page cp1047 is not
617 available on ASCII based operating systems.
618
619 Report bugs to the groff maling list ⟨bug-groff@gnu.org⟩. Include a
620 complete, self-contained example that allows the bug to be reproduced,
621 and say which version of groff you are using.
622
624 Information on how to get groff and related information is available at
625 the groff GNU website ⟨http://www.gnu.org/software/groff⟩. The most
626 recent released version of groff is available at the groff development
627 site ⟨http://groff.ffii.org/groff/devel/groff-current.tar.gz⟩.
628
629 Three groff mailing lists are available:
630
631 for reporting bugs ⟨bug-groff@gnu.org⟩.
632
633 for general discussion of groff, ⟨groff@gnu.org⟩.
634
635 the groff commit list ⟨groff-commit@ffii.org⟩, a read-only list
636 showing logs of commitments to the CVS repository.
637
638 Details on CVS access and much more can be found in the file README at
639 the top directory of the groff source package.
640
641 There is a free implementation of the grap preprocessor, written by Ted
642 Faber ⟨faber@lunabase.org⟩. The actual version can be found at the
643 grap website ⟨http://www.lunabase.org/~faber/Vault/software/grap/⟩.
644 This is the only grap version supported by groff.
645
647 Copyright © 1989, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free
648 Software Foundation, Inc.
649
650 This document is distributed under the terms of the FDL (GNU Free Docu‐
651 mentation License) version 1.3 or later. You should have received a
652 copy of the FDL on your system, it is also available on-line at the GNU
653 copyleft site ⟨http://www.gnu.org/copyleft/fdl.html⟩.
654
655 This document is based on the original groff man page written by James
656 Clark ⟨jjc@jclark.com⟩. It was rewritten, enhanced, and put under the
657 FDL license by Bernd Warken. It is maintained by Werner Lemberg
658 ⟨wl@gnu.org⟩.
659
660 groff is a GNU free software project. All parts of the groff package
661 are protected by GNU copyleft licenses. The software files are dis‐
662 tributed under the terms of the GNU General Public License (GPL), while
663 the documentation files mostly use the GNU Free Documentation License
664 (FDL).
665
667 The groff info file contains all information on the groff system within
668 a single document, providing many examples and background information.
669 See info(1) on how to read it.
670
671 Due to its complex structure, the groff system has many man pages.
672 They can be read with man(1) or groffer(1).
673
674 Introduction, history and further readings:
675 roff(7).
676
677 Viewer for groff files:
678 groffer(1), gxditview(1), xditview(1x).
679
680 Wrapper programs for formatters:
681 groff(1), grog(1).
682
683 Roff preprocessors:
684 eqn(1), grn(1), pic(1), chem(1), preconv(1), refer(1),
685 soelim(1), tbl(1), grap(1).
686
687 Roff language with the groff extensions:
688 groff(7), groff_char(7), groff_diff(7), groff_font(5).
689
690 Roff formatter programs:
691 nroff(1), troff(1), ditroff(7).
692
693 The intermediate output language:
694 groff_out(7).
695
696 Postprocessors for the output devices:
697 grodvi(1), grohtml(1), grolbp(1), grolj4(1), lj4_font(5),
698 grops(1), grotty(1).
699
700 Groff macro packages and macro-specific utilities:
701 groff_tmac(5), groff_man(7), groff_mdoc(7), groff_me(7),
702 groff_mm(7), groff_mmse(7), groff_mom(7), groff_ms(7),
703 groff_www(7), groff_trace(7), mmroff(7).
704
705 The following utilities are available:
706 addftinfo(1), afmtodit(1), eqn2graph(1), gdiffmk(1),
707 grap2graph(1), groffer(1), gxditview(1), hpftodit(1),
708 indxbib(1), lkbib(1), lookbib(1), pdfroff(1), pfbtops(1),
709 pic2graph(1), tfmtodit(1), xtotroff(1).
710
711
712
713Groff Version 1.20.1 9 January 2009 GROFF(1)