1. NAME

groff - front-end for the groff document formatting system . .

2. SYNOPSIS

. .SY groff .OP -abcegiklpstzCEGNRSUVXZ .OP -d cs .OP -D arg .OP -f fam .OP -F dir .OP -I dir .OP -K arg .OP -L arg .OP -m name .OP -M dir .OP -n num .OP -o list .OP -P arg .OP -r cn .OP -T dev .OP -w name .OP -W name [ file\~ . . .] . .SY groff

-h |

--help . .SY groff

-v |

--version [ option\~ . . .] .YS . .

3. DESCRIPTION

. This document describes the

groff program, the main front-end for the groffdocument formatting system. . The groffprogram and macro suite is the implementation of a

R roff (7) system within the free software collection http://www.gnu.org GNU . The groffsystem has all features of the classical roff , but adds many extensions. .

The

groff program allows to control the whole groffsystem by command line options. . This is a great simplification in comparison to the classical case (which uses pipes only). . .

4. OPTIONS

The command line is parsed according to the usual \f[CR]GNU\f[] convention. . The whitespace between a command line option and its argument is optional. . Options can be grouped behind a single `-' (minus character). . A filename of

- (minus character) denotes the standard input. .

. As

groff is a wrapper program for

troff both programs share a set of options. . But the

groff program has some additional, native options and gives a new meaning to some

troff options. . On the other hand, not all

troff options can be fed into

R groff . . .

4.1. Native groff Options

. The following options either do not exist for

troff or are differently interpreted by

R groff . . .

  • -D  arg
        Set default input encoding used by

preconv to arg . . Implies

R -k . . .

-e

    Preprocess with

R eqn . . .

-g

    Preprocess with

R grn . . .

-G

    Preprocess with

R grap . . .

-h

    

--help Print a help message. . .

  • -I  dir
        This option may be used to specify a directory to search for files (both those on the command line and those named in

.psbb and

.so requests, and

\X'ps: import' and

\X'ps: file' escapes). The current directory is always searched first. This option may be specified more than once; the directories are searched in the order specified. No directory search is performed for files specified using an absolute path. This option implies the

-s option. . .

-k

    Preprocess with

R preconv . This is run before any other preprocessor. . Please refer to

R preconv 's manual page for its behaviour if no

-K (or

R -D ) option is specified. . .

  • -K  arg
        Set input encoding used by

preconv to arg . . Implies

R -k . . .

-l

    Send the output to a spooler program for printing. . The command that should be used for this is specified by the

print command in the device description file, see

R groff_font (5). If this command is not present, the output is piped into the

R lpr (1) program by default. . See options

-L and

R -X . . .

  • -L  arg
        Pass argto the spooler program. Several arguments should be passed with a separate -L option each. . Note that

groff does not prepend `-' (a minus sign) to argbefore passing it to the spooler program. . .

-N

    Don't allow newlines within eqndelimiters. . This is the same as the

-N option in

R eqn . . .

-p

    Preprocess with

R pic . . .

  • -P  -option
        
    -P  -option  -P  arg Pass -optionor "-option\~arg"to the postprocessor. . The option must be specified with the necessary preceding minus sign(s) .Quoted - or .Quoted -- because

groff does not prepend any dashes before passing it to the postprocessor. . For example, to pass a title to the

gxditview postprocessor, the shell command .

 
Sélectionnez
groff -X -P -title -P 'groff it' \f[I]foo\f[]

.

is equivalent to .

 
Sélectionnez
groff -X -Z \f[I]foo\f[] | \
gxditview -title 'groff it' -

. .

-R

    Preprocess with

R refer . . No mechanism is provided for passing arguments to

refer because most

refer options have equivalent language elements that can be specified within the document. . See

R refer (1) for more details. . .

-s

    Preprocess with

R soelim . . .

-S

    Safer mode. . Pass the

-S option to

pic and disable the following

troff requests:

R .open ,

R .opena ,

R .pso ,

R .sy , and

R .pi . For security reasons, safer mode is enabled by default. . .

-t

    Preprocess with

R tbl . . .

  • -T  dev
        Set output device to dev . For this device,

troff generates the intermediate output ; see

