Back to Table of Contents Next: Goodies

The typesetting macros


Introduction

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, heads, footnotes, etc). What they do demand is precise control over every element on the page. The typesetting macros give you that control.


Paper and page setup: paper size & page margins

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 unless you’re using mom’s document processing macros and are content with her defaults.

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.

Important note on page dimensions and papersize

Mom’s macros for setting up the desired size of printer sheets tell mom and groff about the page dimensions, but not the driver responsible for generating the final PostScript file. You must take care of this yourself.

If you routinely print documents on the same size paper (you probably do), the easiest way to make sure the PostScript driver knows about your papersize is to edit the file
<path to groff>/font/devps/DESC In it, you will see a line that reads: papersize <papersize> Change <papersize> to the name of your papersize (e.g. a4, letter, legal, etc.; a full list of valid named papersizes that can be used in DESC is found in man papersize). If your routine papersize is non-standard (i.e. doesn’t have a “name”) you can give the dimensions for your papersize, separated by a comma. The dimensions must have a unit of measure appended. Valid units of measure for papersize are inches (i), centimeters (c), picas (P) and points (p). For example, to set up a routine papersize of 8 inches by 10 inches, the line would look like this:
papersize 8i,10i Having set up your routine papersize, if you occasionally need to print on sheets that do not conform to its dimensions, you must, in addition to setting the page dimensions in your mom file, invoke groff on the command line with the -P-p<papersize> option.

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) in your mom file, when you invoke groff to process the file, the command would look like this:
groff -mom -P-plegal

Consult man groff, man grops and man groff-font for additional information concerning papersizes, as well as information on printing in “landscape” orientation.

Paper and page setup macros

Page width

Macro: PAGEWIDTH <width of printer sheet>

• 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.

Page length

Macro: PAGELENGTH <length of printer sheet>

• 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.

Paper

Macro: PAPER <paper type>

PAPER provides a convenient way to set the page 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 Please read the Important note on page dimensions and papersize for information on ensuring groff respects your PAPER size.

Left margin

Macro: L_MARGIN <left margin>

• 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.

Right margin

Macro: R_MARGIN <right margin>

• 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, e.g.
.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.

Top margin

Macro: T_MARGIN <top margin>

• 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>

Bottom margin

Macro: B_MARGIN <bottom margin>

• 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.

Page

Macro: PAGE <width> [ <length> [ <lm> [ <rm> [ <tm> [ <bm> ] ] ] ] ]

• All arguments require a unit of measure

IMPORTANT: If you’re using the document processing macros, PAGE must come after START. 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.

Start a new page

Macro: NEWPAGE

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).

Experts: Prior to version 1.1.9, NEWPAGE was simply an alias of .bp. As of 1.1.9, NEWPAGE, is its own mom macro. While the new macro should be backwardly compatible with documents created using pre-1.1.9 moms, I suggest that from this version onward, if you were in the habit of using .bp whenever you wanted to break to a new page, you now begin to use NEWPAGE instead.


Basic typesetting parameters

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.

Basic parameter macros

Type family

Macro: FAMILY <family>

Alias: FAM

FAMILY takes one argument: the name of the family you want. Groff comes with a number of PostScript 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: As of mom, version 1.1.9-a, 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 PostScript 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.

Experts: If you add other PostScript families to groff’s /font/devps directory, I recommend following the groff standard for 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.

FT

Macro: FT R | I | B | BI | <any other valid font style>

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.

(As of mom, version 1.1.9-a, the range of arguments that can be passed to FT has been considerably extended, allowing access to a greater variety of font weights and shapes. Please see the NOTE, below.)

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.

Note: mom, versions 1.1.9-a and higher, 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 How to create a PostScript font for use with groff for how to add fonts to groff.) Please also read the ADDITIONAL NOTE found in the description of the FAMILY macro.

Fallback font

Macro: FALLBACK_FONT <fallback font> [ ABORT | WARN ]

