typesetting.html#TOP
Next
definitions.html#TOP
Prev
toc.html
Back to Table of Contents
USING MOM
#USING_INTRO
Introduction
#USING_MACROS
Inputting macros
#USING_INVOKING
Invoking groff
#USING_PREVIEWING
Previewing documents
Introduction
As explained in the section
intro.html#INTRO
What is mom?
,
mom
can be used in two ways: for straight typesetting
or for document processing.  The difference between the two is
that in straight typesetting, every macro is a literal
typesetting instruction that determines precisely how text
following it will look.  Document processing, on the other hand,
uses markup "tags" (e.g.
.PP
for
paragraphs,
.HEAD
for heads,
.FOOTNOTE
for footnotes, etc.) that make a lot of typesetting decisions
automatically.
You tell
mom
that you want to use the document
processing macros with the
docprocessing.html#START
START
macro, explained below.  After
START
,
mom
determines the appearance of text following
the markup tags automatically, although you, the user, can easily
change how
mom
interprets the tags.  This gives you
nearly complete control over the look and feel of your documents.
In addition, the typesetting macros, in combination with document
processing, let you meet all sorts of typesetting needs that just
can't be covered by "one macro fits all" markup tags.
How to input mom's macros
Regardless of which way you use
mom
, the
following apply.
You need a good text editor for inputting
mom
files.
I cannot recommend highly enough that you use an
editor that lets you write syntax highlighting
rules for
mom
's macros and
definitions.html#TERMS_INLINES
inline escapes
.
I use the vi clone called elvis, and find it a pure
joy in this regard.  Simply colorizing macros and
inlines to half-intensity can be enough to make text stand
out clearly from formattting commands.
All
mom
's macros begin with a period
(dot) and must be entered in upper case (capital)
letters.
Macro
definitions.html#TERMS_ARGUMENTS
arguments
are separated from the macro itself by spaces.  Multiple
arguments to the same macro are separated from each
other by spaces.  Any number of spaces may be used.  All
arguments to a macro must appear on the same line as the
macro.
Any argument (except a
definitions.html#TERMS_STRINGARGUMENT
string argument
)
that is not a digit must be entered in upper case
(capital) letters.
Any argument that requires a plus or minus sign must
have the plus or minus sign prepended to the argument
with no intervening space (e.g. +2, -4).
Any argument that requires a
definitions.html#TERMS_UNITOFMEASURE
unit of measure
must have the unit appended directly to the argument,
with no intervening space (e.g. 4P, .5i, 2v).
definitions.html#TERMS_STRINGARGUMENT
String arguments
,
in the sense that the term is used in this manual, must
be surrounded by double-quotes ("text of
string").  Multiple string arguments are separated
from each other by spaces (each argument surrounded by
double-quotes, of course).
If a string argument, as entered in your text editor,
becomes uncomfortably long (i.e. runs longer than the
visible portion of your screen or window), you may break
it into two or more lines by placing the backslash
character (
\
) at the ends of lines to break
them up, like this:
.SUBTITLE "An In-Depth Consideration of the \
Implications of Forty-Two as the Meaning of Life, \
The Universe, and Everything"
It's important that formatted documents be easy to read/interpret
when you're looking at them in a text editor.  One way to achieve
this is to group macros that serve a similar purpose together, and
separate them from other groups of macros with a blank comment line.
In groff, that's done with
\#
on a line by itself.
Consider the following, which is a template for starting the
chapter of a book.
.TITLE   "My Pulizter Novel"
.AUTHOR  "Joe Blow"
.CHAPTER  1
\#
.DOCTYPE    CHAPTER
.PRINTSTYPE TYPESET
\#
.FAM     P
.PT_SIZE 10
.LS      12
\#
.START
Printing -- invoking groff with mom
After you've finished your document, naturally you will want to
print it.  This involves invoking groff from the command line.
In all likelihood, you already know how to do this, but in case
you don't, here are two common ways to do it.
groff -mom -l <filename>
groff -mom <filename> | lpr
In the first, the
-l
option to groff tells
groff to send the output to your printer.  In the second, you're
doing the same thing, except you're telling groff to pipe the
output to your printer.  Basically, they're the same thing.  The
only advantage to the second is that your system may be set up
to use something other than
lpr
as your print
command, in which case, you can replace
lpr
with whatever is appropriate to your box.
Sadly, it is well beyond the scope of this manual to tell you
how to set up a printing system.  See the README file for
minimum requirements to run groff with
mom
.
NOTE FOR ADVANCED USERS:
I've sporadically had groff
choke on perfectly innocent sourced files within
mom
documents.  You'll know you have this problem when groff complains that
it can't find the sourced file even when you can plainly see that the
file exists, and that you've given
.so
the right path and
name.  Should this happen, pass groff the
-U
(unsafe mode)
option along with the other options you require.  Theoretically, you
only need
-U
with
.open, .opena, .pso, .sy,
and
.pi
, however reality seems, at times, to dictate
otherwise.
How to preview documents
Other than printing out hard copy, there are two well-established
methods for previewing your work.  Both assume you have a working
X server.
Groff itself comes with a quick and dirty previewer called
gxditview. Invoke it with
groff -X -mom <filename>
It's not particularly pretty, doesn't have many navigation
options, requires a lot of work if you want to use other than
the "standard" groff PostScript fonts, and occasionally
has difficulty accurately reproducing some of
mom
's macro effects
(
goodies.html#SMARTQUOTES
smartquotes
and
goodies.html#LEADER
leaders
come to mind).  What it does have going for it is that it's fast and
doesn't gobble up system resources.
A surer way to preview documents is with
gv
(ghostview).  This involves processing documents with groff,
directing the output to a temporary (PostScript) file, then opening
the temporary file in
gv
.  While that may sound
like a lot of work, I've set up my editor (elvis) to do it for me.
Whenever I'm working on a document that needs previewing/checking,
I fire up
gv
with the "Watch File"
option turned on.  To look at the file, I tell elvis to process
it (with groff) and send it to a temporary file (
groff
-mom filename > filename.ps
), then open the file inside
gv
.  Ever after, when I want to look at any changes
I make, I simply tell elvis to work his magic again.  The Watch File
option in
gv
registers that the file has changed,
and automatically loads the new version.  Voil?! -- instant previewing.
typesetting.html#TOP
Next
definitions.html#TOP
Prev
#TOP
Top
toc.html
Back to Table of Contents
