Re: info browser handles OSC 8 escape sequences poorly (was: [platform-testers] texinfo-7.2.90 pretest available)
Gavin Smith <[email protected]>
| Newsgroups | gmane.comp.tex.texinfo.bugs |
|---|---|
| Message-ID | <aWUtYy5G1TMtAAH2@orangestar> |
On Mon, Jan 12, 2026 at 05:57:07PM +0200, Eli Zaretskii wrote: > > Date: Mon, 12 Jan 2026 09:03:27 -0600 > > From: "G. Branden Robinson" <[email protected]> > > Cc: [email protected] > > > > > > I assume that bug has since been fixed. Can you tell me in which > > > > release it was? There's a non-zero chance the question will come up > > > > on the groff mailing list, and I'd like to be prepared with an > > > > answer. > > > > > > If you can tell me how to test this and which man pages use this (or > > > from where I can download them), I could then tell you whether it was > > > indeed fixed and in what version of Emacs. (None of the systems to > > > which I have access have Groff 1.23 installed, so I cannot produce > > > these man pages myself, sorry.) > > > > Without groff 1.23.0, you can't really. > > Would it be possible for you to send me a formatted man page, output > from Groff 1.23, that I could use for testing this? I've attached the file produced on my system by $ MAN_KEEP_FORMATTING=1 man groff >groff.out $ groff --version GNU groff version 1.23.0 Copyright (C) 2022 Free Software Foundation, Inc. GNU groff comes with ABSOLUTELY NO WARRANTY. You may redistribute copies of groff and its subprograms under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING. called subprograms: GNU troff (groff) version 1.23.0 GNU grops (groff) version 1.23.0 $ man --version man 2.12.0
groff.out
(text/plain, 46.1 KB)
[4mgroff[24m(1) General Commands Manual [4mgroff[24m(1)
[1mName[0m
groff - front end to the GNU [4mroff[24m document formatting system
[1mSynopsis[0m
[1mgroff [22m[[1m-abcCeEgGijklNpRsStUVXzZ[22m] [[1m-d [4m[22mctext[24m] [[1m-d [4m[22mstring[24m[1m=[4m[22mtext[24m] [[1m-D [4m[22mfallback-encoding[24m] [[1m-f [4m[22mfont-family[24m] [[1m-F [4m[22mfont-directory[24m]
[[1m-I [4m[22minclusion-directory[24m] [[1m-K [4m[22minput-encoding[24m] [[1m-L [4m[22mspooler-argument[24m] [[1m-m [4m[22mmacro-package[24m] [[1m-M [4m[22mmacro-directory[24m] [[1m-n [4m[22mpage-[0m
[4mnumber[24m] [[1m-o [4m[22mpage-list[24m] [[1m-P [4m[22mpostprocessor-argument[24m] [[1m-r [4m[22mcnumeric-expression[24m] [[1m-r [4m[22mregister[24m[1m=[4m[22mnumeric-expression[24m]
[[1m-T [4m[22moutput-device[24m] [[1m-w [4m[22mwarning-category[24m] [[1m-W [4m[22mwarning-category[24m] [[4mfile[24m ...]
[1mgroff -h[0m
[1mgroff --help[0m
[1mgroff -v [22m[[4moption[24m ...] [[4mfile[24m ...]
[1mgroff --version [22m[[4moption[24m ...] [[4mfile[24m ...]
[1mDescription[0m
[4mgroff[24m is the primary front end to the GNU [4mroff[24m document formatting system. GNU [4mroff[24m is a typesetting system that reads
plain text input files that include formatting commands to produce output in PostScript, PDF, HTML, DVI, or other formats,
or for display to a terminal. Formatting commands can be low-level typesetting primitives, macros from a supplied package,
or user-defined macros. All three approaches can be combined. If no [4mfile[24m operands are specified, or if [4mfile[24m is β[1m-[22mβ, [4mgroff[0m
reads the standard input stream.
A reimplementation and extension of the typesetter from AT&T Unix, [4mgroff[24m is present on most POSIX systems owing to its long
association with Unix manuals (including man pages). It and its predecessor are notable for their production of several
best-selling software engineering texts. [4mgroff[24m is capable of producing typographically sophisticated documents while conβ
suming minimal system resources.
The [4mgroff[24m command orchestrates the execution of preprocessors, the transformation of input documents into a device-indepenβ
dent page description language, and the production of output from that language.
[1mOptions[0m
[1m-h [22mand [1m--help [22mdisplay a usage message and exit.
Because [4mgroff[24m is intended to subsume most users' direct invocations of the ]8;;man:troff(1)\[4mtroff[24m(1)]8;;\ formatter, the two programs share a set
of options. However, [4mgroff[24m has some options that [4mtroff[24m does not share, and others which [4mgroff[24m interprets differently. At
the same time, not all valid [4mtroff[24m options can be given to [4mgroff[24m.
[4m[1mgroff[24m-specific options[0m
The following options either do not exist in GNU [4mtroff[24m or are interpreted differently by [4mgroff[24m.
[1m-D [4m[22menc[24m Set fallback input encoding used by ]8;;man:preconv(1)\[4mpreconv[24m(1)]8;;\ to [4menc[24m; implies [1m-k[22m.
[1m-e [22mRun ]8;;man:eqn(1)\[4meqn[24m(1)]8;;\ preprocessor.
[1m-g [22mRun ]8;;man:grn(1)\[4mgrn[24m(1)]8;;\ preprocessor.
[1m-G [22mRun ]8;;man:grap(1)\[4mgrap[24m(1)]8;;\ preprocessor; implies [1m-p[22m.
[1m-I [4m[22mdir[24m Works as [4mtroff[24m's option (see below), but also implies [1m-g [22mand [1m-s[22m. It is passed to ]8;;man:soelim(1)\[4msoelim[24m(1)]8;;\ and the output driver,
and [4mgrn[24m is passed an [1m-M [22moption with [4mdir[24m as its argument.
[1m-j [22mRun ]8;;man:chem(1)\[4mchem[24m(1)]8;;\ preprocessor; implies [1m-p[22m.
[1m-k [22mRun ]8;;man:preconv(1)\[4mpreconv[24m(1)]8;;\ preprocessor. Refer to its man page for its behavior if neither of [4mgroff[24m's [1m-K [22mor [1m-D [22moptions is also
specified.
[1m-K [4m[22menc[24m Set input encoding used by ]8;;man:preconv(1)\[4mpreconv[24m(1)]8;;\ to [4menc[24m; implies [1m-k[22m.
[1m-l [22mSend the output to a spooler program for printing. The β[1mprint[22mβ directive in the device description file specifies
the default command to be used; see ]8;;man:groff_font(5)\[4mgroff_font[24m(5)]8;;\. If no such directive is present for the output device, output is
piped to ]8;;man:lpr(1)\[4mlpr[24m(1)]8;;\. See options [1m-L [22mand [1m-X[22m.
[1m-L [4m[22marg[24m Pass [4marg[24m to the print spooler program. If multiple [4marg[24ms are required, pass each with a separate [1m-L [22moption. [4mgroff[0m
does not prefix an option dash to [4marg[24m before passing it to the spooler program.
[1m-M [22mWorks as [4mtroff[24m's option (see below), but is also passed to ]8;;man:eqn(1)\[4meqn[24m(1)]8;;\, ]8;;man:grap(1)\[4mgrap[24m(1)]8;;\, and ]8;;man:grn(1)\[4mgrn[24m(1)]8;;\.
[1m-N [22mProhibit newlines between [4meqn[24m delimiters: pass [1m-N [22mto ]8;;man:eqn(1)\[4meqn[24m(1)]8;;\.
[1m-p [22mRun ]8;;man:pic(1)\[4mpic[24m(1)]8;;\ preprocessor.
[1m-P [4m[22marg[24m Pass [4marg[24m to the postprocessor. If multiple [4marg[24ms are required, pass each with a separate [1m-P [22moption. [4mgroff[24m does not
prefix an option dash to [4marg[24m before passing it to the postprocessor.
[1m-R [22mRun ]8;;man:refer(1)\[4mrefer[24m(1)]8;;\ preprocessor. No mechanism is provided for passing arguments to [4mrefer[24m because most [4mrefer[24m options have
equivalent language elements that can be specified within the document.
[1m-s [22mRun ]8;;man:soelim(1)\[4msoelim[24m(1)]8;;\ preprocessor.
[1m-S [22mOperate in βsaferβ mode; see [1m-U [22mbelow for its opposite. For security reasons, safer mode is enabled by default.
[1m-t [22mRun ]8;;man:tbl(1)\[4mtbl[24m(1)]8;;\ preprocessor.
[1m-T [4m[22mdev[24m Direct [4mtroff[24m to format the input for the output device [4mdev[24m. [4mgroff[24m then calls an output driver to convert [4mtroff[24m's
output to a form appropriate for [4mdev[24m; see subsection βOutput devicesβ below.
[1m-U [22mOperate in unsafe mode: pass the [1m-U [22moption to [4mpic[24m and [4mtroff[24m.
[1m-v[0m
[1m--version[0m
Write version information for [4mgroff[24m and all programs run by it to the standard output stream; that is, the given comβ
mand line is processed in the usual way, passing [1m-v [22mto the formatter and any pre- or postprocessors invoked.
[1m-V [22mOutput the pipeline that [4mgroff[24m would run to the standard output stream, but do not execute it. If given more than
once, [4mgroff[24m both writes and runs the pipeline.
[1m-X [22mUse ]8;;man:gxditview(1)\[4mgxditview[24m(1)]8;;\ instead of the usual postprocessor to (pre)view a document on an X11 display. Combining this option
with [1m-Tps [22muses the font metrics of the PostScript device, whereas the [1m-TX75 [22mand [1m-TX100 [22moptions use the metrics of X11
fonts.
[1m-Z [22mDisable postprocessing. [4mtroff[24m output will appear on the standard output stream (unless suppressed with [1m-z[22m); see
]8;;man:groff_out(5)\[4mgroff_out[24m(5)]8;;\ for a description of this format.
[1mTransparent options[0m
The following options are passed as-is to the formatter program ]8;;man:troff(1)\[4mtroff[24m(1)]8;;\ and described in more detail in its man page.
[1m-a [22mGenerate a plain text approximation of the typeset output.
[1m-b [22mWrite a backtrace to the standard error stream on each error or warning.
[1m-c [22mStart with color output disabled.
[1m-C [22mEnable AT&T [4mtroff[24m compatibility mode; implies [1m-c[22m.
[1m-d [4m[22mcs[0m
[1m-d [4m[22mname[24m[1m=[4m[22mstring[0m
Define string.
[1m-E [22mInhibit [4mtroff[24m error messages; implies [1m-Ww[22m.
[1m-f [4m[22mfam[24m Set default font family.
[1m-F [4m[22mdir[24m Search in directory [4mdir[24m for the selected output device's directory of device and font description files.
[1m-i [22mProcess standard input after the specified input files.
[1m-I [4m[22mdir[24m Search [4mdir[24m for input files.
[1m-m [4m[22mname[0m
Process name[4m.tmac[24m before input files.
[1m-M [4m[22mdir[24m Search directory [4mdir[24m for macro files.
[1m-n [4m[22mnum[24m Number the first page [4mnum[24m.
[1m-o [4m[22mlist[0m
Output only pages in [4mlist[24m.
[1m-r [4m[22mcnumeric-expression[0m
[1m-r [4m[22mregister[24m[1m=[4m[22mnumeric-expression[0m
Define register.
[1m-w [4m[22mname[0m
[1m-W [4m[22mname[0m
Enable ([1m-w[22m) or inhibit ([1m-W[22m) emission of warnings in category [4mname[24m.
[1m-z [22mSuppress formatted device-independent output of [4mtroff[24m.
[1mUsage[0m
The architecture of the GNU [4mroff[24m system follows that of other device-independent [4mroff[24m implementations, comprising preprocesβ
sors, macro packages, output drivers (or βpostprocessorsβ), a suite of utilities, and the formatter [4mtroff[24m at its heart. See
]8;;man:roff(7)\[4mroff[24m(7)]8;;\ for a survey of how a [4mroff[24m system works.
The front end programs available in the GNU [4mroff[24m system make it easier to use than traditional [4mroff[24ms that required the conβ
struction of pipelines or use of temporary files to carry a source document from maintainable form to device-ready output.
The discussion below summarizes the constituent parts of the GNU [4mroff[24m system. It complements ]8;;man:roff(7)\[4mroff[24m(7)]8;;\ with [4mgroff[24m-specific
information.
[1mGetting started[0m
Those who prefer to learn by experimenting or are desirous of rapid feedback from the system may wish to start with a
βHello, world!β document.
$ [1mecho "Hello, world!" | groff -Tascii | sed '/^$/d'[0m
Hello, world!
We used a [4msed[24m command only to eliminate the 65 blank lines that would otherwise flood the terminal screen. ([4mroff[24m systems
were developed in the days of paper-based terminals with 66 lines to a page.)
Today's users may prefer output to a UTF-8-capable terminal.
$ [1mecho "Hello, world!" | groff -Tutf8 | sed '/^$/d'[0m
Producing PDF, HTML, or TeX's DVI is also straightforward. The hard part may be selecting a viewer program for the output.
$ [1mecho "Hello, world!" | groff -Tpdf > hello.pdf[0m
$ [1mevince hello.pdf[0m
$ [1mecho "Hello, world!" | groff -Thtml > hello.html[0m
$ [1mfirefox hello.html[0m
$ [1mecho "Hello, world!" | groff -Tdvi > hello.dvi[0m
$ [1mxdvi hello.html[0m
[1mUsing [4mgroff[24m as a REPL[0m
Those with a programmer's bent may be pleased to know that they can use [4mgroff[24m in a read-evaluate-print loop (REPL). Doing
so can be handy to verify one's understanding of the formatter's behavior and/or the syntax it accepts. Turning on all
warnings with [1m-ww [22mcan aid this goal.
$ [1mgroff -ww -Tutf8[0m
[1m\# This is a comment. Let's define a register.[0m
[1m.nr a 1[0m
[1m\# Do integer arithmetic with operators evaluated left-to-right.[0m
[1m.nr b \n[a]+5/2[0m
[1m\# Let's get the result on the standard error stream.[0m
[1m.tm \n[b][0m
3
[1m\# Now we'll define a string.[0m
[1m.ds name Leslie\" This is another form of comment.[0m
[1m.nr b (\n[a] + (7/2))[0m
[1m\# Center the next two text input lines.[0m
[1m.ce 2[0m
[1mHi, \*[name].[0m
[1mYour secret number is \n[b].[0m
[1m\# We will see that the division rounded toward zero.[0m
[1mIt is[0m
[1m\# Here's an if-else control structure.[0m
[1m.ie (\n[b] % 2) odd.[0m
[1m.el even.[0m
[1m\# This trick sets the page length to the current vertical[0m
[1m\# position, so that blank lines don't spew when we're done.[0m
[1m.pl \n[nl]u[0m
[4m<Control-D>[0m
Hi, Leslie.
Your secret number is 4.
It is even.
[1mPaper format[0m
In GNU [4mroff[24m, the page dimensions for the formatter [4mtroff[24m and for output devices are handled separately. In the formatter,
requests are used to set the page length ([1m.pl[22m), page offset (or left margin, [1m.po[22m), and line length ([1m.ll[22m). The right margin
is not explicitly configured; the combination of page offset and line length provides the information necessary to derive
it. The [4mpapersize[24m macro package, automatically loaded by [4mtroff[24m, provides an interface for configuring page dimensions by
convenient names, like βletterβ or βA4β; see ]8;;man:groff_tmac(5)\[4mgroff_tmac[24m(5)]8;;\. The formatter's default in this installation is β[1mA4[22mβ.
It is up to each macro package to respect the page dimensions configured in this way. Some offer alternative mechanisms.
For each output device, the size of the output medium can be set in its [4mDESC[24m file. Most output drivers also recognize a
command-line option [1m-p [22mto override the default dimensions and an option [1m-l [22mto use landscape orientation. See ]8;;man:groff_font(5)\[4mgroff_font[24m(5)]8;;\
for a description of the [1mpapersize [22mdirective, which takes an argument of the same form as [1m-p[22m. The output driver's man page,
such as ]8;;man:grops(1)\[4mgrops[24m(1)]8;;\, may also be helpful. [4mgroff[24m uses the command-line option [1m-P [22mto pass options to output devices; for examβ
ple, use the following for PostScript output on A4 paper in landscape orientation.
groff -Tps -dpaper=a4l -P-pa4 -P-l -ms foo.ms > foo.ps
[1mFront end[0m
The [4mgroff[24m program is a wrapper around the ]8;;man:troff(1)\[4mtroff[24m(1)]8;;\ program. It allows one to specify preprocessors via command-line options
and automatically runs the appropriate postprocessor for the selected output device. Doing so, the manual construction of
pipelines or management of temporary files required of users of traditional ]8;;man:roff(7)\[4mroff[24m(7)]8;;\ systems can be avoided. Use the ]8;;man:grog(1)\[4mgrog[24m(1)]8;;\
program to infer an appropriate [4mgroff[24m command line to format a document.
[1mLanguage[0m
Input to a [4mroff[24m system is in plain text interleaved with control lines and escape sequences. The combination constitutes a
document in one of a family of languages we also call [4mroff[24m; see ]8;;man:roff(7)\[4mroff[24m(7)]8;;\ for background. An overview of GNU [4mroff[24m language
syntax and features, including lists of all supported escape sequences, requests, and predefined registers, can be found in
]8;;man:groff(7)\[4mgroff[24m(7)]8;;\. GNU [4mroff[24m extensions to the AT&T [4mtroff[24m language, a common subset of [4mroff[24m dialects extant today, are detailed in
]8;;man:groff_diff(7)\[4mgroff_diff[24m(7)]8;;\.
[1mPreprocessors[0m
A preprocessor interprets a domain-specific language that produces [4mroff[24m language output. Frequently, such input is confined
to sections or regions of a [4mroff[24m input file (bracketed with macro calls specific to each preprocessor), which it replaces.
Preprocessors therefore often interpret a subset of [4mroff[24m syntax along with their own language. GNU [4mroff[24m provides reimpleβ
mentations of most preprocessors familiar to users of AT&T [4mtroff[24m; these routinely have extended features and/or require GNU
[4mtroff[24m to format their output.
[4mtbl[24m lays out tables;
[4meqn[24m typesets mathematics;
[4mpic[24m draws diagrams;
[4mrefer[24m processes bibliographic references;
[4msoelim[24m preprocesses βsourcedβ input files;
[4mgrn[24m renders ]8;;man:gremlin(1)\[4mgremlin[24m(1)]8;;\ diagrams;
[4mchem[24m draws chemical structural formulæ using [4mpic[24m;
[4mgperl[24m populates [4mgroff[24m registers and strings using ]8;;man:perl(1)\[4mperl[24m(1)]8;;\;
[4mglilypond[24m embeds [4mLilyPond[24m sheet music; and
[4mgpinyin[24m eases Mandarin Chinese input using Hanyu Pinyin.
A preprocessor unique to GNU [4mroff[24m is ]8;;man:preconv(1)\[4mpreconv[24m(1)]8;;\, which converts various input encodings to something GNU [4mtroff[24m can underβ
stand. When used, it is run before any other preprocessors.
Most preprocessors enclose content between a pair of characteristic tokens. Such a token must occur at the beginning of an
input line and use the dot control character. Spaces and tabs must not follow the control character or precede the end of
the input line. Deviating from these rules defeats a token's recognition by the preprocessor. Tokens are generally preβ
served in preprocessor output and interpreted as macro calls subsequently by [4mtroff[24m. The [4mideal[24m preprocessor is not yet
available in [4mgroff[24m.
ββββββββββββββββ¬ββββββββββββββββββ¬βββββββββββββββββ
β preprocessor β starting token β ending token β
ββββββββββββββββΌββββββββββββββββββΌβββββββββββββββββ€
β chem β .cstart β .cend β
β eqn β .EQ β .EN β
β grap β .G1 β .G2 β
β grn β .GS β .GE β
β ideal β .IS β .IE β
β β β .IF β
β pic β .PS β .PE β
β β β .PF β
β β β .PY β
β refer β .R1 β .R2 β
β tbl β .TS β .TE β
ββββββββββββββββΌββββββββββββββββββΌβββββββββββββββββ€
β glilypond β .lilypond start β .lilypond stop β
β gperl β .Perl start β .Perl stop β
β gpinyin β .pinyin start β .pinyin stop β
ββββββββββββββββ΄ββββββββββββββββββ΄βββββββββββββββββ
[1mMacro packages[0m
Macro files are [4mroff[24m input files designed to produce no output themselves but instead ease the preparation of other [4mroff[0m
documents. When a macro file is installed at a standard location and suitable for use by a general audience, it is termed a
[4mmacro[24m [4mpackage[24m.
Macro packages can be loaded prior to any [4mroff[24m input documents with the [1m-m [22moption. The GNU [4mroff[24m system implements most
well-known macro packages for AT&T [4mtroff[24m in a compatible way and extends them. These have one- or two-letter names arising
from intense practices of naming economy in early Unix culture, a laconic approach that led to many of the packages being
identified in general usage with the [4mnroff[24m and [4mtroff[24m option letter used to invoke them, sometimes to punning effect, as with
βmanβ (short for βmanualβ), and even with the option dash, as in the case of the [4ms[24m package, much better known as [4mms[24m or even
[4m-ms[24m.
Macro packages serve a variety of purposes. Some are βfull-serviceβ packages, adopting responsibility for page layout among
other fundamental tasks, and defining their own lexicon of macros for document composition; each such package stands alone
and a given document can use at most one.
[4man[24m is used to compose man pages in the format originating in Version 7 Unix (1979); see ]8;;man:groff_man(7)\[4mgroff_man[24m(7)]8;;\. It can be speciβ
fied on the command line as [1m-man[22m.
[4mdoc[24m is used to compose man pages in the format originating in 4.3BSD-Reno (1990); see ]8;;man:groff_mdoc(7)\[4mgroff_mdoc[24m(7)]8;;\. It can be specified
on the command line as [1m-mdoc[22m.
[4me[24m is the Berkeley general-purpose macro suite, developed as an alternative to AT&T's [4ms[24m; see ]8;;man:groff_me(7)\[4mgroff_me[24m(7)]8;;\. It can be
specified on the command line as [1m-me[22m.
[4mm[24m implements the format used by the second-generation AT&T macro suite for general documents, a successor to [4ms[24m; see
]8;;man:groff_mm(7)\[4mgroff_mm[24m(7)]8;;\. It can be specified on the command line as [1m-mm[22m.
[4mom[24m (invariably called βmomβ) is a modern package written by Peter Schaffter specifically for GNU [4mroff[24m. Consult the ]8;;file:///usr/share/doc/groff-base/html/mom/toc.html\[4mmom[0m
HTML manual]8;;\ for extensive documentation. Sheβfor [4mmom[24m takes the female pronounβcan be specified on the command line
as [1m-mom[22m.
[4ms[24m is the original AT&T general-purpose document format; see ]8;;man:groff_ms(7)\[4mgroff_ms[24m(7)]8;;\. It can be specified on the command line as
[1m-ms[22m.
Others are supplemental. For instance, [4mandoc[24m is a wrapper package specific to GNU [4mroff[24m that recognizes whether a document
uses [4mman[24m or [4mmdoc[24m format and loads the corresponding macro package. It can be specified on the command line as [1m-mandoc[22m. A
]8;;man:man(1)\[4mman[24m(1)]8;;\ librarian program may use this macro file to delegate loading of the correct macro package; it is thus unnecessary
for [4mman[24m itself to scan the contents of a document to decide the issue.
Many macro files augment the function of the full-service packages, or of [4mroff[24m documents that do not employ such a packageβ
the latter are sometimes characterized as βrawβ. These auxiliary packages are described, along with details of macro file
naming and placement, in ]8;;man:groff_tmac(5)\[4mgroff_tmac[24m(5)]8;;\.
[1mFormatters[0m
The formatter, the program that interprets [4mroff[24m language input, is ]8;;man:troff(1)\[4mtroff[24m(1)]8;;\. It provides the features of the AT&T [4mtroff[24m and
[4mnroff[24m programs as well as many extensions. The command-line option [1m-C [22mswitches [4mtroff[24m into [4mcompatibility[24m [4mmode[24m, which tries
to emulate AT&T [4mtroff[24m as closely as is practical to enable the formatting of documents written for the older system.
A shell script, ]8;;man:nroff(1)\[4mnroff[24m(1)]8;;\, emulates the behavior of AT&T [4mnroff[24m. It attempts to correctly encode the output based on the loβ
cale, relieving the user of the need to specify an output device with the [1m-T [22moption and is therefore convenient for use with
terminal output devices, described in the next subsection.
GNU [4mtroff[24m generates output in a device-independent, but not device-agnostic, page description language detailed in
]8;;man:groff_out(5)\[4mgroff_out[24m(5)]8;;\.
[1mOutput devices[0m
[4mtroff[24m output is formatted for a particular [4moutput[24m [4mdevice[24m, typically specified by the [1m-T [22moption to the formatter or a front
end. If neither this option nor the [4mGROFF_TYPESETTER[24m environment variable is used, the default output device is [1mps[22m. An
output device may be any of the following.
[1mascii [22mfor terminals using the ISO 646 1991:IRV character set and encoding, also known as US-ASCII.
[1mcp1047 [22mfor terminals using the IBM code page 1047 character set and encoding.
[1mdvi [22mfor TeX DVI format.
[1mhtml[0m
[1mxhtml [22mfor HTML and XHTML output, respectively.
[1mlatin1 [22mfor terminals using the ISO Latin-1 (ISO 8859-1) character set and encoding.
[1mlbp [22mfor Canon CaPSL printers (LBP-4 and LBP-8 series laser printers).
[1mlj4 [22mfor HP LaserJet4-compatible (or other PCL5-compatible) printers.
[1mpdf [22mfor PDF output.
[1mps [22mfor PostScript output.
[1mutf8 [22mfor terminals using the ISO 10646 (βUnicodeβ) character set in UTF-8 encoding.
[1mX75 [22mfor previewing with [4mgxditview[24m using 75 dpi resolution and a 10-point base type size.
[1mX75-12 [22mfor previewing with [4mgxditview[24m using 75 dpi resolution and a 12-point base type size.
[1mX100 [22mfor previewing with [4mgxditview[24m using 100 dpi resolution and a 10-point base type size.
[1mX100-12 [22mfor previewing with [4mgxditview[24m using 100 dpi resolution and a 12-point base type size.
[1mPostprocessors[0m
Any program that interprets the output of GNU [4mtroff[24m is a postprocessor. The postprocessors provided by GNU [4mroff[24m are [4moutput[0m
[4mdrivers[24m, which prepare a document for viewing or printing. Postprocessors for other purposes, such as page resequencing or
statistical measurement of a document, are conceivable.
An output driver supports one or more output devices, each with its own device description file. A device determines its
postprocessor with the [1mpostpro [22mdirective in its device description file; see ]8;;man:groff_font(5)\[4mgroff_font[24m(5)]8;;\. The [1m-X [22moption overrides this
selection, causing [4mgxditview[24m to serve as the output driver.
]8;;man:grodvi(1)\[4mgrodvi[24m(1)]8;;\
provides [1mdvi[22m.
]8;;man:grohtml(1)\[4mgrohtml[24m(1)]8;;\
provides [1mhtml [22mand [1mxhtml[22m.
]8;;man:grolbp(1)\[4mgrolbp[24m(1)]8;;\
provides [1mlbp[22m.
]8;;man:grolj4(1)\[4mgrolj4[24m(1)]8;;\
provides [1mlj4[22m.
]8;;man:gropdf(1)\[4mgropdf[24m(1)]8;;\
provides [1mpdf[22m.
]8;;man:grops(1)\[4mgrops[24m(1)]8;;\
provides [1mps[22m.
]8;;man:grotty(1)\[4mgrotty[24m(1)]8;;\
provides [1mascii[22m, [1mcp1047[22m, [1mlatin1[22m, and [1mutf8[22m.
]8;;man:gxditview(1)\[4mgxditview[24m(1)]8;;\
provides [1mX75[22m, [1mX75-12[22m, [1mX100[22m, and [1mX100-12[22m, and additionally can preview [1mps[22m.
[1mUtilities[0m
GNU [4mroff[24m includes a suite of utilities.
]8;;man:gdiffmk(1)\[4mgdiffmk[24m(1)]8;;\
marks differences between a pair of [4mroff[24m input files.
]8;;man:grog(1)\[4mgrog[24m(1)]8;;\
infers the [4mgroff[24m command a document requires.
Several utilities prepare descriptions of fonts, enabling the formatter to use them when producing output for a given deβ
vice.
]8;;man:addftinfo(1)\[4maddftinfo[24m(1)]8;;\
adds information to AT&T [4mtroff[24m font description files to enable their use with GNU [4mtroff[24m.
]8;;man:afmtodit(1)\[4mafmtodit[24m(1)]8;;\
creates font description files for PostScript Type 1 fonts.
]8;;man:pfbtops(1)\[4mpfbtops[24m(1)]8;;\
translates a PostScript Type 1 font in PFB (Printer Font Binary) format to PFA (Printer Font ASCII), which can then
be interpreted by [4mafmtodit[24m.
]8;;man:hpftodit(1)\[4mhpftodit[24m(1)]8;;\
creates font description files for the HP LaserJet 4 family of printers.
]8;;man:tfmtodit(1)\[4mtfmtodit[24m(1)]8;;\
creates font description files for the TeX DVI device.
]8;;man:xtotroff(1)\[4mxtotroff[24m(1)]8;;\
creates font description files for X Window System core fonts.
A trio of tools transform material constructed using [4mroff[24m preprocessor languages into graphical image files.
]8;;man:eqn2graph(1)\[4meqn2graph[24m(1)]8;;\
converts an [4meqn[24m equation into a cropped image.
]8;;man:grap2graph(1)\[4mgrap2graph[24m(1)]8;;\
converts a [4mgrap[24m diagram into a cropped image.
]8;;man:pic2graph(1)\[4mpic2graph[24m(1)]8;;\
converts a [4mpic[24m diagram into a cropped image.
Another set of programs works with the bibliographic data files used by the ]8;;man:refer(1)\[4mrefer[24m(1)]8;;\ preprocessor.
]8;;man:indxbib(1)\[4mindxbib[24m(1)]8;;\
makes inverted indices for bibliographic databases, speeding lookup operations on them.
]8;;man:lkbib(1)\[4mlkbib[24m(1)]8;;\
searches the databases.
]8;;man:lookbib(1)\[4mlookbib[24m(1)]8;;\
interactively searches the databases.
[1mExit status[0m
[4mgroff[24m exits with a failure status if there was a problem parsing its arguments and a successful status if either of the opβ
tions [1m-h [22mor [1m--help [22mwas specified. Otherwise, [4mgroff[24m runs a pipeline to process its input; if all commands within the
pipeline exit successfully, [4mgroff[24m does likewise. If not, [4mgroff[24m's exit status encodes a summary of problems encountered,
setting bit 0 if a command exited with a failure status, bit 1 if a command was terminated with a signal, and bit 2 if a
command could not be executed. (Thus, if all three misfortunes befell one's pipeline, [4mgroff[24m would exit with status 2^0 +
2^1 + 2^2 = 1+2+4 = 7.) To troubleshoot pipeline problems, you may wish to re-run the [4mgroff[24m command with the [1m-V [22moption and
break the reported pipeline down into separate stages, inspecting the exit status of and diagnostic messages emitted by each
command.
[1mEnvironment[0m
Normally, the path separator in environment variables ending with [4mPATH[24m is the colon; this may vary depending on the operatβ
ing system. For example, Windows uses a semicolon instead.
[4mGROFF_BIN_PATH[0m
This search path, followed by [4mPATH[24m, is used to locate commands executed by [4mgroff[24m. If it is not set, the installation
directory of the GNU [4mroff[24m executables, [4m/usr/bin[24m, is searched before [4mPATH[24m.
[4mGROFF_COMMAND_PREFIX[0m
GNU [4mroff[24m can be configured at compile time to apply a prefix to the names of the programs it provides that had a
counterpart in AT&T [4mtroff[24m, so that name collisions are avoided at run time. The default prefix is empty.
When used, this prefix is conventionally the letter βgβ. For example, GNU [4mtroff[24m would be installed as [4mgtroff[24m. Beβ
sides [4mtroff[24m, the prefix applies to the formatter [4mnroff[24m; the preprocessors [4meqn[24m, [4mgrn[24m, [4mpic[24m, [4mrefer[24m, [4mtbl[24m, and [4msoelim[24m; and
the utilities [4mindxbib[24m and [4mlookbib[24m.
[4mGROFF_ENCODING[0m
The value of this variable is passed to the [4mpreconv[24m(1) preprocessor's [1m-e [22moption to select the character encoding of
input files. This variable's existence implies the [4mgroff[24m option [1m-k[22m. If set but empty, [4mgroff[24m calls [4mpreconv[24m without
an [1m-e [22moption. [4mgroff[24m's [1m-K [22moption overrides [4mGROFF_ENCODING[24m.
[4mGROFF_FONT_PATH[0m
Seek the selected output device's directory of device and font description files in this list of directories. See
]8;;man:troff(1)\[4mtroff[24m(1)]8;;\ and ]8;;man:groff_font(5)\[4mgroff_font[24m(5)]8;;\.
[4mGROFF_TMAC_PATH[0m
Seek macro files in this list of directories. See ]8;;man:troff(1)\[4mtroff[24m(1)]8;;\ and ]8;;man:groff_tmac(5)\[4mgroff_tmac[24m(5)]8;;\.
[4mGROFF_TMPDIR[0m
Create temporary files in this directory. If not set, but the environment variable [4mTMPDIR[24m is set, temporary files
are created there instead. On Windows systems, if neither of the foregoing are set, the environment variables [4mTMP[0m
and [4mTEMP[24m (in that order) are checked also. Otherwise, temporary files are created in [4m/tmp[24m. The ]8;;man:refer(1)\[4mrefer[24m(1)]8;;\,
]8;;man:grohtml(1)\[4mgrohtml[24m(1)]8;;\, and ]8;;man:grops(1)\[4mgrops[24m(1)]8;;\ commands use temporary files.
[4mGROFF_TYPESETTER[0m
Set the default output device. If empty or not set, [1mps [22mis used. The [1m-T [22moption overrides [4mGROFF_TYPESETTER[24m.
[4mSOURCE_DATE_EPOCH[0m
A time stamp (expressed as seconds since the Unix epoch) to use as the output creation time stamp in place of the
current time. The time is converted to human-readable form using ]8;;man:gmtime(3)\[4mgmtime[24m(3)]8;;\ and ]8;;man:asctime(3)\[4masctime[24m(3)]8;;\ when the formatter starts
up and stored in registers usable by documents and macro packages.
[4mTZ[24m The time zone to use when converting the current time to human-readable form; see ]8;;man:tzset(3)\[4mtzset[24m(3)]8;;\. If [4mSOURCE_DATE_EPOCH[24m is
used, it is always converted to human-readable form using UTC.
[1mExamples[0m
[4mroff[24m systems are best known for formatting man pages. Once a ]8;;man:man(1)\[4mman[24m(1)]8;;\ librarian program has located a man page, it may exeβ
cute a [4mgroff[24m command much like the following.
groff -t -man -Tutf8 /usr/share/man/man1/groff.1
The librarian will also pipe the output through a pager, which might not interpret the SGR terminal escape sequences [4mgroff[0m
emits for boldface, underlining, or italics; see section βLimitationsβ below.
To process a [4mroff[24m input file using the preprocessors [4mtbl[24m and [4mpic[24m and the [4mme[24m macro package in the way to which AT&T [4mtroff[0m
users were accustomed, one would type (or script) a pipeline.
pic foo.me | tbl | troff -me -Tutf8 | grotty
Using [4mgroff[24m, this pipe can be shortened to an equivalent command.
groff -p -t -me -T utf8 foo.me
An even easier way to do this is to use ]8;;man:grog(1)\[4mgrog[24m(1)]8;;\ to guess the preprocessor and macro options and execute the result by using
the command substitution feature of the shell.
$(grog -Tutf8 foo.me)
Each command-line option to a postprocessor must be specified with any required leading dashes β[1m-[22mβ because [4mgroff[24m passes the
arguments as-is to the postprocessor; this permits arbitrary arguments to be transmitted. For example, to pass a title to
the [4mgxditview[24m postprocessor, the shell commands
groff -X -P -title -P 'trial run' mydoc.t
and
groff -X -Z mydoc.t | gxditview -title 'trial run' -
are equivalent.
[1mLimitations[0m
When paging output for the [1mascii[22m, [1mcp1047[22m, [1mlatin1[22m, and [1mutf8 [22mdevices, programs like ]8;;man:more(1)\[4mmore[24m(1)]8;;\ and ]8;;man:less(1)\[4mless[24m(1)]8;;\ may require command-
line options to correctly handle some terminal escape sequences; see ]8;;man:grotty(1)\[4mgrotty[24m(1)]8;;\.
On EBCDIC hosts such as OS/390 Unix, the output devices [1mascii [22mand [1mlatin1 [22maren't available. Conversely, the output device
[1mcp1047 [22mis not available on systems based on the ISO 646 or ISO 8859 character encoding standards.
[1mInstallation directories[0m
GNU [4mroff[24m installs files in varying locations depending on its compile-time configuration. On this installation, the followβ
ing locations are used.
[4m/etc/X11/app-defaults[0m
Application defaults directory for ]8;;man:gxditview(1)\[4mgxditview[24m(1)]8;;\.
[4m/usr/bin[0m
Directory containing [4mgroff[24m's executable commands.
[4m/usr/share/groff/1.23.0/eign[0m
List of common words for ]8;;man:indxbib(1)\[4mindxbib[24m(1)]8;;\.
[4m/usr/share/groff/1.23.0[0m
Directory for data files.
[4m/usr/dict/papers/Ind[0m
Default index for ]8;;man:lkbib(1)\[4mlkbib[24m(1)]8;;\ and ]8;;man:refer(1)\[4mrefer[24m(1)]8;;\.
[4m/usr/share/doc/groff-base[0m
Documentation directory.
[4m/usr/share/doc/groff-base/examples[0m
Example directory.
[4m/usr/share/groff/1.23.0/font[0m
Font directory.
[4m/usr/share/doc/groff-base/html[0m
HTML documentation directory.
[4m/usr/lib/font[0m
Legacy font directory.
[4m/usr/share/groff/site-font[0m
Local font directory.
[4m/usr/share/groff/site-tmac[0m
Local macro package ([4mtmac[24m file) directory.
[4m/usr/share/groff/1.23.0/tmac[0m
Macro package ([4mtmac[24m file) directory.
[4m/usr/share/groff/1.23.0/oldfont[0m
Font directory for compatibility with old versions of [4mgroff[24m; see ]8;;man:grops(1)\[4mgrops[24m(1)]8;;\.
[4m/usr/share/doc/groff-base/pdf[0m
PDF documentation directory.
[4m[1mgroff[24m macro directory[0m
Most macro files supplied with GNU [4mroff[24m are stored in [4m/usr/share/groff/1.23.0/tmac[24m for the installation corresponding to
this document. As a rule, multiple directories are searched for macro files; see ]8;;man:troff(1)\[4mtroff[24m(1)]8;;\. For a catalog of macro files
GNU [4mroff[24m provides, see ]8;;man:groff_tmac(5)\[4mgroff_tmac[24m(5)]8;;\.
[4m[1mgroff[24m device and font description directory[0m
Device and font description files supplied with GNU [4mroff[24m are stored in [4m/usr/share/groff/1.23.0/font[24m for the installation
corresponding to this document. As a rule, multiple directories are searched for device and font description files; see
]8;;man:troff(1)\[4mtroff[24m(1)]8;;\. For the formats of these files, see ]8;;man:groff_font(5)\[4mgroff_font[24m(5)]8;;\.
[1mAvailability[0m
Obtain links to [4mgroff[24m releases for download, its source repository, discussion mailing lists, a support ticket tracker, and
further information from the ]8;;http://www.gnu.org/software/groff\[4mgroff[24m page of the GNU website]8;;\.
A free implementation of the [4mgrap[24m preprocessor, written by ]8;;mailto:[email protected]\Ted Faber]8;;\, can be found at the ]8;;http://www.lunabase.org/~faber/Vault/software/grap/\[4mgrap[24m website]8;;\. [4mgroff[24m supports only
this [4mgrap[24m.
[1mAuthors[0m
[4mgroff[24m (both the front-end command and the overall system) was primarily written by ]8;;mailto:[email protected]\James Clark]8;;\. Contributors to this docuβ
ment include Clark, Trent A. Fisher, ]8;;mailto:[email protected]\Werner Lemberg]8;;\, ]8;;mailto:[email protected]\Bernd Warken]8;;\, and ]8;;mailto:[email protected]\G. Branden Robinson]8;;\.
[1mSee also[0m
[4mGroff:[24m [4mThe[24m [4mGNU[24m [4mImplementation[24m [4mof[24m [4mtroff[24m, by Trent A. Fisher and Werner Lemberg, is the primary [4mgroff[24m manual. You can browse
it interactively with βinfo groffβ.
Introduction, history, and further reading:
]8;;man:roff(7)\[4mroff[24m(7)]8;;\
Viewer for [4mgroff[24m (and AT&T device-independent [4mtroff[24m) documents:
]8;;man:gxditview(1)\[4mgxditview[24m(1)]8;;\
Preprocessors:
]8;;man:chem(1)\[4mchem[24m(1)]8;;\, ]8;;man:eqn(1)\[4meqn[24m(1)]8;;\, ]8;;man:neqn(1)\[4mneqn[24m(1)]8;;\, ]8;;man:glilypond(1)\[4mglilypond[24m(1)]8;;\, ]8;;man:grn(1)\[4mgrn[24m(1)]8;;\, ]8;;man:preconv(1)\[4mpreconv[24m(1)]8;;\, ]8;;man:gperl(1)\[4mgperl[24m(1)]8;;\, ]8;;man:pic(1)\[4mpic[24m(1)]8;;\, ]8;;man:gpinyin(1)\[4mgpinyin[24m(1)]8;;\, ]8;;man:refer(1)\[4mrefer[24m(1)]8;;\, ]8;;man:soelim(1)\[4msoelim[24m(1)]8;;\, ]8;;man:tbl(1)\[4mtbl[24m(1)]8;;\
Macro packages and package-specific utilities:
]8;;man:groff_hdtbl(7)\[4mgroff_hdtbl[24m(7)]8;;\, ]8;;man:groff_man(7)\[4mgroff_man[24m(7)]8;;\, ]8;;man:groff_man_style(7)\[4mgroff_man_style[24m(7)]8;;\, ]8;;man:groff_mdoc(7)\[4mgroff_mdoc[24m(7)]8;;\, ]8;;man:groff_me(7)\[4mgroff_me[24m(7)]8;;\, ]8;;man:groff_mm(7)\[4mgroff_mm[24m(7)]8;;\, ]8;;man:groff_mmse(7)\[4mgroff_mmse[24m(7)]8;;\ (only in
Swedish locales), ]8;;man:mmroff(1)\[4mmmroff[24m(1)]8;;\, ]8;;man:groff_mom(7)\[4mgroff_mom[24m(7)]8;;\, ]8;;man:pdfmom(1)\[4mpdfmom[24m(1)]8;;\, ]8;;man:groff_ms(7)\[4mgroff_ms[24m(7)]8;;\, ]8;;man:groff_rfc1345(7)\[4mgroff_rfc1345[24m(7)]8;;\, ]8;;man:groff_trace(7)\[4mgroff_trace[24m(7)]8;;\, ]8;;man:groff_www(7)\[4mgroff_www[24m(7)]8;;\
Bibliographic database management tools:
]8;;man:indxbib(1)\[4mindxbib[24m(1)]8;;\, ]8;;man:lkbib(1)\[4mlkbib[24m(1)]8;;\, ]8;;man:lookbib(1)\[4mlookbib[24m(1)]8;;\
Language, conventions, and GNU extensions:
]8;;man:groff(7)\[4mgroff[24m(7)]8;;\, ]8;;man:groff_char(7)\[4mgroff_char[24m(7)]8;;\, ]8;;man:groff_diff(7)\[4mgroff_diff[24m(7)]8;;\, ]8;;man:groff_font(5)\[4mgroff_font[24m(5)]8;;\, ]8;;man:groff_tmac(5)\[4mgroff_tmac[24m(5)]8;;\
Intermediate output language:
]8;;man:groff_out(5)\[4mgroff_out[24m(5)]8;;\
Formatter program:
]8;;man:troff(1)\[4mtroff[24m(1)]8;;\
Formatter wrappers:
]8;;man:nroff(1)\[4mnroff[24m(1)]8;;\, ]8;;man:pdfroff(1)\[4mpdfroff[24m(1)]8;;\
Postprocessors for output devices:
]8;;man:grodvi(1)\[4mgrodvi[24m(1)]8;;\, ]8;;man:grohtml(1)\[4mgrohtml[24m(1)]8;;\, ]8;;man:grolbp(1)\[4mgrolbp[24m(1)]8;;\, ]8;;man:grolj4(1)\[4mgrolj4[24m(1)]8;;\, ]8;;man:gropdf(1)\[4mgropdf[24m(1)]8;;\, ]8;;man:grops(1)\[4mgrops[24m(1)]8;;\, ]8;;man:grotty(1)\[4mgrotty[24m(1)]8;;\
Font support utilities:
]8;;man:addftinfo(1)\[4maddftinfo[24m(1)]8;;\, ]8;;man:afmtodit(1)\[4mafmtodit[24m(1)]8;;\, ]8;;man:hpftodit(1)\[4mhpftodit[24m(1)]8;;\, ]8;;man:pfbtops(1)\[4mpfbtops[24m(1)]8;;\, ]8;;man:tfmtodit(1)\[4mtfmtodit[24m(1)]8;;\, ]8;;man:xtotroff(1)\[4mxtotroff[24m(1)]8;;\
Graphics conversion utilities:
]8;;man:eqn2graph(1)\[4meqn2graph[24m(1)]8;;\, ]8;;man:grap2graph(1)\[4mgrap2graph[24m(1)]8;;\, ]8;;man:pic2graph(1)\[4mpic2graph[24m(1)]8;;\
Difference-marking utility:
]8;;man:gdiffmk(1)\[4mgdiffmk[24m(1)]8;;\
βgroff guessβ utility:
]8;;man:grog(1)\[4mgrog[24m(1)]8;;\
groff 1.23.0 31 March 2024 [4mgroff[24m(1)