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