<s>
troff	B-Application
(	O
)	O
,	O
short	O
for	O
"	O
typesetter	O
roff	O
"	O
,	O
is	O
the	O
major	O
component	O
of	O
a	O
document	B-Application
processing	I-Application
system	I-Application
developed	O
by	O
Bell	O
Labs	O
for	O
the	O
Unix	B-Application
operating	I-Application
system	I-Application
.	O
</s>
<s>
troff	B-Application
and	O
the	O
related	O
nroff	B-Device
were	O
both	O
developed	O
from	O
the	O
original	O
roff	O
.	O
</s>
<s>
While	O
nroff	B-Device
was	O
intended	O
to	O
produce	O
output	O
on	O
terminals	O
and	O
line	O
printers	O
,	O
troff	B-Application
was	O
intended	O
to	O
produce	O
output	O
on	O
typesetting	O
systems	O
,	O
specifically	O
the	O
Graphic	O
Systems	O
CAT	O
that	O
had	O
been	O
introduced	O
in	O
1972	O
.	O
</s>
<s>
Both	O
used	O
the	O
same	O
underlying	O
markup	O
language	O
and	O
a	O
single	O
source	O
file	O
could	O
normally	O
be	O
used	O
by	O
nroff	B-Device
or	O
troff	B-Application
without	O
change	O
.	O
</s>
<s>
troff	B-Application
features	O
commands	O
to	O
designate	O
fonts	O
,	O
spacing	O
,	O
paragraphs	O
,	O
margins	O
,	O
footnotes	O
and	O
more	O
.	O
</s>
<s>
Unlike	O
many	O
other	O
text	O
formatters	O
,	O
troff	B-Application
can	O
position	O
characters	O
arbitrarily	O
on	O
a	O
page	O
,	O
even	O
overlapping	O
them	O
,	O
and	O
has	O
a	O
fully	O
programmable	O
input	O
language	O
.	O
</s>
<s>
Separate	O
preprocessors	B-General_Concept
are	O
used	O
for	O
more	O
convenient	O
production	O
of	O
tables	O
,	O
diagrams	O
,	O
and	O
mathematics	O
.	O
</s>
<s>
Inputs	O
to	O
troff	B-Application
are	O
plain	O
text	O
files	O
that	O
can	O
be	O
created	O
by	O
any	O
text	O
editor	O
.	O
</s>
<s>
A	O
typical	O
distribution	O
of	O
troff	B-Application
includes	O
the	O
me	O
macros	O
for	O
formatting	O
research	O
papers	O
,	O
man	O
and	O
mdoc	O
macros	O
for	O
creating	O
Unix	B-Application
man	B-Protocol
pages	I-Protocol
,	O
mv	O
macros	O
for	O
creating	O
mountable	O
transparencies	B-Device
,	O
and	O
the	O
ms	O
and	O
mm	O
macros	O
for	O
letters	O
,	O
books	O
,	O
technical	O
memoranda	O
,	O
and	O
reports	O
.	O
</s>
<s>
troffs	B-Application
origins	O
can	O
be	O
traced	O
to	O
a	O
text-formatting	O
program	B-Application
called	O
RUNOFF	B-Protocol
,	O
which	O
was	O
written	O
by	O
Jerome	O
H	O
.	O
Saltzer	O
for	O
MIT	O
's	O
CTSS	B-Operating_System
operating	B-General_Concept
system	I-General_Concept
in	O
the	O
mid-1960s	O
.	O
</s>
<s>
Bob	O
Morris	O
ported	O
it	O
to	O
the	O
GE	B-Device
635	I-Device
architecture	O
and	O
called	O
the	O
program	B-Application
roff	O
(	O
an	O
abbreviation	O
of	O
runoff	B-Protocol
)	O
.	O
</s>
<s>
It	O
was	O
rewritten	O
as	O
rf	B-Protocol
for	O
the	O
PDP-7	B-Device
,	O
and	O
at	O
the	O
same	O
time	O
(	O
1969	O
)	O
,	O
Doug	O
McIlroy	O
rewrote	O
an	O
extended	O
and	O
simplified	O
version	O
of	O
roff	O
in	O
the	O
BCPL	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
The	O
first	O
version	O
of	O
Unix	B-Application
was	O
developed	O
on	O
a	O
PDP-7	B-Device
which	O
was	O
sitting	O
around	O
Bell	O
Labs	O
.	O
</s>
<s>
In	O
1971	O
the	O
developers	O
wanted	O
to	O
get	O
a	O
PDP-11	B-Device
for	O
further	O
work	O
on	O
the	O
operating	B-General_Concept
system	I-General_Concept
.	O
</s>
<s>
This	O
first	O
formatting	O
program	B-Application
was	O
a	O
reimplementation	O
of	O
McIllroy	O
's	O
roff	O
,	O
written	O
by	O
Joe	O
F	O
.	O
Ossanna	O
.	O
</s>
<s>
When	O
they	O
needed	O
a	O
more	O
flexible	O
language	O
,	O
a	O
new	O
version	O
of	O
roff	O
called	O
nroff	B-Device
(	O
newer	O
"	O
roff	O
"	O
)	O
was	O
written	O
,	O
which	O
provided	O
the	O
basis	O
for	O
all	O
future	O
versions	O
.	O
</s>
<s>
When	O
they	O
got	O
a	O
Graphic	O
Systems	O
CAT	O
phototypesetter	O
,	O
Ossanna	O
modified	O
nroff	B-Device
to	O
support	O
multiple	O
fonts	O
and	O
proportional	O
spacing	O
.	O
</s>
<s>
Dubbed	O
troff	B-Application
,	O
for	O
typesetter	O
roff	O
,	O
its	O
sophisticated	O
output	O
amazed	O
the	O
typesetter	O
manufacturer	O
and	O
confused	O
peer	O
reviewers	O
,	O
who	O
thought	O
that	O
manuscripts	O
using	O
troff	B-Application
had	O
been	O
published	O
before.J.	O
</s>
<s>
Nroff/Troff	O
User	O
's	O
Manual	B-Protocol
.	O
</s>
<s>
As	O
such	O
,	O
the	O
name	O
troff	B-Application
is	O
pronounced	O
rather	O
than	O
*	O
.	O
</s>
<s>
With	O
troff	B-Application
came	O
nroff	B-Device
(	O
they	O
were	O
actually	O
almost	O
the	O
same	O
program	B-Application
)	O
,	O
which	O
was	O
for	O
producing	O
output	O
for	O
line	O
printers	O
and	O
character	O
terminals	O
.	O
</s>
<s>
It	O
understood	O
everything	O
troff	B-Application
did	O
,	O
and	O
ignored	O
the	O
commands	O
which	O
were	O
not	O
applicable	O
,	O
e.g.	O
,	O
font	O
changes	O
.	O
</s>
<s>
Ossanna	O
's	O
troff	B-Application
was	O
written	O
in	O
PDP-11	B-Device
assembly	B-Language
language	I-Language
and	O
produced	O
output	O
specifically	O
for	O
the	O
CAT	O
phototypesetter	O
.	O
</s>
<s>
He	O
rewrote	O
it	O
in	O
C	B-Language
,	O
although	O
it	O
was	O
now	O
7000	O
lines	O
of	O
uncommented	O
code	O
and	O
still	O
dependent	O
on	O
the	O
CAT	O
.	O
</s>
<s>
Ossanna	O
died	O
before	O
this	O
task	O
was	O
completed	O
,	O
so	O
Brian	O
Kernighan	O
took	O
on	O
the	O
task	O
of	O
rewriting	O
troff	B-Application
.	O
</s>
<s>
Also	O
,	O
this	O
new	O
version	O
of	O
troff	B-Application
(	O
often	O
called	O
ditroff	B-Application
for	O
device	B-Operating_System
independent	I-Operating_System
troff	B-Application
)	O
had	O
several	O
extensions	O
,	O
which	O
included	O
drawing	O
functions.B.	O
</s>
<s>
A	O
Typesetter-Independent	O
TROFF	B-Application
.	O
</s>
<s>
The	O
program	B-Application
's	O
documentation	O
defines	O
the	O
output	O
format	O
of	O
ditroff	B-Application
,	O
which	O
is	O
used	O
by	O
many	O
modern	O
troff	B-Application
clones	O
like	O
GNU	B-Application
groff	I-Application
.	O
</s>
<s>
The	O
troff	B-Application
collection	O
of	O
tools	O
(	O
including	O
pre	O
-	O
and	O
post-processors	O
)	O
was	O
eventually	O
called	O
Documenter	O
's	O
WorkBench	O
(	O
DWB	O
)	O
,	O
and	O
was	O
under	O
continuous	O
development	O
in	O
Bell	O
Labs	O
and	O
later	O
at	O
the	O
spin-off	O
Unix	B-Application
System	I-Application
Laboratories	O
(	O
USL	O
)	O
through	O
1994	O
.	O
</s>
<s>
At	O
that	O
time	O
,	O
SoftQuad	O
took	O
over	O
the	O
maintenance	O
,	O
although	O
Brian	O
Kernighan	O
continued	O
to	O
improve	O
troff	B-Application
on	O
his	O
own	O
.	O
</s>
<s>
Thus	O
,	O
there	O
are	O
at	O
least	O
the	O
following	O
variants	O
of	O
the	O
original	O
Bell	O
Labs	O
troff	B-Application
in	O
use	O
:	O
</s>
<s>
troff	B-Application
,	O
Plan	B-Operating_System
9	I-Operating_System
edition	O
.	O
</s>
<s>
While	O
troff	B-Application
has	O
been	O
supplanted	O
by	O
other	O
programs	O
such	O
as	O
Interleaf	O
,	O
FrameMaker	B-Device
,	O
and	O
LaTeX	B-Application
,	O
it	O
is	O
still	O
being	O
used	O
quite	O
extensively	O
.	O
</s>
<s>
It	O
remains	O
the	O
default	O
formatter	O
for	O
the	O
UNIX	B-Protocol
documentation	I-Protocol
.	O
</s>
<s>
The	O
software	O
was	O
reimplemented	O
as	O
groff	B-Application
for	O
the	B-Operating_System
GNU	I-Operating_System
system	I-Operating_System
beginning	O
in	O
1990	O
.	O
</s>
<s>
In	O
addition	O
,	O
due	O
to	O
the	O
open	B-Application
sourcing	I-Application
of	O
Ancient	B-Operating_System
UNIX	I-Operating_System
systems	I-Operating_System
,	O
as	O
well	O
as	O
modern	O
successors	O
such	O
as	O
the	O
ditroff-based	O
open-sourced	O
versions	O
found	O
on	O
OpenSolaris	B-Operating_System
and	O
Plan	B-Operating_System
9	I-Operating_System
from	I-Operating_System
Bell	I-Operating_System
Labs	I-Operating_System
,	O
there	O
are	O
several	O
versions	O
of	O
AT&T	O
troff	B-Application
(	O
CAT	O
and	O
ditroff-basedSee	O
the	O
man	B-Protocol
page	I-Protocol
of	O
the	O
ditroff	B-Application
->	O
postscript	O
converter	O
on	O
OpenSolaris	B-Operating_System
:	O
)	O
available	O
under	O
various	O
open-source	B-Application
licenses	O
.	O
</s>
<s>
Troff	B-Application
includes	O
macros	O
that	O
are	O
run	O
before	O
starting	O
to	O
process	O
the	O
document	O
.	O
</s>
<s>
The	O
command-line	O
argument	O
for	O
including	O
a	O
macro	O
set	O
is	O
-mname	O
,	O
which	O
has	O
led	O
to	O
many	O
macro	O
sets	O
being	O
known	O
as	O
the	O
base	O
filename	O
with	O
a	O
leading	O
m	O
.	O
</s>
<s>
mdoc	O
for	O
semantically-annotated	O
manual	B-Protocol
pages	I-Protocol
,	O
which	O
are	O
better	O
adapted	O
to	O
mandoc	B-Application
conversion	O
to	O
other	O
formats	O
.	O
</s>
<s>
mandoc	B-Application
is	O
a	O
fusion	O
that	O
supports	O
both	O
sets	O
of	O
manual	B-Protocol
commands	O
.	O
</s>
<s>
A	O
more	O
comprehensive	O
list	O
of	O
macros	O
available	O
is	O
usually	O
listed	O
in	O
a	O
tmac(5 )	O
manual	B-Protocol
page	I-Protocol
.	O
</s>
<s>
As	O
troff	B-Application
evolved	O
,	O
since	O
there	O
are	O
several	O
things	O
which	O
cannot	O
be	O
done	O
easily	O
in	O
troff	B-Application
,	O
several	O
preprocessors	B-General_Concept
were	O
developed	O
.	O
</s>
<s>
These	O
programs	O
transform	O
certain	O
parts	O
of	O
a	O
document	O
into	O
troff	B-Application
input	O
,	O
fitting	O
naturally	O
into	O
the	O
use	O
of	O
"	O
pipelines	B-Operating_System
"	O
in	O
Unix	B-Application
—	O
sending	O
the	O
output	O
of	O
one	O
program	B-Application
as	O
the	O
input	O
to	O
another	O
(	O
see	O
pipes	B-Operating_System
and	I-Operating_System
filters	I-Operating_System
)	O
.	O
</s>
<s>
Typically	O
,	O
each	O
preprocessor	B-General_Concept
translates	O
only	O
sections	O
of	O
the	O
input	O
file	O
that	O
are	O
specially	O
marked	O
,	O
passing	O
the	O
rest	O
of	O
the	O
file	O
through	O
unchanged	O
.	O
</s>
<s>
The	O
embedded	O
preprocessing	O
instructions	O
are	O
written	O
in	O
a	O
simple	O
application-specific	B-Language
programming	I-Language
language	I-Language
,	O
which	O
provides	O
a	O
high	O
degree	O
of	O
power	O
and	O
flexibility	O
.	O
</s>
<s>
eqn	B-Application
preprocessor	B-General_Concept
allows	O
mathematical	O
formulae	O
to	O
be	O
specified	O
in	O
simple	O
and	O
intuitive	O
manner.B.	O
</s>
<s>
tbl	B-Application
is	O
a	O
preprocessor	B-General_Concept
for	O
formatting	O
tables	O
.	O
</s>
<s>
refer	B-Application
(	O
and	O
the	O
similar	O
program	B-Application
bib	O
)	O
processes	O
citations	O
in	O
a	O
document	O
according	O
to	O
a	O
bibliographic	O
database	O
.	O
</s>
<s>
Three	O
preprocessors	B-General_Concept
provide	O
troff	B-Application
with	O
drawing	O
capabilities	O
by	O
defining	O
a	O
domain-specific	B-Language
language	I-Language
for	O
describing	O
the	O
picture	O
.	O
</s>
<s>
pic	B-Language
is	O
a	O
procedural	B-Application
programming	I-Application
language	I-Application
providing	O
various	O
drawing	O
functions	O
like	O
circle	O
and	O
box.B.	O
</s>
<s>
PIC	B-Language
—	O
A	O
Graphics	O
Language	O
for	O
Typesetting	O
(	O
Revised	O
User	O
Manual	B-Protocol
)	O
.	O
</s>
<s>
ideal	O
allows	O
the	O
drawing	O
of	O
pictures	O
declaratively	B-Language
,	O
deriving	O
the	O
picture	O
by	O
solving	O
a	O
system	O
of	O
simultaneous	O
equations	O
based	O
on	O
vectors	O
and	O
transformations	O
described	O
by	O
its	O
input.C.	O
</s>
<s>
IDEAL	O
User	O
's	O
Manual	B-Protocol
.	O
</s>
<s>
grn	O
describes	O
the	O
pictures	O
through	O
graphical	O
elements	O
drawn	O
at	O
absolute	O
coordinates	O
,	O
based	O
on	O
the	O
gremlin	O
file	O
format	O
defined	O
by	O
an	O
early	O
graphics	O
workstation.grn	O
—	O
groff	B-Application
preprocessor	B-General_Concept
for	O
gremlin	O
files	O
.	O
</s>
<s>
Yet	O
more	O
preprocessors	B-General_Concept
allow	O
the	O
drawing	O
of	O
more	O
complex	O
pictures	O
by	O
generating	O
output	O
for	O
pic	B-Language
.	O
</s>
<s>
grap	O
draws	O
charts	O
,	O
like	O
scatter	B-Application
plots	I-Application
and	O
histograms.J.	O
</s>
<s>
GRAP	O
—	O
A	O
Language	O
for	O
Typesetting	O
Graphs	O
(	O
Tutorial	O
and	O
User	O
Manual	B-Protocol
)	O
.	O
</s>
<s>
CHEM	O
—	O
A	O
Program	B-Application
for	O
Typesetting	O
Chemical	O
Structure	O
Diagrams	O
.	O
</s>
<s>
dformat''	O
draws	O
record-based	B-Application
data	B-General_Concept
structures	I-General_Concept
.	O
</s>
