Title Page: Producing PDFs with groff and mom
Contents
Producing PDFs with groff and mom
1. Introduction
2. Using groff to generate PDF files
3. Creating PDF links with mom
3.1. Creating destination points at headings
3.2. Creating destination points at arbitrary locations
3.3. Creating internal links
3.4. Creating external links
3.5. Assigning a colour to links
4. The PDF Outline
4.1. Opening and closing levels
4.2. Suspending/disabling collection of outline entries
4.3. The PDF window title
5. Tables of Contents
5.1. Generating a Table of Contents
5.2. Positioning the Table of Contents
6. pdfmom: Simplifying PDF output
6.1. The problem of forward references
6.2. pdfmom
6.3. Setting papersize within a source file
6.4. Differences between pdfmom and pdfroff
7. Comparison of -Tps/-mpdfmark with -Tpdf/-mom
Pr
oducing PDFs
with gr
off and mom
Deri James
and
P
eter Schaffter
This file is par
t of groff
, the GNU roff typesetting system.
Groff is free software
. Y
ou can redistribute it and
/or
modify it under the ter
ms of the GNU General Pub
lic
License as pub
lished b
y the F
ree Software F
oundation,
either v
ersion 3 of the License, or (at y
our option) any
later v
ersion.
Y
ou should ha
v
e receiv
ed a cop
y of the GNU General
Pub
lic License along with this progr
am. If not, see:
http://www
.gnu.org/licenses/
©20
1
5, 20
1
7 F
ree Software F
oundation
Contents
1.
Introduction
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
2. Using groff to gener
ate PDF files
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
3. Creating PDF links with mom
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
3.1. Creating destination points at headings
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2
3.2. Creating destination points at arbitrar
y locations
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2
3.3. Creating inter
nal links
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2
3.4. Creating e
xter
nal links
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2
3.5. Assigning a colour to links
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
4. The PDF Outline
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
4.1. Opening and closing le
v
els
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
4.2. Suspending/disab
ling collection of outline entries
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4
4.3. The PDF window title
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4
5. T
ab
les of Contents
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4
5.1. Generating a T
ab
le of Contents
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4
5.2. P
ositioning the T
ab
le of Contents
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4
6. pdfmom: Simplifying PDF output
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5
6.1. The prob
lem of f
orward ref
erences
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5
6.2.
pdfmom
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5
6.3. Setting papersize within a source file
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5
6.4. Diff
erences between pdfmom and pdfroff
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5
7. Comparison of -Tps
/
-mpdfmark with -Tpdf
/
-mom
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
6
-
i
-
Pr
oducing PDFs
with gr
off and mom
Deri James
and
P
eter Schaffter
1.
Intr
oduction
PD
F
do
cu
me
nt
s
ar
e
in
te
nd
ed
to
be
“e
le
ct
ro
ni
c
pa
pe
r
,
”
an
d,
as
su
ch
,
ta
k
e
ad
v
an
ta
ge
of
th
e
di
gi
ta
l
me
di
um
in
w
a
ys
th
at
P
os
tS
cri
pt
do
cu
me
nt
s
do
no
t.
Ch
ie
f
am
on
gs
t
th
es
e
ar
e
cl
ic
ka
b
le
li
nk
s
th
at
po
in
t
to
na
me
d
de
st
in
at
io
ns
,
ei
th
er
wi
th
in
th
e
do
cu
me
nt
s
th
em
se
lv
es
(
in
te
rnal
li
nk
s
)
or
to
re
mo
te
w
eb
pa
ge
s
(
e
xt
erna
l
li
nk
s
),
an
d
th
e
ge
ne
r
at
io
n
of
a
cl
ic
ka
b
le
do
cu
me
nt
ou
tl
in
e
th
at
ap
pe
ar
s
in
th
e
Co
nt
en
ts
p
an
el
o
f
mo
st
P
DF
v
ie
w
er
s
.
Using
gr
off
and
mom
to
produce PDF
documents results
in
the
automatic generation
of
clic
kab
le
document
outlines
(discussed
below
,
“4.
The
PDF
Outline”
),
and,
if
the
TOC
macro
is
included
in
the
source
file,
entries
in
the
printable
tab
le
of
contents
can
be
clic
k
ed
on
as
well
when
the
docu-
ment is vie
wed at the
screen (see
“5. T
ab
les of Contents”
).
2. Using gr
off to generate PDF files
Groff provides more than
one wa
y to
generate PDF documents
from files
f
or
matted with
the
mom
macros. One is to call
gr
off
directly
, either with
groff [-Tps] -mom -m pdfmark doc.mom | ps2pdf -
doc.pdf
which pipes output from the
gr
ops
P
ostScript dr
iv
er through
ps2pdf
, or
groff -Tpdf -mom doc.mom > doc.pdf
which uses the nativ
e PDF driver
,
gr
opdf
. Alter
nativ
ely
, one ma
y call the wrapper
pdfroff -mom -mpdfmark --no-toc doc.mom > doc.pdf
A
f
our
th,
pref
erred
method
is
to
use
pdfmom
,
which
is
strongly
recommended
since
it
imple-
ments the full range of PDF f
eatures a
v
ailab
le in
mom
.
pdfmom doc.mom > doc.pdf
One
reason
to
pref
er
using
the
nativ
e
PDF
driver
(via
pdfmom
or
-Tpdf
)
is
that
papersizes
set
within
mom
source
files
(see
paper
and
page
setup
macros
)
do
not
require
a
corresponding
-P-p<papersize>
flag on the command line.
There are other minor diff
erences between the methods
, discussed
here
.
3. Creating PDF links with mom
Often,
b
ut
not
alwa
ys,
links
in
the
body
of
a
PDF
document
point
to
headings
else
where
in
the
same document. Creating these links is a simple process. First, identify the places to link to (“des-
tinations”), then link to them from any place in the document.
-
1
-
J
ames, Schaffter
PRODUCING PDFS WITH GR
OFF AND MOM
3.1. Creating destination points at headings
The first
step in
creating links
to a
heading is
to give the heading a
unique destination
name. With
mom, this
is done
b
y adding
NAMED
<id>
to the
HEADING macro
, where
<id>
is a
unique identi-
fier f
or the heading. F
or e
xample,
.HEADING 1 NAMED intro "Introduction"
would, in addition to
printing
the head in
the body of
the document, identify
the introduction by the
unique
id,
“intro”
.
This
id,
or
name,
can
then
be
used
to
create
links
to
the
introduction
from
any
par
t of the document.
Fur
ther
more,
NAMED
<id>
stores
the
te
xt
of
the
heading
f
or
use
later
on
when
linking
to
it
(see
“3.3. Creating inter
nal links”
). If headings are being numbered, the heading n
umber is prepended.
3.2. Creating destination points at arbitrar
y locations
Any
par
t
of
a
document
can
be
a
link
destination,
not
just
headings.
F
or
e
xample,
sa
y
y
ou
create
a table that needs to be
ref
erred to from
other par
ts of the
document. Y
ou’d identify the
location of
the tab
le b
y placing
.PDF_TARGET <id> "<text>"
just
abov
e
the
tab
le
in
the
source
file.
As
with
HEADING
,
<id>
is
any
unique
name.
<text>
is
optional.
<id>
can now be link
ed to from anywhere in the document.
3.3. Creating inter
nal links
Inter
nal
links
are
clic
kab
le
te
xt
areas
that
allow
y
ou
to
jump
to
named
destinations
within
a
docu-
ment. (See
here
f
or a description of external links.)
Inter
nal links are created with the macro
PDF_LINK
, which tak
es the f
or
m
.PDF_LINK <id> [PREFIX <text>] [SUFFIX <text>] "<hotlink text>"
where
<id>
is
a
named
destination
point
else
where
in
the
document
(see
“3.1.
Creating
destina-
tion points at headings”
and
“3.2. Creating destination points at arbitrar
y locations”
).
PREFIX
<text>
and
SUFFIX
<text>
,
both
or
either
of
which
are
optional,
are
printed
around
the clic
kab
le area b
ut do not f
or
m par
t of the link itself
.
<hotlink
text>
is
the
te
xt
that
should
be
clic
kab
le,
identifiab
le
in
the
PDF
document
b
y
the
colour assigned to links (see
“3.5. Assigning a colour to links”
).
If
the
hotlink
te
xt
ends
in
"*"
,
the
asterisk
is
replaced
b
y
the
te
xt
of
the
destination
point,
assum-
ing it’s a heading. If the hotlink te
xt ends in
"+"
, the replacement te
xt is surrounded b
y quotes.
Using our
HEADING e
xample
, abo
v
e
, th
e f
ol
lo
wi
ng
in
v
oc
ati
on o
f
PDF_LINK
w
oul
d pr
od
uc
e a c
li
c
k-
ab
le
li
nk
to
th
e i
nt
rod
uct
ion
:
.PDF_LINK intro PREFIX ( SUFFIX ). "see: +"
In the te
xt, the link would look lik
e this: (
see: “1. Introduction”
).
3.4. Creating e
xter
nal links
Exter
nal
links
are
clic
kab
le
te
xt
areas
whose
destination
is
a
URL.
Clic
king
on
them
causes
a
browser windo
w to pop up with the destination address.
The f
or
mat of the macro to create e
xter
nal links is similar to the one f
or creating inter
nal links:
.PDF_WWW_LINK <url> [PREFIX <text>] [SUFFIX <text>] ["<hotlink text>"]
-
2
-
J
ames, Schaffter
PRODUCING PDFS WITH GR
OFF AND MOM
<url>
is
any
v
alid
URL,
usually
a
web
address;
PREFIX
<text>
and
SUFFIX
<text>
ha
v
e
e
xactly
the
same
meaning,
as
does
<hotlink
text>
,
which
fur
ther
more
accepts
the
same
e
xpandos,
"+"
and
"*"
.
If
no
ho
tli
nk
te
xt
is
gi
v
en,
th
en
<url>
is
us
ed
as
th
e t
e
xt.
If
ho
tl
in
k t
e
xt
is
gi
v
en
and
en
ds
in
"*"
, t
he
ast
eris
k i
s
rep
lac
ed
b
y
th
e U
RL.
I
f
it
end
s i
n
"+"
, t
he
UR
L i
s s
ur
rou
nde
d b
y q
uot
es
. A
s a
n e
xa
mpl
e
,
.PDF_WWW_LINK https://www.schaffter.ca/mom/momdoc/toc.html
would
open
mom’s
online
documentation
at
https://www
.schaffter
.ca/mom/momdoc/toc.html
.
The
same, with
"here"
supplied as hotlink te
xt, lets y
ou clic
k
here
instead.
3.5. Assigning a colour to links
The colour of links is set with
.PDF_LINK_COLOR <xcolor> | <newcolor> | <r g b> | <#rrggbb>
where
<xcolor>
or
<newcolor>
are
the
names
of
colours
already
initialized
with
XCOLOR
or
NEWCOLOR
.
If
y
ou
pref
er
to
define
a
ne
w
colour
(using
the
RGB
colour
scheme),
enter
it
either
as 3 numbers betw
een 0.0
→
1
.0
or
as
a
6
character
he
x
string.
Thus
.PDF_LINK_COLOR
#ff0000
and
.PDF_LINK_COLOR
1.0 0 0
both lead to mom using
red
links.
The def
ault colour can be restored b
y calling
PDF_LINK_COLOR
with no parameter
.
Note:
The
decimal
scheme
f
or
creating
colours
must
be
used
if
a
file
is
to
be
processed
with
‘
gr
off -Tps -mpdfmark
’, ‘
pdfr
off
’, or ‘
pdfmom -Tps
’.
4. The PDF Outline
Most
PDF
vie
wers
provide
a
panel
that
displa
ys
a
document’s
outline,
similar
to
a
tab
le
of
con-
tents. Clic
king on an entr
y na
vigates directly to the appropriate place in the document.
Mom
generates
PDF
outlines
the
same
wa
y
she
populates
her
own
tab
le
of
contents:
b
y
inter-
cepting
calls
to
the
HEADING
macro
,
as
well
as
to
the
v
arious
title
and
chapter
macros
used
in
namimg documents, and allocating each a hier
archic le
v
el.
Cov
ers, titles/chapters, and
the table of
contents are
all assigned
to lev
el 1
. Subsequent
headings
are assigned to n
+
1, where n is the le
v
el giv
en to
HEADING
.
T
h
e
P
D
F
o
u
t
l
i
n
e
c
a
n
s
e
n
s
i
b
l
y
r
e
c
o
v
e
r
f
r
o
m
s
k
i
p
p
e
d
o
r
o
m
i
t
t
e
d
h
e
a
d
i
n
g
l
e
v
e
l
s
;
t
h
e
p
ri
n
t
e
d
t
a
b
l
e
o
f
c
o
n
-
t
e
n
t
s
c
a
n
n
o
t
.
U
s
e
r
s
a
r
e
t
h
e
r
e
f
o
r
e
a
d
v
i
s
e
d
t
o
u
s
e
h
e
a
d
i
n
g
s
i
n
l
o
g
i
c
a
l
o
r
d
e
r
,
n
o
t
f
o
r
t
y
p
o
g
r
a
p
h
i
c
e
f
f
e
c
t
s
.
4.1. Opening and closing le
v
els
A
le
v
el
is
said
to
be
open
if
one
or
more
le
v
els
beneath
it
is
visib
le
in
the
PDF
outline.
Closed
le
v
els hav
e at
least one
le
v
el beneath
them that
is not
visib
le unless
the closed
link is
clic
k
ed. It
is
common f
or only the first two le
v
els to be open so the outline doesn’t look cluttered.
T
o estab
lish which le
v
els should be open b
y def
ault when a document loads, use
.PDF_BOOKMARKS_OPEN n
where
n
is a number specifying at which le
v
el all subsequent ones should be closed.
If
, at any point in the document, y
ou specify
.PDF_BOOKMARKS_OPEN NO \"
or any other text argument
then all subsequent bookmarks will be closed until
PDF_BOOKMARKS_OPEN
opens them again.
-
3
-
J
ames, Schaffter
PRODUCING PDFS WITH GR
OFF AND MOM
4.2. Suspending/disab
ling collection of outline entries
Suspending the collection of entries for the PDF outline is accomplished with
.PDF_BOOKMARKS OFF
Mom’s
def
ault
is
to
collect
entries,
so
if
the
command
is
placed
at
the
star
t
of
a
document,
it
disab
les entr
y collection completely
. Else
where, it suspends collection until y
ou re-enab
le it with
.PDF_BOOKMARKS
\"
i.e.
with
no
parameter
4.3. The PDF window title
While
not
strictly
par
t
of
the
PDF
outline,
the
title
of
a
document
can
be
displa
y
ed
as
the
docu-
ment vie
wer’s windo
w title. The macro to accomplish this is
.PDF_TITLE "<window title>"
It can tak
e any te
xt, so the vie
wer windo
w title need not be the same as the document’s title.
Note:
The
macro
,
DOC_TITLE
,
alwa
ys
in
v
ok
es
PDF_TITLE
.
If
this
is
not
what
y
ou
want, you
can
remov
e the window title b
y issuing
.PDF_TITLE ""
\"
ie. with a blank argument
5. T
ables of Contents
5.1. Generating a T
ab
le of Contents
T
o
ge
ner
ate
a
prin
tab
le
T
ab
le
of
Con
ten
ts
f
or
an
y
doc
ume
nt,
si
mpl
y
in
se
r
t
the
mac
ro
,
TOC
,
as
the
la
st l
ine
of th
e so
urc
e fi
le
. (F
ormat
tin
g of
the
print
ab
le
T
ab
le
of Co
nte
nts
is di
sc
uss
ed i
n de
tai
l in
the
mo
m
do
cum
ent
ati
on
).
Wh
en
the
fi
le
is
pro
ce
ss
ed
and
lo
ade
d
in
a
vi
e
w
er
,
ent
ries
in
the
T
ab
le
of
Co
nte
nts
w
ill
be
c
lic
ka
b
le
lin
ks
.
Whiche
v
er
link
colour
is
activ
e
at
the
end
of
the
document,
prior
to
TOC
,
will
be
used
f
or
the
T
ab
le
of Contents links.
5.2. P
ositioning the T
ab
le of Contents
If
gr
off
’s
P
ostScript
de
vice
(
-Tps
)
is
used
to
process
a
mom
file, the
T
ab
le
of
Contents
is
printed
at
the
end
of
the
document.
When
this
is
not
desirab
le,
the
P
ostScript
output
from
gr
off
must
be
processed with
psselect
in order to place the T
OC in the pref
erred location.
When
using
mom
and
gr
off
’s
nativ
e
pdf
de
vice
(via
pdfmom
or
gr
off
-Tpdf
),
positioning
of
the
T
ab
le of Contents can be done within the source file.
The command to control the placement of the T
OC is
.AUTO_RELOCATE_TOC [<position>]
where the optional
<position>
can be one of these k
e
ywords:
T
OP
*
(ie. at the v
er
y star
t of the document)
BEFORE_DOCCO
VER
AFTER_DOCCO
VER
BEFORE_CO
VER
AFTER_CO
VER
It
is
nor
mally
not
necessar
y
to
supply
a
k
e
yword,
since
AUTO_RELOCATE_TOC
places
the
T
OC
after
the
DOC_CO
VER,
if
there
is
one,
or
the
first
CO
VER
when
no
DOC_CO
VER
is
present.
In
rare
instances
where
it
is
desirab
le
to
place
the
T
OC
some
where
else
in
the
document,
there
are
*
Note:
Documents without a CO
VER or DOC_CO
VER require the
TOP
argument.
-
4
-
J
ames, Schaffter
PRODUCING PDFS WITH GR
OFF AND MOM
two
low-le
v
el
commands,
.TOC_BEFORE_HERE
and
.TOC_AFTER_HERE
which
place
the
T
OC
either bef
ore or after the current page.
These
last
two commands
ha
v
e
a
small
catch:
although
the
T
OC
will
appear
where
specified,
the
“Contents”
entr
y
in
the
PDF
outline,
which
obser
v
es
a
hierarch
y
of
le
v
els,
will
assign
the
T
OC
to
le
v
el
1
, possib
ly disrupting the visual order
ing of le
v
els in the outline.
6. pdfmom: Simplifying PDF output
As e
xplained in the section
2. Using groff to generate PDF files
, th
er
e
ar
e
tw
o
es
ta
b
li
sh
ed
m
et
ho
ds
f
or
creating
PDF
files
with
gr
off
:
the
original
method,
ie.
passing
the
-Tps
and
-mpdfmark
options
to
gr
off
(or
using
pdfr
off
,
which
does
this
f
or
y
ou);
or
the
ne
wer
-Tpdf
,
which
produces
PDF files nativ
ely
.
6.1. The prob
lem of f
orward ref
erences
Bo
t
h
m
e
t
h
o
ds
en
co
un
te
r
di
ff
i
cu
l
ti
e
s
w
he
n
de
al
in
g
wi
th
for
wa
rd
r
efe
re
nc
es
;
th
at
i
s,
wh
en
a
li
n
k
earlier
i
n
a
d
oc
u
me
nt
re
fer
s
to
a
de
st
i
na
ti
on
later
i
n
th
e
do
c
um
en
t
an
d
th
e
l
in
k
tex
t
te
r
mi
na
t
e
s
with
one
of
the
e
xpandos,
"*"
or
"+"
(e
xplained
here
).
Mom
doesn’t
know what
te
xt
to
put
in
the
e
xpando because it has not yet been defined. This means that
groff
must be run multiple times to
find the unknown te
xt.
T
h
e
p
r
o
gra
m
pdfr
off
exi
st
s
to
ha
nd
l
e
th
es
e
mu
lt
i
pl
e
r
un
s,
but
i
t
im
po
s
es
s
om
e
l
im
it
at
i
on
s
o
n
t
h
e
P
DF
fea
tu
r
es
avai
l
abl
e
w
i
th
mom
.
6.2.
pdfmom
pdfmom
perf
or
ms
the
same
function
as
pdfr
off
,
and
is
the
pref
erred,
troub
le-free
wa
y
to
gener-
ate
PDF
documents
from
a
mom
source
file.
Lik
e
pdfr
off
,
it
is
a
frontend
to
gr
off
and
accepts
all
the same options (see
man gr
off
).
Ca
ll
e
d
a
s
-
i
s,
pdfmom
ac
ce
pt
s
a
ll
th
e
sa
me
op
ti
on
s
as
gr
off
,
an
d
re
qu
i
re
s
no
ad
di
ti
on
al
fl
ag
s.
PD
F
g
e
n
e
ra
t
i
on
i
s
p
er
for
me
d
by
gr
opdf
,
gr
off
’
s
na
ti
ve
PD
F
d
r
ive
r
:
pdfmom doc.mom [groff opts] > doc.pdf
If
a
-Tps
option
is
supplied,
pdfmom
hands
control
ov
er
to
pdfr
off
,
and
both
gr
off
and
pdfr
off
options ma
y giv
en. The resulting PDF is produced from P
ostScript output fed into
ghostscript
.
pdfmom -Tps [pdfroff opts [groff opts]] doc.mom > doc.pdf
F
or either in
v
ocation, it is not necessar
y to add
-mom
or
-mpdfmark
, as these are implied.
If
Encaps
ulate
d
P
ostScript
or
plain
P
ostScript
images
ha
v
e
been
embedd
ed
in
a
docume
nt
with
PSPIC
,
the
-Tps
option
mu
st be
used.
In mos
t othe
r cas
es
,
pdfmom
with n
o
-T
flag
is pr
ef
era
b
le
.
6.3. Setting papersize within a source file
A
significant
con
v
enience
aff
orded
b
y
using
pdfmom
(or
gr
off
with
the
-Tpdf
flag)
is
that
paper-
sizes or
page
dimensions
set
within
mom
source
files
(see
paper
and
page
setup
macros
)
do
not
require a corresponding
-P-p<papersize>
option on the command line. It is e
v
en possible to cre-
ate documents with unequal-sized pages
.
6.4. Diff
erences between pdfmom and pdfroff
Se
v
eral
f
eatures
described
in
this
manual
are
not
a
v
ailab
le
when
the
-Tps
option
is
giv
en
to
pdfmom
, nor when using
pdfr
off
or
gr
off -Tps -mpdfmark
:
•
Relocation of the T
ab
le of Contents
is not suppor
ted. The T
OC appears at the end of the
document;
psselect
must be used to re-order pages
.
•
If
a
lin
k
cro
sse
s
a
pag
e
bou
nda
r
y
,
it
wil
l
sto
p
bei
ng
a
cli
c
kab
le
hot
spo
t
on
sub
seq
uen
t
pag
es
.
-
5
-
James, Schaffter
PRODUCING PDFS WITH GROFF AND MOM
•
When
estab
lishing
whether
PDF
outline
le
v
els
are
open
or
closed
,
only
the
numerical
parameter
to
PDF_BOOKMARKS_OPEN
has
any
eff
ect.
•
PDF_LINK_COLOR
only
accepts
colour
definitions
in
decimal
notation.
7.
Comparison
of
-Tps
/
-mpdfmark
with
-Tpdf
/
-mom
-Tps
/
-mpdfmark
•
does
not
suppor
t
all
the
f
eatures
described
here
•
accepts
images
and
gr
aphics
embedded
with
PSPIC
-Tpdf
/
-mom
•
f
acilitates
embedding
f
onts
directly
in
the
PDF
file
(if
the
-P-e
flag
is
giv
en
on
the
command
line)
•
sets
papersize
from
within
the
source
file,
circumv
enting
the
need
f
or
the
papersize
flag
(
-P-p<papersize>
)
on
the
command
line
•
is
not
compatib
le
with
PRINTSTYLE
TYPEWRITE
underlining
(e.g.,
of
italics)
•
generally
produces
larger
files;
these
can
be
reduced
b
y
piping
the
output
through
ps2pdf
Note:
Owing
to
a
known
b
ug,
PDF
files
piped
through
ps2pdf
lose
some
of
their
metadata,
notab
ly
the
window
title
set
with
PDF_TITLE
.
-
6
-