In the event that you pass an invalid argument to .FAMILY (i.e. 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.

Additionally, if your version of groff accepts accepts ”.if F” and ”.if S” (see above), 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.

Point size of type

Macro: PT_SIZE <size of type in points>

• 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 (e.g. 10.25 or 12.5).

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 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.

Line spacing/leading

Macro: LS <distance between lines>

• 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 (e.g. 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.

Automatic line spacing

Macro: AUTOLEAD <amount of automatic leading> [FACTOR]

• Does not require a unit of measure

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 (e.g. .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.

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.

Line length

Macro: LL <line length>

• 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.


Justification and quadding/breaking and joining lines

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.

Justification and quadding/breaking and joining lines macros

Justify lines

Macro: JUSTIFY

(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.

Quad lines left, right, or centre

Macro: QUAD L | LEFT | R | RIGHT | C | CENTER | J | JUSTIFY

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.

Set lines flush left, right or centered in no-fill mode

Macro: LEFT
Macro: RIGHT
Macro: CENTER  (alias CENTRE)

(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.

Manually break lines

Macro: BR

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.

Manually break a line without advancing on the page

Macro: EL

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.

The mnemonic “EL” is borrowed from old Compugraphic typesetting systems, where it stood for "End Line." Conceptually, EL is equivalent to the notion of a carriage return with no linefeed.

EL’s 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” (another mnemonic borrowed from Compugraphic), which is covered in the section Vertical movements.

Notes

In versions of mom prior to 1.1.9, EL did not always work as advertised on the last output line of pages that contained a footer trap (e.g. one set with B_MARGIN or in documents formatted using the document processing macros).

EL has been re-written so that this should no longer be the case. However, in order for it to work in the nofill modes (LEFT, RIGHT or CENTER), you must always “join” .EL to the line before it using the \c inline escape, like this:
.LEFT A line I don’t want to advance\c .EL Conversely, in fill modes (QUAD LEFT, QUAD RIGHT, QUAD CENTER or JUSTIFY), the \c must not be used.

If EL is used after most macros or groff primitives (see the exception, below), you don’t have to worry about this, regardless of the fill mode. Just type .EL

Experts: EL is unrelated to groff’s .el. If you find the similarity confusing, you may want to alias EL as something else (but don’t use EOL; mom uses it internally.)

Break lines and add space between

Macro: SPACE <space to add between lines>

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.

Break and force justify (spread) lines

Macro: SPREAD

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.

Join input lines

Inline: \c

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.


Typographic refinements

The macros in this section help you tweak groff’s behaviour, ensuring that your documents look typographically professional.

Typographic refinements macros

Word spacing

Macro: WS <+|-wordspace> | DEFAULT

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 type size. Knowing how it’s calculated is unimportant. What matters is having a sense of how the value passed to WS affects the look of your type. 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 of 5 or so produces a subtle but noticeable difference; and in/decreasing by a value greater than 10 is always apparent. You should preview your work to assess the effect of WS.

WS takes as its argument a number (decimal fractions are allowed) preceded by a plus or minus sign. Therefore, to decrease the word space slightly, you might enter
.WS -4 To increase it by a noticeable amount, you might enter
.WS +12 You can reset the word spacing to its previous value by switching the plus or minus sign, like this:
.WS +4 A line of text .WS -4 The .WS -4 undoes the effect of .WS +4. 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 you have to in/decrease the word space to get it back to normal.

Sentence space

Macro: SS <+sentence space> | 0 | DEFAULT

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 (i.e. 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, i.e. 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.

Automatic hyphenation control

Macro: HY LINES <max. number of consecutive hyphenated lines>
Macro: HY MARGIN <size of hyphenation margin>
Macro: HY SPACE <extra interword spacing to prevent hyphenation>
Macro: HY DEFAULT
Macro: HY toggle

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.

1.  HY

HY by itself (i.e. 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 HY observes the following default hyphenation rules: