inlines.html#TOP
Next
typesetting.html#TOP
Prev
toc.html
Back to Table of Contents
Goodies
The macros in this section are a collection of useful (and sometimes
nearly indispensible) routines to simplify typesetting.
Goodies list
#ALIAS
ALIAS
(rename macros)
#SILENT
SILENT
("hide" input lines from output)
#TRAP
TRAP
(suspend/re-invoke traps)
#SMARTQUOTES
SMARTQUOTES
#CAPS
CAPS
(convert to upper case)
Underscore/underline
#UNDERSCORE
UNDERSCORE
(single underscore)
#UNDERSCORE2
UNDERSCORE2
(double underscore)
#UNDERLINE
UNDERLINE
(underline -- Courier only!)
#UL
\*[UL]
(inline escape to underline -- Courier only!)
Padding
#PAD
PAD
(insert equalized space into lines)
#PAD_MARKER
PAD_MARKER
(change/set the marker used with
PAD
)
Leaders
#LEADER
\*[LEADER]
(inline escape to add leaders to a line)
#LEADER_CHARACTER
LEADER_CHARACTER
(change/set the leader character)
Drop caps
#DROPCAP
DROPCAP
(set a drop cap)
Support macros for DROPCAP
#DROPCAP_FAMILY
DROPCAP_FAMILY
(change drop cap family)
#DROPCAP_FONT
DROPCAP_FONT
(change drop cap font)
#DROPCAP_ADJUST
DROPCAP_ADJUST
(alter size of drop cap)
#DROPCAP_GUTTER
DROPCAP_GUTTER
(change space between drop cap and running text)
Superscript
#SUP
\*[SUP]
(set superscript)
#CONDSUP
\*[CONDSUP]
(set condensed superscript)
#EXTSUP
\*[EXTSUP}
(set extended superscript)
Rename macros
Macro:
ALIAS
<new name> <old name>
The
ALIAS
macro may well be your best friend.  With it,
you can change the name of a macro to anything you like
(provided the new name is not already being used by
mom
; see the
reserved.html#RESERVED
list of reserved words
).
Groff has always been a bit intimidating for new users because
its standard macro packages use very terse macro names.
Mom
doesn't like people to feel intimidated; she wants
them to feel welcome.  Consequently, she tries for easy-to-grasp,
self-explanatory macro names.  However,
mom
knows
that people have their own ways of thinking, their own preferences,
their own habits.  Some of her macro names may not suit you; they
might be too long, or aren't what you automatically think of
when you want to do a particular thing, or might conflict with habits
you've developed over the years.
If you don't like one of
mom
's macro names,
say, PAGEWIDTH, change it, like this:
.ALIAS PW PAGEWIDTH
|      |
new__|      |__official
name            name
The first argument to
ALIAS
is the new name you want
for a macro.  The second is the "official" name by
which the macro is normally invoked.  After
ALIAS
,
either can be used.
Note that in
ALIAS
, you do NOT include the period
(dot) that precedes the macro when it's a
definitions.html#TERMS_CONTROLLINES
control line
.
NOTE:
If you use
ALIAS
a lot,
and always for the same things, consider creating an aliases
file of the form
.ALIAS <new name> <old name>
.ALIAS <new name> <old name>
.ALIAS <new name> <old name>
...etc
Put the file someplace convenient and source it at the
beginning of your documents using the groff
definitions.html#TERMS_PRIMITIVES
primitive
.so
.  Assuming that you've created an aliases file
called mom_aliases in your home directory under a directory
called
Mom
, you'd source it by placing
.so /home/<username>/Mom/mom_aliases
at the top of your documents.
If you share documents that make use of an alias file, remember that
other people don't have the file!  Paste the whole thing at the top
of your documents, please.
EXPERTS:
ALIAS
is an alias of
.als
.  You can use either, or mix 'n' match with
impunity.
Hide input lines from output
Macro:
SILENT
toggle
Alias:
COMMENT
Sometimes, you want to "hide"
definitions.html#TERMS_INPUTLINE
input lines
from final output.  This is most likely to be the case when setting
up string tabs (see the
STRING_TABS_TUT
quickie tutorial on string tabs
for an example), but there are other places where you might want input
lines to be invisible as well.  Any place you don't want input lines
to appear in the output, use the
SILENT
macro.
SILENT
is a toggle.  Invoking it without an argument
turns it on; any argument turns it off.  E.g.,
.SILENT
A line of text
.SILENT OFF
The line "A line of text" will not appear in the
output copy.
SILENT
is aliased as
COMMENT
.
If you want to insert non-printing comments into your documents,
you may prefer this.
NOTE: SILENT
does not automatically break an
definitions.html#TERMS_INPUTLINE
input line
(see
typesetting.html#BR
BR
)
when you're in one of the
definitions.html#TERMS_FILLED
fill modes
(
typesetting.html#JUSTIFY
JUSTIFY
or
typesetting.html#QUAD
QUAD L | R | C | J
).
The same applies to tabs
(
typesetting.html#TAB_SET
typesetting
or
typesetting.html#ST
string
)
to which you've passed the
J
or
QUAD
argument.  You must insert
.BR
yourself, or risk a
portion of your text disappearing into a black hole.
Suspend/re-invoke traps
Macro:
TRAP
toggle
Traps are vertical positions on the output page at which you or
mom
have instructed groff to start doing
something automatically.  Commonly, this is near the bottom of
the page, where automatic behind-the-scenes processing is needed
in order for one page to finish and another to start.
Sometimes, traps get sprung when you don't want them, notably
when using the
#EL
EL
and
#TN
TN
macros.  If this happens, surround just the offending macros and
input lines with
.TRAP OFF
...
.TRAP
TRAP
is a toggle, therefore any argument
turns it off (i.e. suspends the trap), and no argument turns it
(back) on.
Have a look at the
IMPORTANT
sections
of
EL
and
TN
to see
TRAP
in action.
Smartquotes
Macro:
SMARTQUOTES
toggle
SMARTQUOTES
converts all instances of the
inch-mark, (
"
-- also called a "doublequote"),
into the appropriate instances of true open- and close-doublequotes.
Typographically, there is a difference between the inch-mark and
doublequotes -- a BIG difference.  Sadly, typewriters and computer
keyboards supply only one: the inch-mark.  While using inches for
doublequotes is, and always has been, acceptable in typewriter-style
copy, it has never been, and, God willing, never will be acceptable in
typeset copy.  Failure to turn inches into quotes is the first thing
a professional typesetter notices in documents prepared by amateurs.
And you don't want to look like an amateur, do you?
When preparing documents for typesetting, by all means, use the
inch-mark.  Just make sure to turn
SMARTQUOTES
on.
SMARTQUOTES
is a toggle, so invoking it with
no argument turns it on, and invoking it with any argument at all
turns it off.
If you're using the
docprocessing.html#DOCPROCESSING
document processing macros
with
#PRINTSTYLE
PRINTSTYLE TYPESET
,
SMARTQUOTES
is on by default; with
#PRINTSTYLE
PRINTSTYLE TYPEWRITE
,
it's off by default (and should probably stay that way).
NOTE:
SMARTQUOTES
does not work on
single quotes, which most people input with the apostrophe (found at
the right-hand end of the "home row" on a QWERTY keyboard).
Groff will interpret all instances of the apostrophe as an apostrophe,
making the symbol useless as an open-single-quote.  For open single
quotes, input the backtick character typically found under the tilde
on most keyboards.  (Pour nous autres, "backtick" veut dire
l'accent grave.)
Here's an example of correct input copy with single quotes:
"But she said, `I don't want to!'"
ADDITIONAL NOTE:
Whether or not you have
SMARTQUOTES
turned on, get into the habit of entering
the foot- and inch-marks, when you need them, with the
definitions.html#TERMS_INLINES
inline escapes
\*[FOOT]
and
\*[INCH]
, instead
of
'
and
"
.
Convert to upper case
Macro:
CAPS
toggle
CAPS
converts all lower case letters to upper
case.  Primarily, it's a support macro used by the
docprocessing.html#DOCPROCESSING
document processing macros
,
but you may find it helpful on occasion.
CAPS
is a toggle, therefore no argument turns it on, any argument
turns it off.
.CAPS
All work and no play makes Jack a dull boy.
.CAPS OFF
produces, on output
ALL WORK AND NO PLAY MAKES JACK A DULL BOY.
Single underscore
Macro:
UNDERSCORE
[ <distance below baseline> ] "<string>"
*Optional argument requires a
definitions.html#TERMS_UNITOFMEASURE
unit of measure
By default,
UNDERSCORE
places an underscore 2 points
beneath the required
definitions.html#TERMS_STRINGARGUMENT
string argument
.
The string must be enclosed in double-quotes, like this:
.UNDERSCORE "Unmonitored monopolies breed high prices and poor products."
If you wish to change the distance of the rule from the
baseline, use the optional argument
<distance below
baseline>
(with a unit of measure).
.UNDERSCORE 3p "Unmonitored monopolies breed high prices and poor products."
The above places the underscore 3 points below the baseline.
NOTES:
UNDERSCORE
does not work across line breaks in output
copy, which is to say that you can't underscore a multi-line passage
simply by putting the text of the whole thing in the string you pass
to
UNDERSCORE
.  Each
definitions.html#TERMS_OUTPUTLINE
output line
or portion of an output line you want underscored must be plugged
separately into
UNDERSCORE
.  Bear in mind, though,
that underscoring should at best be an occasional effect in typeset
copy.  If you want to emphasize an entire passage, it's much, much
better to change fonts (e.g. to italic or bold).
You can easily and successfully underline entire passages in simulated
typewriter-style copy (i.e. if your font is Courier, or you're using
the document processing macro
#PRINTSTYLE
PRINTSTYLE TYPEWRITE
),
with the
#UNDERLINE
UNDERLINE
macro.
UNDERLINE
is designed specifically for this
purpose, but works only with the Courier font.
Mom
doesn't always get the position and length
of the underscore precisely right in
definitions.html#TERMS_JUST
justified
copy, although she's fine with all the other
definitions.html#TERMS_FILLED
fill modes
,
as well as with the no-fill modes.  As of this writing, I have
no solution to the occasional problems with justified copy.
UNDERSCORE
tends to confuse
gxditview
, even though the output, when
printed, looks fine.  Generally, I recommend using
gv
to preview files anyway.  See the section on
#PREVIEWING
previewing
.
Double underscore
Macro:
UNDERSCORE2
[ <distance below baseline> [ <distance between rules> ] ] "<string>"
*Optional arguments require a
definitions.html#TERMS_UNITOFMEASURE
unit of measure
By default,
UNDERSCORE2
places a double underscore
2 points beneath the required
definitions.html#TERMS_STRINGARGUMENT
string argument
.
The string must be enclosed in double-quotes, like this:
.UNDERSCORE2 "Unmonitored monopolies breed high prices and poor products."
The default distance between the two rules is 2 points.
If you wish to change the distance of the double underscore from
the baseline, use the optional argument
<distance below
baseline>
(with a unit of measure), e.g.,
.UNDERSCORE2 3p "Unmonitored monopolies breed high prices and poor products."
which places the double underscore 3 points below the baseline.
If you wish to change the distance between the two rules as
well, use the second optional argument
<distance between
rules>
(with a unit of measure).  Be aware that you must
give a value for the first optional argument if you want to use
the second.
NOTE:
the same restrictions and caveats apply
to
UNDERSCORE2
as to
UNDERSCORE
.  See the
#NOTES_UNDERSCORE
NOTES
for
UNDERSCORE
.
Underline text -- Courier font only!
Macro:
UNDERLINE
toggle
If your font is Courier, or you're using the document processing macro
#PRINTSTYLE
PRINTSTYLE TYPEWRITE
,
UNDERLINE
allows you to underline words and
passages that, in typeset copy, would be italicised.  You invoke
UNDERLINE
as you do with all toggle macros --
by itself (i.e. with no argument) to initiate underlining, and
with any argument to turn underlining off.
When on,
UNDERLINE
underlines letters, words
and numbers, but not punctuation or spaces.  This makes for more
readable copy than a solid underline.
NOTE:
Underlining may also be turned on and off
definitions.html#TERMS_INLINES
inline
with the escapes
#UL
\*[UL]...\*[ULX].
Inline escape for underlining -- Courier font only!
Inline:
\*[UL]...\*[ULX]
If your font is Courier, or you're using the document processing macro
#PRINTSTYLE
PRINTSTYLE TYPEWRITE
,
\*[UL]...\*[ULX]
underlines words and
passages that, in typeset copy, would be italicised.
\*[UL]
underlines all letters, words and numbers
following it, but not punctuation or spaces.  This makes for more
readable copy than a solid underline.  When you no longer want
underlining,
\*[ULX]
turns underlining off.
The macro
#UNDERLINE
UNDERLINE
and the inline escape
\*[UL]
are functionally
identical, hence
.FAM     C
.FT      R
.PT_SIZE 12
.LS      24
.SS      0
.QUAD    LEFT
Which should I heed?
.UNDERLINE
Just do it
.UNDERLINE OFF
or
.UNDERLINE
just say no?
.UNDERLINE OFF
produces the same result as
.FAM     C
.FT      R
.PT_SIZE 12
.LS      24
.SS      0
.QUAD    LEFT
Which should I heed? \*[UL]Just do it\*[ULX] or \*[UL]just say no?\*[ULX]
Insert space into lines
Macro:
PAD
"<string with pad markers inserted>"
With
PAD
, you can insert unspecified amounts of
whitespace into a line.
PAD
calculates the difference between the length of
text on the line and the distance remaining to its end, then inserts
the difference (as whitespace) at the place(s) you specify.
Take, for example, the following relatively common typesetting
situation, found at the bottom of legal agreements:
Date             Signature                               |
The person signing the agreement is supposed to fill in the date
as well as a signature.  Space needs to be left for both, but
the exact amount is neither known, nor important.  All that
matters is that there be a little space after Date, and rather
more space after Signature.  (In the above, | represents
the end of the line at the prevailing line length.)
The
#PADMARKER
pad marker
(see below) is # (the pound or number sign on your keyboard) and
can be used multiple times in a line.  With that in mind, here's how
you'd input the Date/Signature line (assuming a length of 30 picas):
.LL 30P
.PAD "Date#Signature###"
When the line is output, the space remaining on the line, after
"Date" and "Signature" have been taken into
account, is split into four (because there are four # signs).
One quarter of the space is inserted between Date and Signature,
the remainder is inserted after Signature.
One rarely wants merely to insert space in a line; one usually
wants to fill it with something, hence
PAD
is
particularly useful in conjunction with
#STRING_TABS
string tabs
.
The following uses the Date/Signature example above, but adds
rules into the whitespace through the use of string tabs and
groff's line drawing function,
#INLINE_LINEDRAWING_GROFF
\l
.
.LL 30P
.PAD "Date\*[ST1]#\*[ST1X]Signature\*[ST2]###\*[ST2X]"
.EL
.ST 1 J
.ST 2 J
.TAB 1
\l'\n(.lu'
.TN
\l'\n(.lu'
.TQ
If you're not a typesetter, and if you're new to groff, the
example probably looks like gibberish.  My apologies.  However,
remember that typesetting is a craft, and without having studied
the craft, it takes a while to grasp its concepts.  Also,
although
mom
tries very hard to provide
consistent-looking, comprehensible alternatives to groff's
native
definitions.html#TERMS_INLINES
inline escapes
,
mom
has not yet found a replacement for
\l
.
Basically, what the example does is:
Pads the Date/Signature line (using the pad marker #),
encloses the padded space with two string tabs markers,
and outputs the line
Sets the two string tabs (notice the use of
#EL
EL
beforehand; you don't want
mom
to advance a line at this point)
Calls the first string tab and draws a rule to its full
length (
\l'\n(.lu'
; for an easier way to draw a rule
that fills a tab, see
inlines.html#INLINE_RULE_MOM
Full measure
rules
).
Calls the second tab with
#TN
TN
(which moves to tab 2 and stays on the same baseline)
then draws a rule to the full length of string tab 2
Often, when setting up string tabs this way, you don't want the
padded line to print immediately.  To accomplish this, use
#SILENT
SILENT
.
See the
#STRING_TABS_TUT
quickie tutorial on string tabs
for an example.
NOTE:
Because the pound sign (#) is used as the pad
marker, you can't use it as a literal part of the pad string.  If you
need the sign to appear in the text of a padded line, change the pad
marker with
#PAD_MARKER
PAD_MARKER
.  Also, be aware
that # as a pad marker only applies within the
PAD
macro; at all other times it prints literally, just as you'd expect.
Another important consideration when using
PAD
is that
because the string must be enclosed in double-quotes, you can't use the
double-quote (") as part of the string.  The way to circumvent
this is to use the groff
definitions.html#TERMS_INLINES
inline escapes
\(lq
and
\(rq
(leftquote and
rightquote respectively) whenever double-quotes are required in the
string passed to
PAD
.
Change/set the marker used with PAD
Macro:
PAD_MARKER
<character to use as the pad marker>
If you need to change
mom
's default pad marker
(#), either because you want a literal # in the padded line,
or simply because you want to use another character instead, use
PAD_MARKER
, whose argument is the new pad marker
character you want.
.PAD_MARKER @
changes the pad marker to @.
Once you've changed the pad marker, the new marker remains in
effect for every instance of
#PAD
PAD
until you change it again (say, back to the pound sign).
Inline escape to add leaders to a line
Inline:
\*[LEADER]
Whenever you want to fill a line or tab with
definitions.html#TERMS_LEADER
leaders
,
use the
definitions.html#TERMS_INLINES
inline escape
\*[LEADER]
.  The remainder of the line or tab will be
filled with the leader character.
Mom
's
default leader character is a period (dot), but you can change
it to any character you like with
#LEADER_CHARACTER
LEADER_CHARACTER
.
NOTE:
\*[LEADER]
fills lines
or tabs right to their end.  You cannot insert leaders into a
line or tab and have text following the leader on the same line
or in the same tab.  Should you wish to achieve such an effect
typographically, create tabs for each element of the line and
fill them appropriately with the text and leaders you need.
#STRING_TABS
String tabs
are perfect for this.  An
example follows.
.LL 30P
.PAD "Date\*[ST1]#\*[ST1X]Signature\*[ST2]###\*[ST2X]"
.EL
.ST 1 J
.ST 2 J
.TAB 1
\*[LEADER]
.TN
\*[LEADER]
.TQ
The
PAD
line sets the words Date and Signature,
and marks string tabs around the pad space inserted in the line.
The string tabs are then "set", called, and filled
with leaders.  The result looks like this:
Date.............Signature.....................................
Change/set the leader character
Macro:
LEADER_CHARACTER
<character>
LEADER_CHARACTER
takes one argument: a single
character you would like to be used for
definitions.html#TERMS_LEADER
leaders
.
(See
#LEADER
\*[LEADER]
for an explanation of how to
fill lines with leaders.)
For example, to change the leader character from
mom
's
default (a period) to the underscore character, enter
.LEADER_CHARACTER _
Drop caps
Macro:
DROPCAP
<dropcap letter> <number of lines to drop> [ COND <percentage> | EXT <percentage> ]
The first two arguments to
DROPCAP
are the letter you
want to be the
definitions.html#TERMS_DROPCAP
drop cap
and the number of lines you want it to drop.  By default,
mom
uses the current family and font for the drop cap.
The optional argument (COND or EXT) indicates that you want the
drop cap condensed (narrower) or extended (wider).  If you use
COND
or
EXT
, you must follow the
argument with the percentage of the letter's normal width you want
it condensed or extended.  No percent sign (%) is required.
Mom
will do her very best to get the drop cap to
line up with the first line of text indented beside it, then set
the correct number of indented lines, and restore your left margin
when the number of drop cap lines has been reached.
Beginning a paragraph with a drop cap "T" looks
like this:
.DROPCAP T 3 COND 90
he thousand injuries of Fortunato I had borne as best I
could, but when he ventured upon insult, I vowed revenge.
You who so well know the nature of my soul will not suppose,
however, that I gave utterance to a threat...
The drop cap, slightly condensed but in the current family and font,
will be three lines tall, with whatever text fills those three
lines indented to the right of the letter.  The remainder of the
paragraph's text will revert to the left margin.
NOTE:
When using the
docprocessing.html#DOCPROCESSING
document processing macro
#PP
PP
,
DROPCAP
only works
with initial paragraphs (i.e. at the start of the document,
or after
#HEAD
HEAD
),
when
DROPCAP
comes immediately after
PP
,
and when the
docprocessing.html#PRINTSTYLE
PRINTSTYLE
is TYPESET.
If these conditions aren't met,
DROPCAP
is silently ignored.
WARNING:
DROPCAP
puts a bit of
a strain on resource-challenged systems.  If you have such a
system and use drop caps extensively in a document, be prepared
for a wait while
mom
does her thing.
Support macros for DROPCAP
Drop caps are the bane of most typesetters' existence.  It's
very difficult to get the size of the drop cap right for the
number of drop lines, especially if the drop cap is in a
different family from the prevailing family of running text.
Not only that, but there's the gutter around the drop cap to
take into account, plus the fact that the letter may be too wide
or too narrow to look anything but odd or misplaced.
Mom
solves the last of these problems with the
COND
and
EXT
arguments.  The
rest she solves with macros that change the default behaviour of
DROPCAP
, namely
#DROPCAP_FAMILY
DROPCAP_FAMILY
,
#DROPCAP_FONT
DROPCAP_FONT
,
#DROPCAP_ADJUST
DROPCAP_ADJUST
and
#DROPCAP_GUTTER
DROPCAP_GUTTER
.
These macros must, of course, come before you invoke
DROPCAP
.
DROPCAP_FAMILY
Set the drop cap family by giving
DROPCAP_FAMILY
the name of the family you want,
e.g.
.DROPCAP_FAMILY H
which will set the family to Helvetica for the drop cap only.
DROPCAP_FONT
Set the drop cap font by giving
DROPCAP_FONT
the name of the font you want,
e.g.
.DROPCAP_FONT I
which will set the font to italic for the drop cap only.
DROPCAP_ADJUST
If the size
mom
calculates for the drop cap
isn't precisely what you want, you can increase or decrease it
with
DROPCAP_ADJUST
, like this:
e.g.
.DROPCAP_ADJUST +1
or
.DROPCAP_ADJUST -.75
DROPCAP_ADJUST
only understands
definitions.html#TERMS_PICASPOINTS
points
,
therefore do not append any
definitions.html#TERMS_UNITOFMEASURE
unit of measure
to the argument.  And always be sure to preprend the plus or
minus sign, depending on whether you want the drop cap larger or
smaller.
DROPCAP_GUTTER
By default,
mom
puts three points of space
between the drop cap and the text indented beside it.  If you
want another value, use
DROPCAP_GUTTER
(with a
unit of measure), like this:
.DROPCAP_GUTTER 6p
Superscript
Inlines:
\*[SUP]...\*[SUPX]
Superscripts are accomplished
definitions.html#TERMS_INLINES
inline
.
Whenever you need one, typically for numerals, all you need to
do is surround the superscript with the inlines above.
\*[SUP]
begins superscripting;
\*[SUPX]
turns it off.
If your running type is
#COND_INLINE
pseudo-condensed
or
#EXT_INLINE
pseudo-extended
and you want your superscripts to be equivalently pseudo-condensed or
-extended, use
\*[CONDSUP]...\*[CONDSUPX]
or
\*[EXTSUP]...\*[EXTSUPX]
.
The superscript inlines are primarily used by the
docprocessing.html#DOCPROCESSING
document processing macros
for automatic generation of numbered footnotes.  However, you may
find them useful for other purposes.
NOTE:
Mom
does a pretty fine job of
making superscripts look good in any font and at any size.  If you're
fussy, though (and I am), about precise vertical placement, kerning,
weight, size, and so on, you may want to roll your own solution.
And sorry, there's no
mom
equivalent for subscripts.
I'm neither a mathematician nor a chemist, so I don't need them.
Of course, anyone who wishes to contribute a subscript routine to
mom
will receive eternal blessings not only in this
lifetime, but in all lifetimes to come.
inlines.html#TOP
Next
typesetting.html#TOP
Prev
#TOP
Top
toc.html
Back to Table of Contents