R groff_out (5). . Then

groff calls a postprocessor to convert

R troff 's intermediate outputto its final format. . Real devices in

groff are .

  • dvi
        TeX DVI format (postprocessor is

R grodvi ). .

  • html
        
    xhtml HTML and XHTML output (preprocessors are

soelim and

R pre-grohtml , postprocessor is

R post-grohtml ). .

  • lbp
        Canon CAPSL printers (LBP-4 and LBP-8 series laser printers; postprocessor is

R grolbp ). .

  • lj4
        HP LaserJet4 compatible (or other PCL5 compatible) printers (postprocessor is

R grolj4 ). .

  • ps
        PostScript output (postprocessor is

R grops ). . .

For the following TTY output devices (postprocessor is always

R grotty ),

-T selects the output encoding: .

  • ascii
        7bit \f[CR]ASCII\f[]. .
  • cp1047
        Latin-1 character set for EBCDIC hosts. .
  • latin1
        ISO 8859-1. .
  • utf8
        Unicode character set in UTF-8 encoding. . .

The following arguments select

gxditview as the `postprocessor' (it is rather a viewing program): .

  • X75
        75 dpi resolution, 10 pt document base font.
  • X75-12
        75 dpi resolution, 12 pt document base font.
  • X100
        100 dpi resolution, 10 pt document base font.
  • X100-12
        100 dpi resolution, 12 pt document base font. .

The default device is

R ps . . .

-U

    Unsafe mode. . Reverts to the (old) unsafe behaviour; see option

R -S . . .

-v

    

--version Output version information of

groff and of all programs that are run by it; that is, the given command line is parsed in the usual way, passing

-v to all subprograms. . .

-V

    Output the pipeline that would be run by

R groff (as a wrapper program) on the standard output, but do not execute it. If given more than once, the commands are both printed on the standard error and run. . .

-X

    Use

gxditview instead of using the usual postprocessor to (pre)view a document. . The printing spooler behavior as outlined with options

-l and

-L is carried over to

R gxditview (1) by determining an argument for the

-printCommand option of

R gxditview (1). . This sets the default

Print action and the corresponding menu entry to that value. .

-X only produces good results with

R -Tps ,

R -TX75 ,

R -TX75-12 ,

R -TX100 , and

R -TX100-12 . . The default resolution for previewing

-Tps output is 75 dpi; this can be changed by passing the

-resolution option to

R gxditview , for example .

 
Sélectionnez
groff -X -P-resolution -P100 -man foo.1

. .

-z

    Suppress output generated by

R troff . Only error messages are printed. . .

-Z

    Do not automatically postprocess groff intermediate outputin the usual manner. This will cause the

troff outputto appear on standard output, replacing the usual postprocessor output; see

R groff_out (5). . .

4.2. Transparent Options

. The following options are transparently handed over to the formatter program

troff that is called by

groff subsequently. . These options are described in more detail in

R troff (1). .

-a

    \f[CR]ASCII\f[] approximation of output. .

-b

    Backtrace on error or warning. .

-c

    Disable color output. . Please consult the

R grotty (1) man page for more details. .

-C

    Enable compatibility mode. .

  • -d  cs
        
    -d  name = s Define string. .

-E

    Disable

troff error messages. .

  • -f  fam
        Set default font family. .
  • -F  dir
        Set path for font DESC files. .

-i

    Process standard input after the specified input files. .

  • -m  name
        Include macro file .IB name .tmac (or tmac. name\c ); see also

R groff_tmac (5). .

  • -M  dir
        Path for macro files. .
  • -n  num
        Number the first page num . .
  • -o  list
        Output only pages in list . .
  • -r  cn
        
    -r  name = n Set number register. .
  • -w  name
        Enable warning name . .
  • -W  name
        disable warning name . . .

5. USING GROFF

. The groff systemimplements the infrastructure of classical roff; see

R roff (7) for a survey on how a roffsystem works in general. . Due to the front-end programs available within the groffsystem, using groffis much easier than "classical roff" . . This section gives an overview of the parts that constitute the groffsystem. . It complements

R roff (7) with groff -specific features. . This section can be regarded as a guide to the documentation around the groffsystem. . .

5.1. Paper Size

. The virtualpaper size used by

troff to format the input is controlled globally with the requests

R .po ,

R .pl , and

R .ll . See

R groff_tmac (5) for the `papersize' macro package which provides a convenient interface. .

