Back to Table of Contents | Next: Goodies |
Mom’s typesetting macros provide access to groff’s typesetting capabilities. Aside from controlling basic type parameters (family, font, line length, point size, leading), mom’s macros fine-tune wordspacing, letterspacing, kerning, hyphenation, and so on. In addition, mom has true typesetting tabs, string tabs, multiple indent styles, line padding, and a batch of other goodies.
In some cases, mom’s typesetting macros merely imitate groff primitives. In others, they approach typesetting concerns in conceptually new ways (for groff, at least). This should present no problem for newcomers to groff who are learning mom. Old groff hands should be careful. Just because it looks like a duck and walks like a duck does not, in this instance, mean that it is a duck. When using mom, stay away from groff primitives if mom provides a macro that accomplishes the same thing.
Mom’s typesetting macros can be used as a standalone package, independent of the document processing macros. With them, you can typeset on-the-fly. Book covers, your best friend’s résumé, a poster for a lost dog—none of these requires structured document processing (page headers, paragraphs, headings, footnotes, etc). What they do demand is precise control over every element on the page. The typesetting macros give you that control.
The page setup macros establish the physical dimensions of your page and the margins you want it to have. Groff has defaults for these, but I recommend setting them at the top of your files anyway.
If you’re using mom’s document processing macros, these macros must come after PRINTSTYLE.
The PAPER macro provides a shortcut for setting the page to the correct dimensions for a number of common paper sizes. The PAGE macro provides a convenient way of setting the page dimensions and some or all of the page margins with a single macro.
When mom files are processed with pdfmom, which is recommended (see Producing PDFs with groff and mom), page dimensions are automatically passed to groff, and you don't have to worry about them.
Mom documents processed directly with groff, or with
pdfroff, or with pdfmom -Tps, require
that the papersize be given on the command line as well if the
papersize is different from the default on your system. You can
verify—or change—the default papersize by inspecting the
files
<path to groff>/font/devps/DESC
and
<path to groff>/font/devpdf/DESC
(See man papersize for list of valid papersize
names, as well as for instructions on how to enter a non-standard
size.)
If you occasionally need to print on sheets that do not conform to your default papersize, you must, in addition to setting the page dimensions in your mom file, pass the -P-p<papersize> option to groff, pdfroff, or pdfmom -Tps.
For example, suppose your routine papersize is “letter”,
and you need to print something on a legal-sized sheet. After
telling mom about the legal-size sheet (with either
PAGELENGTH
and
PAGEWIDTH
or
PAPER,
or
PAGE),
you must include -P-p<papersize> on whichever
command line you use, eg
pdfmom -Tps -mom -P-plegal
Remember, though, that
pdfmom,
with no -Tps option, is smart enough to know the
papersize from the dimensions provided in your mom file.
Consult man groff, man grops and man groff_font for additional information concerning papersizes, as well as information on printing in “landscape” orientation.
• Requires a unit of measure
The argument to PAGEWIDTH is the width of your printer sheet.
PAGEWIDTH requires a unit of measure. Decimal fractions are
allowed. Hence, to tell mom that the width of your printer sheet is
8-1/2 inches, you enter
.PAGEWIDTH 8.5i
Please read the
Important note on page dimensions and papersize
for information on ensuring groff respects your
PAGEWIDTH.
Important: PAGEWIDTH, when you need it, should be placed at the top of your files.
• Requires a unit of measure
PAGELENGTH tells mom how long your printer sheet is. It works just
like PAGEWIDTH. Therefore, to tell mom your printer sheet is 11
inches long, you enter
.PAGELENGTH 11i
Please read the
Important note on page dimensions and papersize
for information on ensuring groff respects your PAGELENGTH.
Important: PAGELENGTH, when you need it, should be placed at the top of your files.
PAPER provides a convenient way to set the dimensions for some
common printer sheet sizes. <paper type> can
be one of:
LETTER EXECUTIVE
LEGAL 10x14
STATEMENT A3
TABLOID A4
LEDGER A5
FOLIO B4
QUARTO B5
Say, for example, you have A4-sized sheets in your printer. It’s
shorter (and easier) to enter
.PAPER A4
than to remember the correct dimensions and enter
.PAGEWIDTH 595p
.PAGELENGTH 842p
If you’d like landscape orientation for your paper type,
pass PAPER the LANDSCAPE argument.
Please read the Important note on page dimensions and papersize for information on ensuring groff respects your PAPER size.
Important: PAPER when you need it, should be placed at the top of your files.
• Requires a unit of measure
L_MARGIN establishes the distance from the left edge of the printer sheet at which you want your type to start. It may be used any time, and remains in effect until you enter a new value.
Left indents
and
tabs
are calculated from the value you pass to L_MARGIN, hence it’s
always a good idea to invoke it before starting any serious
typesetting. A unit of measure is required. Decimal fractions are
allowed. Therefore, to set the left margin at 3 picas (1/2 inch),
you’d enter either
.L_MARGIN 3P
or
.L_MARGIN .5i
If you use the macros
PAGE,
PAGEWIDTH
or
PAPER
without invoking L_MARGIN (either before or afterwards), mom
automatically sets L_MARGIN to 1 inch.
Note: L_MARGIN behaves in a special way when you’re using the document processing macros. See Typesetting macros during document processing for an explanation.
• Requires a unit of measure
IMPORTANT: R_MARGIN, if used, must come after PAPER, PAGEWIDTH, L_MARGIN and/or PAGE (if a right margin isn’t given to PAGE). The reason is that R_MARGIN calculates line length from the overall page dimensions and the left margin. Obviously, it can’t make the calculation if it doesn’t know the page width and the left margin.
R_MARGIN establishes the amount of space you want between the end of typeset lines and the right hand edge of the printer sheet. In other words, it sets the line length. R_MARGIN requires a unit of measure. Decimal fractions are allowed.
The line length macro (LL) can be used in place of R_MARGIN. In either case, the last one invoked sets the line length. The choice of which to use is up to you. In some instances, you may find it easier to think of a section of type as having a right margin. In others, giving a line length may make more sense.
For example, if you’re setting a page of type you know should
have 6-pica margins left and right, it makes sense to enter a left
and right margin, like this:
.L_MARGIN 6P
.R_MARGIN 6P
That way, you don’t have to worry about calculating the line
length. On the other hand, if you know the line length for a patch
of type should be 17 picas and 3 points, entering the line length
with LL is much easier than calculating the right margin, eg
.LL 17P+3p
If you use the macros
PAGE,
PAGEWIDTH
or
PAPER
without invoking .R_MARGIN afterwards, mom automatically
sets R_MARGIN to 1 inch. If you set a line length after these
macros (with
LL),
the line length calculated by R_MARGIN is, of course, overridden.
Note: R_MARGIN behaves in a special way when you’re using the document processing macros. See Typesetting macros during document processing for an explanation.
• Requires a unit of measure
T_MARGIN establishes the distance from the top of the printer
sheet at which you want your type to start. It requires a unit of
measure, and decimal fractions are allowed. To set a top margin of
2-1/2 centimetres, you’d enter
.T_MARGIN 2.5c
T_MARGIN calculates the vertical position of the first line of type
on a page by treating the top edge of the printer sheet as a
baseline. Therefore,
.T_MARGIN 1.5i
puts the baseline of the first line of type 1-1/2 inches beneath the
top of the page.
Note: T_MARGIN means something slightly different when you’re using the document processing macros. See Top and bottom margins in document processing for an explanation.
IMPORTANT: T_MARGIN does two
things: it establishes the top margin for pages that come after
it and it moves to that position on the current page.
Therefore, T_MARGIN should only be used at the top of a file (prior
to entering text) or after
NEWPAGE,
like this:
.NEWPAGE
.T_MARGIN 6P
<text>
• Requires a unit of measure
B_MARGIN sets a nominal position at the bottom of the page beyond
which you don’t want your type to go. When the bottom margin
is reached, mom starts a new page. B_MARGIN requires a unit of
measure. Decimal fractions are allowed. To set a nominal bottom
margin of 3/4 inch, enter
.B_MARGIN .75i
Obviously, if you haven’t spaced the type on your pages so
that the last lines fall perfectly at the bottom margin, the margin
will vary from page to page. Usually, but not always, the last line
of type that fits on a page before the bottom margin causes mom to
start a new page.
Occasionally, owing to a peculiarity in groff, an extra line will fall below the nominal bottom margin. If you’re using the document processing macros, this is unlikely to happen; the document processing macros are very hard-nosed about aligning bottom margins.
Note: The meaning of B_MARGIN is slightly different when you’re using the document processing macros. See Top and bottom margins in document processing for an explanation.
• All arguments require a unit of measure
IMPORTANT: If you’re using the document processing macros, PAGE must come after PRINTSTYLE. Otherwise, it should go at the top of a document, prior to any text. And remember, when you’re using the document processing macros, top margin and bottom margin mean something slightly different than when you’re using just the typesetting macros (see Top and bottom margins in document processing).
PAGE lets you establish paper dimensions and page margins with a single macro. The only required argument is page width. The rest are optional, but they must appear in order and you can’t skip over any. <lm>, <rm>, <tm> and <bm> refer to the left, right, top and bottom margins respectively.
Assuming your page dimensions are 11 inches by 17 inches, and
that’s all you want to set, enter
.PAGE 11i 17i
If you want to set the left margin as well, say, at 1 inch, PAGE
would look like this:
.PAGE 11i 17i 1i
Now suppose you also want to set the top margin, say, at 1-1/2
inches. <tm> comes after <rm> in the optional arguments,
but you can’t skip over any arguments, therefore to set the
top margin, you must also give a right margin. The PAGE macro would
look like this:
.PAGE 11i 17i 1i 1i 1.5i
| |
required right---+ +---top margin
margin
Clearly, PAGE is best used when you want a convenient way to tell
mom just the dimensions of your printer sheet (width and length), or
when you want to tell her everything about the page (dimensions and
all the margins), for example
.PAGE 8.5i 11i 45p 45p 45p 45p
This sets up an 8-1/2 by 11 inch page with margins of 45 points
(5/8-inch) all around.
Additionally, if you invoke .PAGE with a top margin
argument, any macros you invoke after .PAGE will almost
certainly move the
baseline
of the first line of text down by one linespace. To compensate, do
.RLD 1v
immediately before entering any text, or, if it’s feasible,
make PAGE the last macro you invoke prior to entering text.
Please read the Important note on page dimensions and papersize for information on ensuring groff respects your PAGE dimensions and margins.
Whenever you want to start a new page, use NEWPAGE, by itself with no argument. Mom will finish up processing the current page and move you to the top of a new one (subject to the top margin set with T_MARGIN).
The basic typesetting parameter macros deal with fundamental requirements for setting type: family, font, point size, leading and line length.
If you’re using the typesetting macros only, the arguments passed to the basic parameter macros remain in effect until you change them. The document processing macros handle things differently. See Typesetting macros during document processing for an explanation.
Alias: FAM
FAMILY takes one argument: the name of the
family
you want. Groff comes with a small set of basic families, each
identified by a 1-, 2-or 3-letter mnemonic. The standard families
are:
A = Avant Garde
BM = Bookman
H = Helvetica
HN = Helvetica Narrow
N = New Century Schoolbook
P = Palatino
T = Times Roman
ZCM = Zapf Chancery
The argument you pass to FAMILY is the identifier at left, above.
For example, if you want Helvetica, enter
.FAMILY H
Note: The font macro (FT) lets you specify both the type family and the desired font with a single macro. While this saves a few keystrokes, I recommend using FAMILY for family, and FT for font, except where doing so is genuinely inconvenient. ZCM, for example, only exists in one style: Italic (I). Therefore, .FT ZCMI makes more sense than setting the family to ZCM, then setting the font to I.
Additional note: If you are running a version of groff lower than 1.19.2, you must follow all FAMILY requests with a FT request, otherwise mom will set all type up to the next FT request in the fallback font.
If you are running a version of groff greater than or
equal to 1.19.2, when you invoke the FAMILY macro, mom
“remembers” the font style (Roman, Italic, etc)
currently in use (if the font style exists in the new family) and
will continue to use the same font style in the new family. For
example:
.FAMILY BM \" Bookman family
.FT I \" Medium Italic
<some text> \" Bookman Medium Italic
.FAMILY H \" Helvetica family
<more text> \" Helvetica Medium Italic
However, if the font style does not exist in the new family, mom
will set all subsequent type in the
fallback font
(by default, Courier Medium Roman) until she encounters a
.FT
request that’s valid for the family. For example, assuming
you don’t have the font “Medium Condensed Roman”
(mom extension “CD”) in the Helvetica family:
.FAMILY UN \" Univers family
.FT CD \" Medium Condensed
<some text> \" Univers Medium Condensed
.FAMILY H \" Helvetica family
<more text> \" Courier Medium Roman!
In the above example, you must follow
.FAMILY H with a FT request
that’s valid for Helvetica.
Please see the Appendices, Adding fonts to groff, for information on adding fonts and families to groff, as well as to see a list of the extensions mom provides to groff’s basic R, I, B, BI styles.
Suggestion: When adding
families to groff, I recommend following the established standard
for the naming families and fonts. For example, if you add the
Garamond family, name the font files
GARAMONDR
GARAMONDI
GARAMONDB
GARAMONDBI
GARAMOND then becomes a valid family name you can pass to FAMILY.
(You could, of course, shorten GARAMOND to just G, or GD.) R,
I, B, and BI after GARAMOND are the roman,
italic, bold and bold-italic fonts respectively.
Alias: FONT
By default, groff permits FT to take one of four possible arguments
specifying the desired font:
R = (Medium) Roman
I = (Medium) Italic
B = Bold (Roman)
BI = Bold Italic
For example, if your
family
is Helvetica, entering
.FT B
will give you the Helvetica bold
font.
If your family were Palatino, you’d get the Palatino bold
font.
Mom considerably extends the range of arguments you can pass to FT, making it more convenient to add and access fonts of differing weights and shapes within the same family. Have a look here for a list of the weight/style arguments mom allows. Be aware, though, that you must have the fonts, correctly installed and named, in order to use the arguments. (See Adding fonts to groff for instructions and information.) Please also read the ADDITIONAL NOTE found in the description of the FAMILY macro.
How mom reacts to an invalid argument to FT depends on which version of groff you’re using. If your groff version is greater than or equal to 1.19.2, mom will issue a warning and, depending on how you’ve set up the fallback font, either continue processing using the fallback font, or abort (allowing you to correct the problem). If your groff version is less than 1.19.2, mom will silently continue processing, using either the fallback font or the font that was in effect prior to the invalid FT call.
FT will also accept, as an argument, a full family+font name. For
example,
.FT HB
will set subsequent type in Helvetica Bold. However, I strongly
recommend keeping family and font separate except where doing so is
genuinely inconvenient.
For inline control of fonts, see Inline Escapes, font control.
In the event that you pass an invalid argument to .FAMILY (ie a non-existent family), mom, by default, uses the fallback font, Courier Medium Roman (CR), in order to continue processing your file.
If you’d prefer another fallback font, pass FALLBACK_FONT the
full family+font name of the font you’d like. For example, if
you’d rather the fallback font were Times Roman Medium Roman,
.FALLBACK_FONT TR
would do the trick.
Mom issues a warning whenever a font style set with FT does not exist, either because you haven’t registered the style (see here for instructions on registering styles), or because the font style does not exist in the current family set with FAMILY. By default, mom then aborts, which allows you to correct the problem.
If you’d prefer that mom not abort on non-existent fonts, but rather continue processing using a fallback font, you can pass FALLBACK_FONT the argument WARN, either by itself, or in conjunction with your chosen fallback font.
Some examples of invoking FALLBACK_FONT:
If, for some reason, you want to revert to ABORT, just enter .FALLBACK_FONT ABORT and mom will once again abort on font errors.
• Does not require a unit of measure
PT_SIZE (Point Size) takes one argument: the size of type in points.
Unlike most other macros that establish the size or measure of
something, PT_SIZE does not require that you supply a unit of
measure since it’s a near universal convention that type size
is measured in points. Therefore, to change the type size to, say,
11 points, enter
.PT_SIZE 11
Point sizes may be fractional (eg 10.25 or 12.5).
If you invoke PT_SIZE without an argument, it reverts to its former value. For example, if your point size is 10 and you change it to 12 with .PT_SIZE 12, entering .PT_SIZE (i.e. without an argument) resets the point size to 10.
You can prepend a plus or a minus sign to the argument to PT_SIZE,
in which case the point size will be changed by + or - the original
value. For example, if the point size is 12, and you want 14, you
can do
.PT_SIZE +2
then later reset it to 12 with
.PT_SIZE -2
or, more simply, just
.PT_SIZE
The size of type can also be changed inline. See
Inline Escapes, changing point size.
Note: It is unfortunate that the
pic preprocessor has already taken the name,
PS, and thus mom’s macro for setting point
sizes can’t use it. However, if you aren’t using
pic, you might want to
alias
PT_SIZE as PS, since there’d be no conflict. For example
.ALIAS PS PT_SIZE
would allow you to set point sizes with .PS.
• Does not require a unit of measure
LS (Line Space) takes one argument: the distance you want, typically
in points, from baseline to baseline of type. The argument may be
fractional (eg 12.25 or 14.5). Like PT_SIZE, LS does not require
a unit of measure, since
leading
is most often given in points. Therefore, to set the linespace to
14 points, you would enter
.LS 14
However, if you wish, you may specify a unit of measure by appending
it directly to the argument passed to LS. For example, if you want
a linespace of 1/4 of an inch, enter
.LS .25i
You can prepend a plus or a minus sign to the argument to LS, in
which case the line spacing will be changed by + or - the original
value. For example, if the line spacing is 14 points, and you want
17 points, you can do
.LS +3
then later reset it to 14 points with
.LS -3
Experts: LS should not be confused with the groff primitive .ls. LS acts like .vs. mom does not provide a macro analogous to .ls.
• Does not require a unit of measure
(Please see
here
for information on using
AUTOLEAD during document
processing.)
Without the FACTOR argument, AUTOLEAD calculates the linespace for you by adding its argument to the current point size of type. All subsequent PT_SIZE requests automatically update the linespacing by the autolead amount.
Used in this way, AUTOLEAD does not require a unit of measure; points is assumed. However, you may use an alternate unit of measure by appending it to the argument. The argument may be a decimal fraction (eg .5 or 2.75).
As an example, if your current point size of type is 12, entering
.AUTOLEAD 2
changes the linespace to 14 points, regardless any linespacing
already in effect. From here on, every change to the size of type
(with PT_SIZE, not
inline)
changes the linespace as well. If you decrease the type size to 9
points, the leading decreases to 11 points. If you increase the
type size to 16 points, the leading increases to 18 points.
Automatic updating of the linespacing continues until you enter a “manual” line space value with LS.
Experts: Please note that the groff primitives, .vs and .ps, are unaffected by, and have no effect, on AUTOLEAD.
If you give AUTOLEAD the optional FACTOR argument, AUTOLEAD
calculates the line space as a factor of the
numeric argument
you gave AUTOLEAD. For example, if your point size is 12,
.AUTOLEAD 1.125 FACTOR
sets the leading at 13.5 points. If you change the point size to
14, the leading automatically changes to 15.75 (14 x 1.125).
Note: There’s no need to prepend a plus sign (+) to AUTOLEAD’s argument, although you may do so if you wish.
• Requires a unit of measure
LL (Line Length) takes one argument: the distance from the left margin of the page to the maximum allowable point on the right at which groff should place type. The line length, in other words, as the macro suggests.
LL requires a unit of measure. Therefore, to set the line length to
39 picas, you would enter
.LL 39P
As with other macros that require a unit of measure, the argument to
LL may be fractional. For example,
.LL 4.5i
sets the line length to 4-1/2 inches.
Additionally, you may express a new line length relative to the
current line length by prepending a plus or minus sign to the
argument. Thus, if you wanted to increase the line length by 3
points, you could
do
.LL +3p
This is especially handy when you want to “hang”
punctuation outside the right margin since you can pass
groff’s
\w
escape as the argument to LL, like this:
.LL +\w'.'u
The above example increases the current line length by the width of
a period. Notice that you must append the
unit of measure,
u, to the escape since LL requires a unit of measure.
Note: The right margin macro, (R_MARGIN), can also be used to set line length.
The justification and quadding macros deal with how type aligns along the left and right margins. In a nutshell, type either aligns at the left margin, at the right margin, at both margins, or at neither margin (centred).
These macros also determine whether or not input lines are joined and filled during output.
Additionally, macros that deal with how to break output lines are covered in this section, as is the inline escape for joining input lines.
You may encounter some words here that are unfamiliar. Refer to Typesetting terms and Groff terms for an explanation.
(See fill mode for a definition of the difference between “fill” and “no-fill” modes.)
JUSTIFY doesn’t take an argument. Input lines after JUSTIFY are filled and justified upon output.
To break lines and prevent them from being filled and justified, use the BR macro.
Alias: FILL
(See fill mode for a definition of the difference between “fill” and “no-fill” modes.)
QUAD takes one argument: the direction in which lines should be quadded. Input lines after QUAD are filled upon output.
If L or LEFT, type is set flush along the left margin.
If R or RIGHT, type is set flush along the right margin.
If C or CENTER type is set centred on the current line length.
J and JUSTIFY justify text, and are included as a convenience only. Obviously, if text is justified, it isn’t quadded. .QUAD J and .QUAD JUSTIFY have exactly the same effect as JUSTIFY.
To break lines and prevent them from being filled, use the BR macro.
(See no-fill mode for a definition of the difference between “fill” and “no-fill” modes.)
LEFT, RIGHT and CENTER let you enter text on a line for line basis
without having to use the
BR
macro after each line. Consider the following:
.QUAD LEFT
So runs my dream, but what am I?
.BR
An infant crying in the night
.BR
An infant crying for the light
.BR
And with no language but a cry.
.BR
Because text after .QUAD LEFT is
filled,
you have to use the
BR
macro to prevent the lines from running together. Not only is this
annoying to type, it’s awkward to read in a text editor. Much
better to do
.LEFT
So runs my dream, but what am I?
An infant crying in the night
An infant crying for the light
And with no language but a cry.
IMPORTANT: Because LEFT, RIGHT and CENTER are nofill modes, groff does not always respect the current line length. Input lines that run long may exceed it, or get broken in undesirable ways. Therefore, when using these three macros, you should preview your work to ensure that all lines fit as expected.
When using JUSTIFY or QUAD, BR tells mom about partial lines that you want broken (as opposed to filled). Any partial output line that immediately precedes BR will be quadded in the direction of the current quad, or set flush left if text is justified.
Most of the time, you won’t need the BR macro. In fill modes, mom tries to be sensible about where breaks are needed. If the nature of a macro is such that under most circumstances you’d expect a break, mom puts it in herself. Equally, in macros where a break isn’t normally desirable, no break occurs. This means text files don’t get cluttered with annoying BR’s.
Note: Lines of text in nofill mode never require a BR. Furthermore, in nofill mode, ALL macros cause a break. If a break is not desired, use the \c inline escape.
Experts: BR is an alias for .br. You can use either, or mix ’n’ match with impunity.
In nofill modes (LEFT, RIGHT, CENTER) you must terminate the line input preceding EL with the \c inline escape. See NOTES, below.
Suggestion: If you find remembering whether to put in the \c bothersome, you may prefer to use the inline escape alternative to EL, \*[B], which works consistently regardless of the fill mode. EL does not work after the PAD macro. See .PAD NOBREAK for the way around this.
EL ("End Line")
is conceptually equivalent to the notion of a carriage return with
no linefeed. Its function is simple: it breaks a line without
advancing on the page. As an example of where you might use it,
imagine that you’re working from marked-up copy. The markup
indicates 24 points of space between two given lines, but the
prevailing line spacing is 12.5 points. You may find it more
convenient to break the first line with EL and instruct mom to
advance 24 points to the next line instead of calculating the lead
that needs to be added to 12.5 to get 24. To demonstrate:
.LEFT
.LS 12.5
A line of text.\c
.EL
.ALD 24p
The next line of text.
may be more intuitive than
.LEFT
.LS 12.5
A line of text.
.ALD 11.5p
The next line of text.
The first example has the further advantage that should you wish to
change the prevailing line space but keep the 24 points lead, you
don’t have to recalculate the extra space.
ALD in the above examples stands for “Advance LeaD”, which is covered in the section Vertical movements.
Alias: SP
SPACE breaks a line, just like
BR,
then adds space after the line. With no argument, it adds an extra
line space of a value equal to the current
leading.
If you pass it a numeric argument without supplying a
unit of measure,
it advances that number of extra line spaces. For example:
.SPACE
breaks the line then adds an extra linespace, whereas
.SPACE 2
breaks the line and adds two extra linespaces.
If you supply a unit of measure, SPACE breaks the line then advances
one linespace (at the current
leading)
PLUS the specified amount of extra space given to SPACE, as in
.SPACE 6p
which breaks the line and advances one full linespace plus six
points.
Tip: SPACE and ALD can be used interchangeably (.SPACE 6p and .ALD 6p are equivalent). However, ALD without an argument does nothing, whereas SPACE without an argument adds an extra line space. I recommend using SPACE when you want an extra line space (or multiple thereof), and ALD whenever you want some other value of space after a line.
Experts: SPACE is an alias of .sp. You can use either, or mix ’n’ match with impunity.
Sometimes, you need to break a line of justified text and have it come out fully justified, not quadded left the way it would be with the BR macro. An example of where you’d do this would be when you want to prevent a word at the end of a line from being hyphenated (say, a proper name). SPREAD is the macro that lets you break the line and have it came out fully justified.
Experts: SPREAD is an alias for .brp You can use either, or mix ’n’ match with impunity.
Sometimes, especially when in one of the
nofill modes,
a macro will cause a break where you don’t want one. In order
to prevent this from happening (in other words, to join
input lines
together, forming one
output line),
use the groff
inline escape
\c at the end of each input line to be
joined to another, like this:
.LEFT
.FAMILY T
.FT R
Some lines of text to be \c
.FAMILY H
.FT B
joined \c
.FAMILY T
.FT R
together.
Upon output, the lines will be joined together to read
Some lines of text to be joined together.
with the word “joined” in Helvetica bold. Note the
spaces before \c. Without them, the last three words of
the output line would read
bejoinedtogether
Please also note that had the example been in one of the
fill modes,
there’d have been no need for the \c.
Addendum: The example, above, is designed to demonstrate the
use of \c. An easier and more intuitive way
to accomplish the family/font change in the example would be with
the groff
inline escape,
\f,
like this:
Some lines of text to be \f[HB]joined\*[PREV] together.
The macros in this section help you tweak groff’s behaviour, ensuring that your documents look typographically professional.
WS (Word Space) increases or decreases the amount of space between words. In nofill modes, or if QUAD is in effect, the space between words is fixed. Therefore, if you change the word spacing with WS, the change applies uniformly to the space between every word on every line. However, when text is justified, the space between words varies from line to line (in order to justify the text). Consequently, the change you make with WS represents the minimum (and ideal) space groff will try to put between words before deciding whether to hyphenate a final word or to stretch the word spacing.
Word space is relative to point size. Generally, in/decreasing the word space by a value of 1 or 2 produces a difference that in many cases is scarcely visible; in/decreasing by a value between 3 and 5 produces a subtle but noticeable difference; and in/decreasing by a value greater than 6 is almost always apparent. You should preview your work to assess the effect of WS.
WS takes as its argument a whole number preceded by a plus or minus
sign. Therefore, to decrease the word space slightly, you might
enter
.WS -2
To increase it by a noticeable amount, you might enter
.WS +6
You can reset the word spacing to its previous value by switching
the plus or minus sign, like this:
.WS +2
A line of text
.WS -2
The .WS -2 undoes the effect of
.WS +2. You can also reset WS to its groff default
by entering
.WS DEFAULT
This can be particularly useful if you’ve been playing around
with plus and minus values, and can’t remember by how much to
in/decrease the word space to get it back to normal.
SS (Sentence Space) tells groff how to treat double spaces it
encounters between sentences in
input lines.
If you use SS, input sentences with two spaces after them and
input sentences that fall at the end of input lines all receive a
normal word space plus an additional amount of space whose size is
determined by the + value passed as an argument to SS. Thus,
.SS +2
means that input sentences with two spaces after them receive a
normal word space PLUS the +2 value passed to SS.
Like WS, increasing the sentence space by a value of 1 or 2 produces a difference that in many cases is scarcely visible; increasing by a value of 5 or so produces a subtle but noticeable difference (ie the space between double-spaced input sentences will be slightly but visibly greater than the space between words); and increasing by a value greater than 10 is always apparent. You should preview your work to assess the effect of SS.
There’s an additional argument you can pass SS: the number
zero (without the + sign). It’s the argument you’ll
use most often. Typeset copy should never have two spaces between
sentences, and the "zero" argument tells groff to give the extra
spaces no space at all (effectively removing them). Therefore, if
you double-space your sentences (as you should when writing in a
text editor), get in the habit of putting
.SS 0
at the top of your files.
If you do use SS for something other than ensuring that you
don’t get unwanted sentence spaces in output copy, you can set
or reset the sentence space to the groff default (the same width
as a word space, ie double-spaced input sentences will appear
double-spaced on output as well) with
.SS DEFAULT
If you’re using the
document processing macros
and your
PRINTSTYLE
is TYPEWRITE, .SS DEFAULT is the
default, because you do want double spaces between sentences in copy
that imitates the look of a typewritten document.
IMPORTANT: SS with an argument other than 0 (zero) should only be used if you’re of the old (and wise) school of typists that puts two spaces between sentences. If you ignore this advice and use SS when you habitually put only one space between sentences, you risk producing output where the space between sentences is not equal.
Aliases: HYPHENATE, HYPHENATION
HY, as you can see, can be invoked with a number of arguments. In all cases, the aliases HYPHENATE or HYPHENATION can be used in place of HY. To aid in understanding the various arguments you can pass to HY, I’ve broken them down into separate sections.
HY by itself (ie with no argument) simply turns automatic
hyphenation on. Any argument other than LINES, MARGIN, SPACE or
DEFAULT, turns automatic hyphenation off. For example, as explained
in
How to read macro arguments,
you could turn HY off by entering
.HY OFF
or
.HY X
or
.HY END
A subsequent call to HY restores hyphenation with the parameters for
LINES, MARGIN, or SPACE that were formerly in effect (see below).
HY observes the following default hyphenation rules:
HY LINES sets the maximum number of consecutive hyphenated lines
that will appear in output copy. 2 is a very good choice, and
you’d set it with
.HY LINES 2
By default, when you turn automatic hyphenation on, there is no
limit to the number of consecutive hyphenated lines.
Note: Discretionary hyphens count when groff is figuring out how many lines to hyphenate; explicit hyphens (ie the actual hyphen character) do not.
HY MARGIN sets the amount of room allowed at the end of a line before hyphenation is tripped (eg if there’s only 6 points left at the end of a line, groff won’t try to hyphenate the next word). HY MARGIN only applies if you’re using QUAD, and is really only useful if you’re using QUAD LEFT.
As an example, if you don’t want groff to hyphenate words
when there’s only 18 points of space left at the end of a
left-quadded line, you’d enter
.HY MARGIN 18p
Note: The numeric argument after HY MARGIN requires a unit of measure.
HY SPACE sets an amount of extra interword space that groff will try
to put between words on a line in order to PREVENT hyphenation. HY
SPACE applies only to
justified lines.
Generally speaking, you’ll want this value to be quite small,
since too big a value will result in lines with gaping holes between
the words. A reasonable value might be half a point, or one point,
which you’d set with
.HY SPACE .5p
or
.HY SPACE 1p
Note: The numeric argument after HY SPACE requires a unit of measure.
HY DEFAULT resets automatic hyphenation to its default behaviour, cancelling any changes made with HY LINES, HY MARGIN, and/or HY SPACE.
Hyphenation is a necessary evil. If it can be avoided, it should be. If it can’t be, it should occur infrequently. That’s the reason for the number of parameters you can set with HY.
Furthermore, hyphenation in rag copy requires a great deal of attention. At best, it should be avoided completely by individually adjusting the number of words on consecutive lines to achieve a pleasing, natural-looking rag. Since such adjustments are often too fussy for document processing, I recommend playing around with HY MARGIN a bit if your copy looks hyphen-heavy.
Alias: HYSET
HY_SET lets you set the parameters for hyphenation with a single macro. <lines>, <margin> and <space> correspond to the numeric values required by LINES, MARGIN and SPACE as described above.
To set just the maximum number of consecutive hyphenated lines,
you’d enter
.HY_SET 2
If you wanted the same number of maximum consecutive hyphenated
lines and a hyphenation margin for use with
rag
copy,
.HY_SET 2 36p
would set the hyphenation margin to 36 points.
If you wanted the same number of maximum consecutive hyphenated
lines and a hyphenation space of 2 points for use with
justified
copy,
.HYSET 2 0 2p
is how you’d do it.
RW (Reduce Whitespace) and its corresponding macro, EW (Expand Whitespace), allow you to tighten (or loosen) output lines by uniformly reducing or expanding the space between characters. This is particularly useful when you want to squeeze or stretch lines on a narrow measure.
The value passed to RW may be a whole number or a decimal fraction.
Since a value of 1 produces a noticeable reduction in the space
between letters at text sizes, you’ll most likely use small
decimal values when tightening lines. For example,
.RW .1
or
.RW .2
may be just enough to squeeze an extra character or two on a line
without the change in letter spacing being obvious. I highly
recommend previewing your work to assess the effect of RW.
Note: By default, RW does not deposit a break when it’s invoked if you’re in one of the fill modes (ie QUAD L, R, C, J or JUSTIFY). If you want RW to break at the ends of the previous input lines while you’re in a fill mode, tell mom that’s what you want by invoking .BR_AT_LINE_KERN.
IMPORTANT: RW (and its complement, EW; see below) only affects the current font, and remains in effect for that font every time it’s called, hence it must be reset to zero to cancel its effect (.RW 0).
EW (Expand Whitespace) expands the amount of whitespace between letters, effectively “loosening” lines of type.
The value passed to EW may be a whole number or a decimal fraction.
Since a value of 1 produces a noticeable expansion in the space
between letters at text sizes, you’ll most likely use small
decimal values when loosening lines. For example,
.EW .1
or
.EW .2
may be just enough to open up a line without the change in letter
spacing being obvious. I highly recommend previewing your work to
assess the effect of EW.
Note: By default, EW does not deposit a break when it’s invoked if you’re in one of the fill modes (ie QUAD L, R, C, J or JUSTIFY). If you want EW to break at the ends of the previous input lines while you’re in a fill mode, tell mom that’s what you want by invoking the .BR_AT_LINE_KERN toggle macro.
IMPORTANT: EW (and its complement, RW; see above) only affects the current font, and remains in effect for that font every time it’s called, hence it must be reset to zero to cancel its effect (.RW 0).
By default, in
fill
modes (ie
QUAD
L, R, C, J or
JUSTIFY)
mom does not break
input lines
when you invoke
RW
or
EW.
If you’d like her to break input lines prior to RW or EW,
invoke .BR_AT_INPUT_LINE without any argument. To
disable the breaks, invoke .BR_AT_INPUT_LINE with any
argument (OFF, QUIT, Q, X...), like this
.BR_AT_LINE_KERN OFF
or
.BR_AT_LINE_KERN X
With QUAD L, R or C, mom simply breaks the line. With QUAD J (or
just JUSTIFY, which is the same thing), she breaks and
force justifies
the line prior to .EW or .RW.
By itself (ie with no argument), KERN turns automatic pairwise kerning on. With any argument (eg OFF, Q, X), pairwise kerning is turned off.
Kerning of individual character pairs can be controlled with the inline escapes \*[BU <n>] and \*[FU <n>]. See Inline Escapes, kerning.
Alias: LIG
Provided your current font has ligatures, LIGATURES, by itself, turns on automatic generation of ligatures. When automatic ligature generation is on, simply typing the letters of a ligature combination will produce the correct ligature upon output. For example, if you type the word “finally”, the fi combination will be output as an fi ligature. Generally speaking, ligatures are A Good Thing, hence mom has them on by default.
LIGATURES with any argument turns automatic ligature generation off.
Note: Not all fonts support ligatures.
It sometimes happens that a family doesn’t contain all the fonts you need. You might, for example, be missing an italic font, or a bold font. Or you might not be able to get your hands on the condensed version. That’s where these macros and inline escapes come in. With them, you can fake the fonts you’re missing. A word of caution, though: “faked” fonts are just that—faked. You should only use them as a last resort, and then only sparingly. A word or two or a line or two in a faked font will pass unnoticed; large patches of type in a faked font look typographically cheap.
Pseudo-italicizing of type is accomplished by slanting a roman font
a certain number of degrees to the right. SETSLANT lets you fix the
number of degrees. Mom’s default is 15, which produces an
acceptable approximation of an italic font. If you want another
value—say, 13 degrees—you’d set it by entering
.SETSLANT 13
If you change the degree of slant and later want to set it back to
the mom default, do
.SETSLANT RESET
Note: By itself, SETSLANT will not start pseudo-italicizing type; it merely tells mom what degree of slant you want. To start pseudo-italicizing, use the inline escape \*[SLANT].
\*[SLANT] begins pseudo-italicizing type.
\*[SLANTX] turns the feature off. Both are
inline escapes,
therefore they should not appear as separate lines, but rather be
embedded in text lines, like this:
Not \*[SLANT]everything\*[SLANTX] is as it seems.
Alternatively, if you wanted the whole line pseudo-italicized,
you’d do
\*[SLANT]Not everything is as it seems.\*[SLANTX]
Once \*[SLANT] is invoked, it remains in effect until
turned off.
Note: If you’re using the document processing macros with PRINTSTYLE TYPEWRITE, mom underlines pseudo-italics by default. To change this behaviour, use the special macro SLANT_MEANS_SLANT.
Emboldening of type is accomplished by printing characters twice;
the second printing is slightly offset from the first, effectively
“thickening” the character. SETBOLDER lets you set the
number of
machine units
for the offset. Mom’s default is 700 units, which produces an
acceptable approximation of a bold font. If you want another
value—say, 500 units—you’d set it by entering
.SETBOLDER 500
If you change the emboldening offset and later want to set it back
to the mom default, do
.SETBOLDER RESET
Note: By itself, SETBOLDER will not start emboldening type; it merely tells mom what you want the emboldening offset to be. To start emboldening, use the inline escape \*[BOLDER].
\*[BOLDER] begins emboldening type.
\*[BOLDERX] turns the feature off. Both are
inline escapes,
therefore they should not appear as separate lines, but rather be
embedded in text lines, like this:
Not \*[BOLDER]everything\*[BOLDERX] is as it seems.
Alternatively, if you wanted the whole line emboldened,
you’d do
\*[BOLDER]Not everything is as it seems.\*[BOLDERX]
Once \*[BOLDER] is invoked, it remains in effect
until turned off.
Note: If you’re using the document processing macros with PRINTSTYLE TYPEWRITE, mom ignores \*[BOLDER] requests.
Pseudo-condensing of type is accomplished by reducing the width of characters at a given point size without reducing their height, effectively narrowing them so they look like condensed type. CONDENSE tells mom what percentage of the normal character width you want the characters to be condensed.
Mom has no default value for CONDENSE, therefore you must set it
before using the
inline escape
\*[COND].
80 percent of the normal character width is a good value, and
you’d set it like this:
.CONDENSE 80
Note: By itself, CONDENSE will not start pseudo-condensing type; it merely tells mom what percentage of the normal character width you want characters to be condensed. To start pseudo-condensing, use the inline escape \*[COND].
Additional note: Make sure that pseudo-condensing is off (with \*[CONDX]) before before making any changes to the pseudo-condense percentage with CONDENSE.
\*[COND] begins pseudo-condensing type.
\*[CONDX] turns the feature off. Both are
inline escapes,
therefore they should not appear as separate lines, but rather be
embedded in text lines, like this:
\*[COND]Not everything is as it seems.\*[CONDX]
\*[COND] remains in effect until you turn it
off with \*[CONDX].
IMPORTANT: You must turn \*[COND] off before making any changes to the point size of your type, either via the PT_SIZE macro or with the \s inline escape. If you wish the new point size to be pseudo-condensed, simply reinvoke \*[COND] afterwards. Equally, \*[COND] must be turned off before changing the condense percentage with .CONDENSE.
Note: If you’re using the document processing macros with PRINTSTYLE TYPEWRITE, mom ignores \*[COND] requests.
Pseudo-extending of type is accomplished by increasing the width of characters at a given point size without increasing their height, effectively widening them so they look like extended type. EXTEND tells mom what percentage of the normal character width you want the characters to be extended.
Mom has no default value for EXTEND, therefore you must set it
before using the
inline escape
\*[EXT].
120% of the normal character width is a good value, and you’d
set it like this:
.EXTEND 120
Note: By itself, EXTEND will not start pseudo-extending type; it merely tells mom what percentage of the normal character width you want characters to be extended. To start pseudo-extending, use the inline escape \*[EXT].
Additional note: Make sure that pseudo-extending is off (with \*[EXTX]) before before making any changes to the pseudo-extend percentage with EXTEND.
\*[EXT] begins pseudo-extending type.
\*[EXTX] turns the feature off. Both are
inline escapes,
therefore they should not appear as separate lines, but rather be
embedded in text lines, like this:
\*[EXT]Not everything is as it seems.\*[EXTX]
\*[EXT] remains in effect until you turn it off with
\*[EXTX].
IMPORTANT: You must turn \*[EXT] off before making any changes to the point size of your type, either via the PT_SIZE macro or with the \s inline escape. If you wish the new point size to be pseudo-extended, simply reinvoke \*[EXT] afterwards. Equally, \*[EXT] must be turned off before changing the extend percentage with EXTEND.
Note: If you’re using the document processing macros with PRINTSTYLE TYPEWRITE, mom ignores \*[EXT] requests.
• Requires a unit of measure
ALD takes one argument: the distance to move downward on the page relative to the current vertical position.
Used by itself, or preceded by BR, ALD will advance by one line space plus the distance you specify. Preceded by EL, it will advance by exactly the distance you specify.
ALD requires a unit of measure. Decimal fractions are allowed, and
values may be combined. Therefore, to move down on the page by 1/4
of an inch, you could enter either
.ALD .25i
or
.ALD 1P+6p
As the mnemonic
(Advance LeaD)
suggests, you’ll most often use ALD with
points
of lead.
Note: if you want to use ALD at the top
of a page (ie to advance to the starting position of type on a
page), combine the value you want with -1v (minus one
line space), like this:
.ALD 1i-1v
At the top of a page, this will advance one inch from the top edge
of the paper. Without the -1v, the same command would advance one
inch from the top of the page plus the distance of one line space.
• Requires a unit of measure
RLD takes one argument: the distance to move upward on the page relative to the current vertical position.
Used by itself, or preceded by BR, RLD will advance by one line space, then reverse by the distance you specify. Preceded by EL, it will reverse by exactly the distance you specify.
RLD requires a unit of measure. Decimal fractions are allowed, and
values may be combined. Therefore, to move up on the page by 1/4 of
an inch, you could enter either
.RLD .25i
or
.RLD 1P+6p
As the mnemonic
(Reverse LeaD)
suggests, you’ll most often use RLD with
points
of lead.
Mom provides two different kinds of tab setup: typesetting tabs and string tabs. Neither one has anything to do with the tab key on your keyboard, and both are utterly divorced from groff’s notion of tabs. I recommend reading this section carefully in order to understand how mom handles tabs.
Note: see the section Typesetting macros during document processing for reassuring information on the use of tabs during document processing.
Typesetting tabs are defined by both an indent from the left margin and a line length. This is quite different from typewriter-style tab stops (the groff norm) that only define the left indent. In conjunction with the multi-column macros, typesetting tabs significantly facilitate tabular and columnar work.
Typesetting tabs are created with the TAB_SET macro. TAB_SET identifies the tab (by number), establishes its left indent and line length, and optionally sets a quad direction and fill mode. After tabs have been created with TAB_SET, they can be called at any time with the TAB macro.
Say you want to set up three tabs to produce an employee evaluation that looks something like this:
You want the first tab, CRITERION,
Tabs must be numbered, and each has to be set up with a separate
TAB_SET
line. Therefore, to set up tab 1, you enter
.TAB_SET 1 0 5P L
| | | |
tab #--+ | | +--direction
| |
indent--+ +--length
You want the second tab, EVALUATION,
You set it up like this:
.TAB_SET 2 8P 9P C
| | | |
tab #--+ | | +--direction
| |
indent--+ +--length
You want the third tab, COMMENTS,
The setup looks like this:
.TAB_SET 3 19P 17P L QUAD
| | | | |
| | | | +--fill output lines
| | | |
tab #--+ | | +--direction
| |
indent--+ +--length
Once the tabs are set up, you can call them in one of two ways:
To exit from tabs and restore your original left margin, line length, quad direction and fill mode, use .TQ (Tab Quit).
Here’s how the input for our sample employee evaluation looks (with some introductory parameters):
Try setting this up and processing it it with
pdfmom filename.mom > filename.pdf
then previewing the .pdf file. Notice how .TN
simply moves over to the next tab, while the combination
.SP/.TAB 1 breaks the line, advances by one extra
linespace, and calls the first tab.
Notice, too, how the QUAD argument passed to tab 3 means you don’t have to worry about the length of input lines; mom fills the tab and sets the type flush left.
String tabs let you mark off tab positions with inline escapes embedded in input lines. Left indents and line lengths are calculated from the beginning and end positions of the marks. This is especially useful when tab indents and lengths need to be determined from the text that goes in each tab.
Setting up string tabs is a two-step procedure. First, you enter an input line in which you mark off where you want tabs to begin and end. (This is often best done in conjunction with the SILENT macro.)
Next, you invoke the ST macro for every string tab you defined, and optionally pass quad and fill information to it. That done, string tabs are called with the TAB macro, just like typesetting tabs.
In combination with the PAD macro and the groff inline escape \h (move horizontally across the page) or mom’s \*[FWD <distance>] (move forward) inline, string tabs provide tremendous flexibility in setting up complex tab structures.
Say you want to set up tabs for the employee evaluation form used as an example in the typesetting tabs tutorial. This time, though, you want to play around with the point size of type, so you can’t know exactly how long the tabs will be or where they should start. All you know is
This is an ideal job for string tabs.
The first thing you need for string tabs is an input line with tab positions marked on it. Tabs are marked with the inline escapes \*[ST<n>] and \*[ST<n>X], where <n> is the number you want the tab to have. (In this example, we enclose the input line with the SILENT macro so the line doesn’t print. We also use the PAD macro to permit defining tab 3 as simply “the amount of space remaining on the input line.”)
The setup looks like this:
The long line after .PAD looks scary, but it isn’t really. Here’s what it means when broken down into its component parts:
The tabs are now defined, but they require
quad direction
and
fill
information. For each string tab defined above, enter a separate
.ST
line, like this:
.ST 1 L
.ST 2 L
.ST 3 L QUAD
| | |
| | +--fill output lines
| |
tab #--+ +--direction
From here on in, you call the tabs with
.TAB,
.TN,
or
\*[TB+]
just like typesetting tabs (see
typesetting tabs tutorial).
Here’s the complete setup and entry for the sample employee evaluation form utilizing string tabs.
Try setting this up and processing it with
pdfmom filename.mom > filename.pdf
and previewing the .pdf file.
Now, change the point size of the above sample to 12 and preview it again. You’ll see that the tab structure remains identical (tab 1=CRITERION, tab 2=EVALUATION, tab 3=space remaining, and the gutter between tabs is still 1 pica), while the position and length of the tabs have altered because of the new point size.
Now try increasing the gutters to 2 picas (\*[FWD 24p] or \*[FWD 2P] instead of \*[FWD 12p]). Preview the file again, and notice how the tab structure remains the same, but the gutters are wider.
• <indent> and <length> require a unit of measure
TAB_SET creates typesetting tabs that later can be called with .TAB. Typesetting tabs are numbered, and defined by an indent, a length, and a quad direction, hence TAB_SET has four required arguments:
To set up a centred tab 6 picas long and 9 points from the left
margin, you’d enter
.TAB_SET 1 9p 6P C
The tab number in the above (”1”) is simply an
identifier. It could have been 4, or 17, or 296. There’s no
need to set up tabs in numerical sequence.
By default, tabs are in nofill mode, meaning you can enter text in tabs on a line-for-line basis without having to use the BR macro. If you want a tab to be filled, pass the optional argument QUAD, which will make the tab behave as if you’d entered .QUAD L | R | C.
For
justified
tabs, simply pass the argument J (without the QUAD argument), like
this:
.TAB 1 9p 6P J
Once tabs are set, they can be called at any time with the
TAB <n>
macro, where <n> is the number of the desired tab.
You can set up any number of typesetting tabs. However, be aware that string tabs are also called with TAB <n>, so be careful that you don’t set up a typesetting tab numbered, say, 4, when you already have a string tab numbered 4. Every tab, typesetting or string, must have a unique numeric identifier.
Note: If you use TAB_SET while you’re currently inside a tab, the indent argument is the distance from the tab’s left margin, not the left margin of the page. Therefore, you should exit tabs (with .TQ) before creating new tabs (unless, of course, you want to set up a tab structure within the confines of an existing tab).
IMPORTANT: Turn all indents off (see Indents) before setting up tabs with TAB_SET, or mom may get confused.
The quad direction must be LEFT or JUSTIFY (see QUAD and JUSTIFY) or the no-fill mode set to LEFT in order for these inlines to function properly. Please see IMPORTANT, below.
String tabs need to be marked off with
inline escapes
before being set up with the
ST
macro. Any input line may contain string tab markers. <number>, above, means the numeric
identifier of the tab. The following shows a sample input line with
string tab markers.
\*[ST1]Now is the time\*[ST1X] for all \*[ST2]good men\*ST2X] to come to the aid of the party.
String tab 1 begins at the start of the line and ends after the word
“time”. String tab 2 starts at “good” and
ends after “men”. Inline escapes (eg font or point
size changes, or horizontal movements, including
padding)
are taken into account when mom determines the position and length
of string tabs.
Up to nineteen string tabs may be marked (not necessarily all on the same line, of course), and they must be numbered between 1 and 19.
Once string tabs have been marked in input lines, they have to be “set” with .ST, after which they may be called, by number, with .TAB.
Note: Lines with string tabs marked off in them are normal input lines, ie they get printed, just like any input line. If you want to set up string tabs without the line printing, use the SILENT macro.
IMPORTANT: Owing to the way groff processes input lines and turns them into output lines, it is not possible for mom to “guess” the correct starting position of string tabs marked off in lines that are centered or set flush right.
Equally, she cannot guess the starting position if a line is fully justified and broken with SPREAD.
In other words, in order to use string tabs, LEFT must be active, or, if QUAD LEFT or JUSTIFY are active, the line on which the string tabs are marked must be broken “manually” with .BR (but not .SPREAD).
To circumvent this behaviour, I recommend using the
PAD
to set up string tabs in centered or flush right lines. Say, for
example, you want to use a string tab to underscore the text of a
centered line with a rule. Rather than this,
.CENTER
\*[ST1]A line of text\*[ST1X]\c
.EL
.ST 1
.TAB 1
.PT_SIZE 24
.ALD 3p
\*[RULE]
.RLD 3p
.TQ
you should do:
.QUAD CENTER
.PAD "#\*[ST1]A line of text\*[ST1X]#"
.EL
.ST 1
.TAB 1
.PT_SIZE 24
.ALD 3p
\*[RULE] \" Note that you can’t use \*[UP ] or \*[DOWN] with \*[RULE]
.RLD 3p
.TQ
After string tabs have been marked off on an input line (see
\*[ST]...\*[STX]),
you need to “set” them by giving them a direction and,
optionally, the QUAD argument. In this respect, ST is
like
TAB_SET
except that you don’t have to give ST an indent or a
line length (that’s already taken care of, inline, by
\*[ST]...\*[STX]). If you want string tab 1 to be left,
enter
.ST 1 L
If you want it to be left and
filled, enter
.ST 1 L QUAD
If you want it to be justified, enter
.ST 1 J
See the
Quickie tutorial on string tabs
for a full explanation of setting up string tabs.
Alias: TB
After tabs have been defined (either with
TAB_SET
or
ST),
TAB moves to whatever tab number you pass it as an argument. For
example,
.TAB 3
moves you to tab 3.
Note: TAB breaks the line preceding it and
advances 1 linespace. Hence,
.TAB 1
A line of text in tab 1.
.TAB 2
A line of text in tab 2.
produces, on output
A line of text in tab 1.
A line of text in tab 2.
If you want the tabs to line up, use
TN
(Tab Next)
or, more conveniently, the inline escape
\*[TB+]:
.TAB 1
A line of text in tab 1.\*[TB+]
A line of text in tab 2.
which produces
A line of text in tab 1. A line of text in tab 2.
If the text in your tabs runs to several lines, and you want the
first lines of each tab to align, you must use the
multi-column macros.
Additional note: Any indents in effect prior to calling a tab are automatically turned off by TAB. If you were happily zipping down the page with a left indent of 2 picas turned on, and you call a tab whose indent from the left margin is 6 picas, your new distance from the left margin will be 6 picas, not 6 picas plus the 2 pica indent.
TN moves over to the next tab in numeric sequence (tab n+1) without advancing on the page. See the NOTE in the description of the TAB macro for an example of how TN works.
In tabs that aren’t given the QUAD argument when they’re set up with TAB_SET or ST, you must terminate the line preceding .TN with the \c inline escape. Conversely, if you did give a QUAD argument to TAB_SET or ST, the \c must not be used.
If you find remembering whether to put in the \c bothersome, you may prefer to use the inline escape alternative to .TN, \*[TB+], which works consistently regardless of the fill mode.
Note: You must put text in the
input line
immediately after TN. Stacking of TN’s is not
allowed. In other words, you cannot do
.TAB 1
Some text\c
.TN
Some more text\c
.TN
.TN
Yet more text
The above example, assuming tabs numbered from 1 to 4, should be entered
.TAB 1
Some text\c
.TN
Some more text\c
.TN
\&\c
.TN
Yet more text
\& is a zero-width, non-printing character that groff
recognizes as valid input, hence meets the requirement for input
text following .TN.
TQ takes you out of whatever tab you were in, advances 1 linespace, and restores the left margin, line length, quad direction and fill mode that were in effect prior to invoking any tabs.
Tabs are not by nature columnar, which is to say that if the text
inside a tab runs to several lines, calling another tab does not
automatically move to the
baseline
of the first line in the previous tab. To demonstrate:
.TAB 1
Carrots
Potatoes
Broccoli
.TAB 2
$1.99/5 lbs
$0.25/lb
$0.99/bunch
produces, on output
Carrots
Potatoes
Broccoli
$1.99/5 lbs
$0.25/lb
$0.99/bunch
The multi-column macros allow you to set tabs in columnar fashion,
rather than line by line. When you invoke multi-column mode (with
.MCO –
Multi-Column On),
mom saves the position of the current baseline.
.MCR
(Multi-Column Return)
at any point while multi-columns are on returns you to the saved
position. Exiting multi-columns
(.MCX –
Multi-Column eXit)
quits the current tab (if you’re in one) and moves you to the
bottom of the longest column. (Note that you do not have to use
multi-columns in conjunction with tabs.)
Using our example above, but setting it in multi-column mode,
.MCO
.TAB 1
Carrots
Potatoes
Broccoli
.MCR
.TAB 2
$1.99/5 lbs
$0.25/lb
$0.99/bunch
.MCX
produces
Carrots $1.99/5 lbs
Potatoes $0.25/lb
Broccoli $0.99/bunch
Note: Do not confuse MCO with the COLUMNS macro in the document processing macros.
MCO (Multi-Column On) is the macro you use to begin multi-column setting. It marks the current baseline as the top of your columns, for use later with MCR. See the introduction to columns for an explanation of multi-columns and some sample input.
Note: Do not confuse MCO with the COLUMNS macro in the document processing macros.
Once you’ve turned multi-columns on (with .MCO), .MCR, at any time, returns you to the top of your columns.
• Optional argument requires a unit of measure
MCX takes you out of any tab you were in (by silently invoking .TQ) and advances to the bottom of the longest column.
Without an argument, MCX advances 1 linespace below the longest column. Linespace, in this instance, is the leading in effect at the moment MCX is invoked.
If you pass the <distance> argument to MCX, it
advances 1 linespace below the longest column (see above) PLUS the
distance specified by the argument. The argument requires a unit
of measure; therefore, to advance an extra 6 points below where MCX
would normally place you, you’d enter
.MCX 6p
Note: If you wish to advance a precise
distance below the
baseline
of the longest column, use MCX with an argument of 0 (zero; no unit
of measure required) in conjunction with the
ALD
macro, like this:
.MCX 0
.ALD 24p
The above advances to precisely 24 points below the baseline of the longest column.
With mom’s indents, you can indent from the left, the right, or both margins. In addition, mom provides temporary left indents (ie only one line is indented, as at the start of a paragraph) and “hanging” left indents (the reverse of a temporary indent; the first line isn’t indented, subsequent lines are).
Mom provides five kinds of indents: left, right, both, temporary, and hanging. Each is invoked by its own name:
In addition, there are four macros to control exiting from indents:
This section deals exclusively with IL, IR and IB. For an explanation of hanging and temporary indents—how they work and how to use them—see Hanging indents and Temporary indents.
The first time you invoke any of mom’s indents, you must
supply a measure. For example,
.IL 2P
indents text 2 picas from the left margin (or current tab indent).
When you want to exit the above indent, use either
.IQ
or
.ILX
The next time you want the same indent, invoke it without the
argument, like this:
.IL
As you can see, once you’ve supplied a measure to an indent
macro, mom stores the value, obviating the need to repeat it on
subsequent invocations. And mom doesn’t just store the
measure—she hangs on to it tenaciously. Arguments passed to
IL, IR and IB are additive. Consider the following:
.LL 20P
.IR 2P \"Indent right by 2 picas
A first block of text...
...
...
.IQ \"Turn indent off
A second block of text...
...
...
.IR 2P \"Indent right by an additional 2 picas (ie 4 picas)
A third block of text...
...
...
The first block of text is right indented by 2 picas (ie the line
length is shortened by 2 picas to 18 picas). The second block of
text, after IQ, is, as you’d expect, set to the full measure.
The third block of text—the one to pay attention to—is
not right indented by 2 picas, but rather by 4 picas. Mom adds
the value of arguments to IL, IR and IB to whatever value is already
in effect.
If you wanted the third block of text in the example above to be right indented by just 2 picas (the original measure given to IR), you would enter .IR without an argument.
Because indent arguments are additive, putting a minus sign in front
of the argument can be used to subtract from the current value.
In the following example, the first line is indented 18 points,
the second is indented 36 points (18 + 18), and the third is again
indented 18 points (36 - 18).
.IL 18p \"Indent left by 18 points = 18 points
Now is the time
.IL 18p \"Indent left by 18 points more = 36 points
for all good men to come
.IL -18p \"Indent left by 18 points less = 18 points
to the aid of the party.
Sometimes, you may want to clear out the stored indent
values—let mom start indenting with a clean slate, as it
were. Giving the optional argument CLEAR to any of the
“indent quit” macros resets them to zero.
Indent styles may be combined and manipulated separately. You
could, for example, have a left indent of 4 picas and a right indent
of 6 picas and control each separately, as in the following example.
.IL 4P \"Indent left 4 picas
.IR 6P \"Indent right 6 picas
Some text
.IRX \"Turn off the right indent only
More text \"Text is still indented 4 picas left
If, at .IRX, you wanted the text afterwards to have no
indents (either left or right), you would enter .IQ,
which exits all indent styles at once.
A word of advice: Indents are best used only when you have a compelling reason not to change the current left margin or line length. In many instances where indents might seem expedient, it’s better to use tabs, or actually change the left margin or the line length. Mom’s indenting macros are flexible and powerful, but easy to get tangled up in.
Note: see the section Typesetting macros during document processing for information and advice on using indents with the document processing macros.
• The optional argument requires a unit of measure
IL indents text from the left margin of the page, or if you’re in a tab, from the left edge of the tab. Once IL is on, the left indent is applied uniformly to every subsequent line of text, even if you change the line length.
The first time you invoke .IL, you must give it a
measure. Subsequent invocations with a measure add to the previous
measure. A minus sign may be prepended to the argument to subtract
from the current measure. The
\w
inline escape
may be used to specify a text-dependent measure, in which case no
unit of measure is required. For example,
.IL \w'margarine'
indents text by the width of the word “margarine”.
With no argument, IL indents by its last active value. See the brief explanation of how mom handles indents for more details.
Note: Calling a tab (with .TAB <n>) automatically cancels any active indents.
Additional note: Invoking IL automatically turns off IB.
• The optional argument requires a unit of measure
IR indents text from the right margin of the page, or if you’re in a tab, from the end of the tab.
The first time you invoke .IR, you must give it a
measure. Subsequent invocations with a measure add to the previous
indent measure. A minus sign may be prepended to the argument to
subtract from the current indent measure. The
\w
inline escape
may be used to specify a text-dependent measure, in which case no
unit of measure is required. For example,
.IR \w'jello'
indents text by the width of the word “jello”.
With no argument, IR indents by its last active value. See the brief explanation of how mom handles indents for more details.
Note: Calling a tab (with .TAB <n>) automatically cancels any active indents.
Additional note: Invoking IR automatically turns off IB.
• The optional arguments require a unit of measure
IB allows you to set or invoke a left and a right indent at the same time.
At its first invocation, you must supply a measure for both indents; at subsequent invocations when you wish to supply a measure, both must be given again. As with IL and IR, the measures are added to the values previously passed to the macro. Hence, if you wish to change just one of the values, you must give an argument of zero to the other.
A word of advice: If you need to manipulate left and right indents separately, use a combination of IL and IR instead of IB. You’ll save yourself a lot of grief.
A minus sign may be prepended to the arguments to subtract from
their current values. The
\w
inline escape
may be used to specify text-dependent measures, in which case no
unit of measure is required. For example,
.IB \w’margarine’ \w'jello'
left indents text by the width of the word “margarine”
and right indents by the width of “jello”.
Like IL and IR, IB with no argument indents by its last active values. See the brief explanation of how mom handles indents for more details.
Note: Calling a tab (with .TAB <n>) automatically cancels any active indents.
Additional note: Invoking IB automatically turns off IL and IR.
• The optional argument requires a unit of measure
A temporary indent is one that applies only to the first line of text that comes after it. Its chief use is indenting the first line of paragraphs. (Mom’s PP macro, for example, uses a temporary indent.)
The first time you invoke .TI, you must give
it a measure. If you want to indent the first line of a paragraph
by, say, 2
ems,
do
.TI 2m
Subsequent invocations of TI do not require you to supply a measure;
mom keeps track of the last measure you gave it.
Because temporary indents are temporary, there’s no need to turn them off.
IMPORTANT: Unlike IL, IR and IB,
measures given to TI are NOT additive. In the following example,
the second .TI 2P is exactly 2 picas.
.TI 1P
The beginning of a paragraph...
.TI 2P
The beginning of another paragraph...
• The optional argument requires a unit of measure
A hanging indent looks like this:
The 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, at length I would be avenged...
The first line of text “hangs” outside the left margin.
In order to use hanging indents, you must first have a left indent active (set with either .IL or .IB). Mom will not hang text outside the left margin set with .L_MARGIN or outside the left margin of a tab.
The first time you invoke .HI, you must give
it a measure. If you want the first line of a paragraph to hang by,
say, 1 pica, do
.IL 1P
.HI 1P
Subsequent invocations of HI do not require you to supply a measure;
mom keeps track of the last measure you gave it.
Generally speaking, you should invoke HI immediately prior to the line you want hung (ie without any intervening control lines). And because hanging indents affect only one line, there’s no need to turn them off.
IMPORTANT: Unlike IL, IR and IB, measures given to HI are NOT additive. Each time you pass a measure to HI, the measure is treated literally.
Note: mom has macros for setting lists (see Nested lists). This recipe exists to demonstrate the use of hanging indents only.
.PAGE 8.5i 11i 1i 1i 1i 1i .FAMILY T .FT R .PT_SIZE 12 .LS 14 .JUSTIFY .KERN .SS 0 .IL \w'\0\0.' .HI \w'\0\0.' 1.\0The most important point to be considered is whether the answer to the meaning of Life, the Universe, and Everything really is 42. We have no-one’s word on the subject except Mr. Adams’. .HI 2.\0If the answer to the meaning of Life, the Universe, and Everything is indeed 42, what impact does this have on the politics of representation? 42 is, after all not a prime number. Are we to infer that prime numbers don’t deserve equal rights and equal access in the universe? .HI 3.\0If 42 is deemed non-exclusionary, how do we present it as the answer and, at the same time, forestall debate on its exclusionary implications? First, we invoke a left indent with a measure equal to the width of 2 figures spaces plus a period (using the \w inline escape). At this point, the left indent is active; text afterwards would normally be indented. However, we invoke a hanging indent of exactly the same width, which hangs the first line (and first line only!) to the left of the indent by the same distance (in this case, that means “out to the left margin”). Because we begin the first line with a number, a period, and a figure space, the actual text (“The most important point...”) starts at exactly the same spot as the indented lines that follow.
Notice that subsequent invocations of .HI don’t require a measure to be given.
Paste the example above into a file and preview it with
pdfmom filename.mom > filename.pdf
to see hanging indents in action.
IMPORTANT NOTE: The original macro for quitting all indents was IX. This usage has been deprecated in favour of IQ. IX will continue to behave as before, but mom will issue a warning to stderr indicating that you should update your documents.
As a consequence of this change, ILX, IRX and IBX may now also be invoked as ILQ, IRQ and IBQ. Both forms are acceptable.
Without an argument, the macros to quit indents merely restore your original margins and line length. The measures stored in the indent macros themselves are saved so you can call them again without having to supply a measure.
If you pass these macros the optional argument CLEAR, they not only restore your original left margin and line length, but also clear any values associated with a particular indent style. The next time you need an indent of the same style, you have to supply a measure again.
.IQ CLEAR, as you’d suspect, quits and clears the values for all indent styles at once.
Back to Table of Contents | Top | Next: Goodies |