The physicalpaper size, giving the actual dimensions of the paper sheets, is controlled by output devices like

R grops with the command line options

-p and

R -l . See

R groff_font (5) and the man pages of the output devices for more details.

groff uses the command line option

-P to pass options to output devices; for example, the following selects A4 paper in landscape orientation for the PS device: .

 
Sélectionnez
groff -Tps -P-pa4 -P-l ...

. .

5.2. Front-ends

. The

groff program is a wrapper around the

R troff (1) program. . It allows to specify the preprocessors by command line options and automatically runs the postprocessor that is appropriate for the selected device. . Doing so, the sometimes tedious piping mechanism of classical

R roff (7) can be avoided. .

The

R grog (1) program can be used for guessing the correct groffcommand line to format a file. .

The

R groffer (1) program is an allround-viewer for grofffiles and man pages. . .

5.3. Preprocessors

. The groffpreprocessors are reimplementations of the classical preprocessors with moderate extensions. . The standard preprocessors distributed with the groffpackage are .

R eqn (1)

    for mathematical formul(ae, .

R grn (1)

    for including

R gremlin (1) pictures, .

R pic (1)

    for drawing diagrams, .

R chem (1)

    for chemical structure diagrams, .

R refer (1)

    for bibliographic references, .

R soelim (1)

    for including macro files from standard locations, .

and .

R tbl (1)

    for tables. .

A new preprocessor not available in classical troffis

R preconv (1) which converts various input encodings to something

groff can understand. . It is always run first before any other preprocessor. .

Besides these, there are some internal preprocessors that are automatically run with some devices. . These aren't visible to the user. . .

5.4. Macro Packages

. Macro packages can be included by option

R -m . . The groffsystem implements and extends all classical macro packages in a compatible way and adds some packages of its own. . Actually, the following macro packages come with groff : .

man

    The traditional man page format; see

R groff_man (7). It can be specified on the command line as

-man or

R -m\~man . .

mandoc

    The general package for man pages; it automatically recognizes whether the documents uses the manor the mdocformat and branches to the corresponding macro package. . It can be specified on the command line as

-mandoc or

R -m\~mandoc . .

mdoc

    The \f[CR]BSD\f[]-style man page format; see

R groff_mdoc (7). It can be specified on the command line as

-mdoc or

R -m\~mdoc . .

me

    The classical medocument format; see

R groff_me (7). It can be specified on the command line as

-me or

R -m\~me . .

mm

    The classical mmdocument format; see

R groff_mm (7). It can be specified on the command line as

-mm or

R -m\~mm . .

ms

    The classical msdocument format; see

R groff_ms (7). It can be specified on the command line as

-ms or

R -m\~ms . .

www

    HTML-like macros for inclusion in arbitrary groffdocuments; see

R groff_www (7). .

Details on the naming of macro files and their placement can be found in

R groff_tmac (5); this man page also documents some other, minor auxiliary macro packages not mentioned here. . .

5.5. Programming Language

. General concepts common to all roffprogramming languages are described in

R roff (7). .

The groffextensions to the classical trofflanguage are documented in

R groff_diff (7). .

The grofflanguage as a whole is described in the (still incomplete) "groff info file" ; a short (but complete) reference can be found in

R groff (7). . .

5.6. Formatters

. The central roffformatter within the groffsystem is

R troff (1). It provides the features of both the classical troffand nroff , as well as the groffextensions. . The command line option

-C switches

troff into "compatibility mode"which tries to emulate classical roffas much as possible. .

There is a shell script

R nroff (1) that emulates the behavior of classical

R nroff . . It tries to automatically select the proper output encoding, according to the current locale. .

The formatter program generates "intermediate output" ; see

R groff_out (7). . .

5.7. Devices

. In roff , the output targets are called devices . A device can be a piece of hardware, e.g., a printer, or a software file format. . A device is specified by the option

R -T . The groffdevices are as follows. .

ascii

    Text output using the

R ascii (7) character set. .

cp1047

    Text output using the EBCDIC code page IBM cp1047 (e.g., OS/390 Unix). .

dvi

    TeX DVI format. .

html

    HTML output. .

latin1

    Text output using the ISO Latin-1 (ISO 8859-1) character set; see

R iso_8859_1 (7). .

lbp

    Output for Canon CAPSL printers (LBP-4 and LBP-8 series laser printers). .

lj4

    HP LaserJet4-compatible (or other PCL5-compatible) printers. .

ps

    PostScript output; suitable for printers and previewers like

R gv (1). .

utf8

    Text output using the Unicode (ISO 10646) character set with UTF-8 encoding; see

R unicode (7). .

xhtml

    XHTML output. .

X75

    75dpi X Window System output suitable for the previewers

R xditview (1x) and

R gxditview (1). . A variant for a 12 pt document base font is

R X75-12 . .

X100

    100dpi X Window System output suitable for the previewers

R xditview (1x) and

R gxditview (1). . A variant for a 12 pt document base font is

R X100-12 . .

The postprocessor to be used for a device is specified by the

postpro command in the device description file; see

R groff_font (5). . This can be overridden with the

-X option. .

The default device is

R ps . . .

5.8. Postprocessors

. groffprovides 3\~hardware postprocessors: .

R grolbp (1)

    for some Canon printers, .

R grolj4 (1)

    for printers compatible to the HP LaserJet\~4 and PCL5, .

R grotty (1)

    for text output using various encodings, e.g., on text-oriented terminals or line-printers. .

Today, most printing or drawing hardware is handled by the operating system, by device drivers, or by software interfaces, usually accepting PostScript. . Consequently, there isn't an urgent need for more hardware device postprocessors. .

The groffsoftware devices for conversion into other document file formats are .

R grodvi (1)

    for the DVI format, .

R grohtml (1)

    for HTML and XHTML formats, .

R grops (1)

    for PostScript. .

Combined with the many existing free conversion tools this should be sufficient to convert a troffdocument into virtually any existing data format. . .

5.9. Utilities

. The following utility programs around groffare available. .

R addftinfo (1)

    Add information to trofffont description files for use with groff . .

R afmtodit (1)

    Create font description files for PostScript device. .

R eqn2graph (1)

    Convert an

eqn image into a cropped image. .

R gdiffmk (1)

    Mark differences between groff , nroff , or trofffiles. .

R grap2graph (1)

    Convert a

grap diagram into a cropped bitmap image. .

R groffer (1)

    General viewer program for grofffiles and man pages. .

R gxditview (1)

    The groffX viewer, the \f[CR]GNU\f[] version of

R xditview . .

R hpftodit (1)

    Create font description files for lj4 device. .

R indxbib (1)

    Make inverted index for bibliographic databases. .

R lkbib (1)

    Search bibliographic databases. .

R lookbib (1)

    Interactively search bibliographic databases. .

R pdfroff (1)

    Create PDF documents using

R groff . .

R pfbtops (1)

    Translate a PostScript font in .pfb format to \f[CR]ASCII\f[]. .

R pic2graph (1)

    Convert a

pic diagram into a cropped image. .

R tfmtodit (1)

    Create font description files for TeX DVI device. .

R xditview (1x)

    .I roff viewer distributed with X window. .

R xtotroff (1)

    Convert X font metrics into \f[CR]GNU\f[] trofffont metrics. . .

6. ENVIRONMENT

. Normally, the path separator in the following environment variables is the colon; this may vary depending on the operating system. . For example, DOS and Windows use a semicolon instead. . .

  • .EnvVar GROFF_BIN_PATH
        This search path, followed by .EnvVar $PATH , is used for commands that are executed by

R groff . . If it is not set then the directory where the groffbinaries were installed is prepended to .EnvVar PATH . . .

  • .EnvVar GROFF_COMMAND_PREFIX
        When there is a need to run different roffimplementations at the same time groffprovides the facility to prepend a prefix to most of its programs that could provoke name clashings at run time (default is to have none). . Historically, this prefix was the character

R g , but it can be anything. . For example,

R gtroff stood for groff 's

R troff ,

R gtbl for the groffversion of

R tbl . . By setting .EnvVar GROFF_COMMAND_PREFIX to different values, the different roffinstallations can be addressed. . More exactly, if it is set to prefix xxxthen

groff as a wrapper program internally calls .IB xxx troff instead of

R troff . This also applies to the preprocessors

R eqn ,

R grn ,

R pic ,

R refer ,

R tbl ,

R soelim , and to the utilities

indxbib and

R lookbib . . This feature does not apply to any programs different from the ones above (most notably

groff itself) since they are unique to the groffpackage. . .

  • .EnvVar GROFF_ENCODING
        The value of this environment value is passed to the

preconv preprocessor to select the encoding of input files. . Setting this option implies

R groff 's command line option

-k (this is,

groff actually always calls

R preconv ). . If set without a value,

groff calls

preconv without arguments. . An explicit

-K command line option overrides the value of .EnvVar GROFF_ENCODING . . See

R preconv (1) for details. . .

  • .EnvVar GROFF_FONT_PATH
        A list of directories in which to search for the dev name directory in addition to the default ones. . See

R troff (1) and

R groff_font (5) for more details. . .

  • .EnvVar GROFF_TMAC_PATH
        A list of directories in which to search for macro files in addition to the default directories. . See

R troff (1) and

R groff_tmac (5) for more details. . .

  • .EnvVar GROFF_TMPDIR
        The directory in which temporary files are created. . If this is not set but the environment variable .EnvVar TMPDIR instead, temporary files are created in the directory .EnvVar $TMPDIR . On MS-DOS and Windows\~32 platforms, the environment variables .EnvVar TMP and .EnvVar TEMP (in that order) are searched also, after .EnvVar GROFF_TMPDIR and .EnvVar TMPDIR . . Otherwise, temporary files are created in

R /tmp . The

R refer (1),

R groffer (1),

R grohtml (1), and

R grops (1) commands use temporary files. . .

  • .EnvVar GROFF_TYPESETTER
        Preset the default device. . If this is not set the

ps device is used as default. . This device name is overwritten by the option

R -T . . .

7. FILES

. There are some directories in which groffinstalls all of its data files. . Due to different installation habits on different operating systems, their locations are not absolutely fixed, but their function is clearly defined and coincides on all systems. . .

7.1. groff Macro Directory

. This contains all information related to macro packages. . Note that more than a single directory is searched for those files as documented in

R groff_tmac (5). . For the groffinstallation corresponding to this document, it is located at /usr/share/groff/1.20.1/tmac . . The following files contained in the groff macro directoryhave a special meaning: . .

troffrc

    Initialization file for troff . . This is interpreted by

troff before reading the macro sets and any input. . .

troffrc-end

    Final startup file for troff . . It is parsed after all macro sets have been read. . .

  • .IB name .tmac
        
    tmac. name Macro file for macro package name . . .

7.2. groff Font Directory

. This contains all information related to output devices. . Note that more than a single directory is searched for those files; see

R troff (1). . For the groffinstallation corresponding to this document, it is located at /usr/share/groff/1.20.1/font . . The following files contained in the "groff font directory"have a special meaning: . .

  • dev name /DESC
        Device description file for device name , see

R groff_font (5). . .

  • dev name / F
        Font file for font Fof device name . . .

8. EXAMPLES

. The following example illustrates the power of the

groff program as a wrapper around

R troff . .

To process a rofffile using the preprocessors

tbl and

pic and the

me macro set, classical troffhad to be called by .

 
Sélectionnez
pic foo.me | tbl | troff -me -Tlatin1 | grotty

.

Using

R groff , this pipe can be shortened to the equivalent command .

 
Sélectionnez
groff -p -t -me -T latin1 foo.me

.

An even easier way to call this is to use

R grog (1) to guess the preprocessor and macro options and execute the generated command (by using backquotes to specify shell command substitution) .

 
Sélectionnez
\`grog -Tlatin1 foo.me\`

.

The simplest way is to view the contents in an automated way by calling .

 
Sélectionnez
groffer foo.me

. .

9. BUGS

.

On \f[CR]EBCDIC\f[] hosts (e.g., \f[CR]OS/390 Unix\f[]), output devices

ascii and

latin1 aren't available. . Similarly, output for \f[CR]EBCDIC\f[] code page

cp1047 is not available on \f[CR]ASCII\f[] based operating systems. .

Report bugs to .MT the groff maling list .ME . . Include a complete, self-contained example that allows the bug to be reproduced, and say which version of groffyou are using. . .

10. AVAILABILITY

. Information on how to get groffand related information is available at the http://www.gnu.org/software/groff groff GNU website . The most recent released version of groffis available at the http://groff.ffii.org/groff/devel/groff-current.tar.gz groff development site .

Three groffmailing lists are available:

.MT for reporting bugs .ME . .

.MT for general discussion of groff , .ME .

.MT the groff commit list .ME , a read-only list showing logs of commitments to the CVS repository. .

Details on CVS access and much more can be found in the file

README at the top directory of the groffsource package. .

There is a free implementation of the

grap preprocessor, written by .MT Ted Faber .ME . . The actual version can be found at the . http://www.lunabase.org/~faber/Vault/software/grap/ grap website This is the only grap version supported by groff . . .

11. AUTHORS

. Copyright © 1989, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. .

This document is distributed under the terms of the \f[CR]FDL\f[] (\f[CR]GNU Free Documentation License\f[]) version 1.3 or later. . You should have received a copy of the \f[CR]FDL\f[] on your system, it is also available on-line at the http://www.gnu.org/copyleft/fdl.html GNU copyleft site .

This document is based on the original groffman page written by .MT James Clark . It was rewritten, enhanced, and put under the FDL license by Bernd Warken. . It is maintained by .MT Werner Lemberg .ME . .

groffis a \f[CR]GNU\f[] free software project. . All parts of the groff packageare protected by \f[CR]GNU copyleft licenses\f[]. . The software files are distributed under the terms of the \f[CR]GNU General Public License\f[] (\f[CR]GPL\f[]), while the documentation files mostly use the \f[CR]GNU Free Documentation License\f[] (\f[CR]FDL\f[]). . .

12. SEE ALSO

. The groff info filecontains all information on the groffsystem within a single document, providing many examples and background information. . See

R info (1) on how to read it. .

Due to its complex structure, the groffsystem has many man pages. . They can be read with

R man (1) or

R groffer (1). .

  • Introduction, history and further readings:
        .BR roff (7). .
  • Viewer for groff files:
        .BR groffer (1),

R gxditview (1),

R xditview (1x). .

  • Wrapper programs for formatters:
        .BR groff (1),

R grog (1). .

  • Roff preprocessors:
        .BR eqn (1),

R grn (1),

R pic (1),

R chem (1),

R preconv (1),

R refer (1),

R soelim (1),

R tbl (1),

R grap (1). .

  • Roff language with the groff extensions:
        .BR groff (7),

R groff_char (7),

R groff_diff (7),

R groff_font (5). .

  • Roff formatter programs:
        .BR nroff (1),

R troff (1),

R ditroff (7). .

  • The intermediate output language:
        .BR groff_out (7). .
  • Postprocessors for the output devices:
        .BR grodvi (1),

R grohtml (1),

R grolbp (1),

R grolj4 (1),

R lj4_font (5),

R grops (1),

R grotty (1). .

  • Groff macro packages and macro-specific utilities:
        .BR groff_tmac (5),

R groff_man (7),

R groff_mdoc (7),

R groff_me (7),

R groff_mm (7),

R groff_mmse (7),

R groff_mom (7),

R groff_ms (7),

R groff_www (7),

R groff_trace (7),

R mmroff (7). .

  • The following utilities are available:
        .BR addftinfo (1),

R afmtodit (1),

R eqn2graph (1),

R gdiffmk (1),

R grap2graph (1),

R groffer (1),

R gxditview (1),

R hpftodit (1),

R indxbib (1),

R lkbib (1),

R lookbib (1),

R pdfroff (1),

R pfbtops (1),

R pic2graph (1),

R tfmtodit (1),

R xtotroff (1). . .