Next Prev Back to Table of Contents

# Goodies

The macros in this section are a collection of useful (and sometimes nearly indispensable) routines to simplify typesetting.

### Goodies list

- ALIAS (rename macros)
- SILENT ("hide" input lines from output)
- TRAP (suspend/re-invoke traps)
- SMARTQUOTES (convert typewriter doublequotes to proper doublequotes)
- CAPS (convert to upper case)
- STRING (user-definable strings)
- Underscore/underline
  - UNDERSCORE (single underscore)
  - UNDERSCORE2 (double underscore)
  - UNDERLINE (underline -- Courier only!)
  - \*[UL] (inline escape to underline -- Courier only!)
- Padding
  - PAD (insert equalized space into lines)
  - PAD_MARKER (change/set the marker used with PAD)
- Leaders
  - \*[LEADER] (inline escape to add leaders to a line)
  - LEADER_CHARACTER (change/set the leader character)
- Drop caps
  - DROPCAP (set a drop cap)
  - Support macros for DROPCAP
    - DROPCAP_FAMILY (change drop cap family)
    - DROPCAP_FONT (change drop cap font)
    - DROPCAP_ADJUST (alter size of drop cap)
    - DROPCAP_COLOR (change colour of drop cap)
    - DROPCAP_GUTTER (change space between drop cap and running text)
- Superscripts
  - \*[SUP] (set superscript)
  - \*[CONDSUP] (set condensed superscript)
  - \*[EXTSUP] (set extended superscript)
- Lists
  - Introduction to lists
  - LIST
  - ITEM
  - SHIFT_LIST
  - RESET_LIST
  - PAD_LIST_DIGITS

### Rename macros

Macro: ALIAS <new name> <old name>

The ALIAS macro may well be your best friend. With it, you can change the name of a macro to anything you like (provided the new name is not already being used by mom; see the list of reserved words).

Groff has always been a bit intimidating for new users because its standard macro packages use very terse macro names. Mom doesn't like people to feel intimidated; she wants them to feel welcome. Consequently, she tries for easy-to-grasp, self-explanatory macro names. However, mom knows that people have their own ways of thinking, their own preferences, their own habits. Some of her macro names may not suit you; they might be too long, or aren't what you automatically think of when you want to do a particular thing, or might conflict with habits you've developed over the years.

If you don't like one of mom's macro names, say, PAGEWIDTH, change it, like this:

    	.ALIAS PW PAGEWIDTH
    	       |      |
    	  new__|      |__official
    	 name            name

The first argument to ALIAS is the new name you want for a macro. The second is the "official" name by which the macro is normally invoked. After ALIAS, either can be used.

Note that in ALIAS, you do NOT include the period (dot) that precedes the macro when it's a control line.

NOTE: If you use ALIAS a lot, and always for the same things, consider creating an aliases file of the form

    	.ALIAS <new name> <old name>
    	.ALIAS <new name> <old name>
    	.ALIAS <new name> <old name>
    	...etc

Put the file someplace convenient and source it at the beginning of your documents using the groff primitive .so. Assuming that you've created an aliases file called mom_aliases in your home directory under a directory called `Mom`, you'd source it by placing

    	.so /home/<username>/Mom/mom_aliases

at the top of your documents.

If you share documents that make use of an alias file, remember that other people don't have the file! Paste the whole thing at the top of your documents, please.

EXPERTS: ALIAS is an alias of `.als`. You can use either, or mix 'n' match with impunity.

### Hide input lines from output

Macro: SILENT toggle
Alias: COMMENT

Sometimes, you want to "hide" input lines from final output. This is most likely to be the case when setting up string tabs (see the quickie tutorial on string tabs for an example), but there are other places where you might want input lines to be invisible as well. Any place you don't want input lines to appear in the output, use the SILENT macro.

SILENT is a toggle. Invoking it without an argument turns it on; any argument turns it off. E.g.,

    	.SILENT
    	A line of text
    	.SILENT OFF

The line "A line of text" will not appear in the output copy.

SILENT is aliased as COMMENT. If you want to insert non-printing comments into your documents, you may prefer this.

NOTE: SILENT does not automatically break an input line (see BR) when you're in one of the fill modes (JUSTIFY or QUAD L | R | C | J). The same applies to tabs (typesetting or string) to which you've passed the J or QUAD argument. You must insert `.BR` yourself, or risk a portion of your text disappearing into a black hole.

### Suspend/re-invoke traps

Macro: TRAP toggle

Traps are vertical positions on the output page at which you or mom have instructed groff to start doing something automatically. Commonly, this is near the bottom of the page, where automatic behind-the-scenes processing is needed in order for one page to finish and another to start.

Sometimes, traps get sprung when you don't want them. If this happens, surround just the offending macros and input lines with

    	.TRAP OFF
    	...
    	.TRAP

TRAP is a toggle, therefore any argument turns it off (i.e. suspends the trap), and no argument turns it (back) on.

### Convert typewriter doublequotes to proper doublequotes

Macro: SMARTQUOTES [<off>] [ ,, | >> | << ]
or
Macro: SMARTQUOTES DA | DE | ES | FR | IT | NL | NO | PT | SV

If you invoke SMARTQUOTES without an argument, mom converts all instances of the inch-mark, (`"` -- also called a "doublequote"), into the appropriate instances of true Anglo-American open- and close-doublequotes. (See Internationalization for how to get SMARTQUOTES to behave correctly for non-English quoting styles.)

Typographically, there is a difference between the inch-mark and doublequotes -- a BIG difference. Sadly, typewriters and computer keyboards supply only one: the inch-mark. While using inches for doublequotes is, and always has been, acceptable in typewriter-style copy, it has never been, and, God willing, never will be acceptable in typeset copy. Failure to turn inches into quotes is the first thing a professional typesetter notices in documents prepared by amateurs. And you don't want to look like an amateur, do you?

### Internationalization

If you invoke SMARTQUOTES with one of the optional arguments (`,,` or `>>` or `<<`) you can use `"` as "cheap" open- and close-quotes when inputting text in a language other than English, and have mom convert them, on output, into the chosen open- and close-quote style.

`,,` opens quotes with "lowered doublequotes" and closes them with "raised doublequotes", as in this ascii approximation:

    	,,Hilfe !``

`>>` opens quotes with guillemets pointing to the right, and closes them with guillemets pointing to the left, as in this ascii approximation:

    	>>Zurück !<<

`<<` opens quotes with guillemets pointing to the left, and closes them with guillemets pointing to the right, as in this ascii approximation:

    	<<Mais monsieur! Je ne suis pas ce genre de fille!>>

Please note: the above arguments to SMARTQUOTES are literal ASCII characters. `,,` is two commas, `<<` is two less-than signs and `>>` is two greater-than signs.

Alternatively, you can pass SMARTQUOTES the two-letter, ISO 639 abbreviation for the language you're writing in, and mom will output the correct quotes.

    	.SMARTQUOTES DA     = Danish      >>text<<
    	.SMARTQUOTES DE     = German      ,,text``
    	.SMARTQUOTES ES     = Spanish     ``text´´
    	.SMARTQUOTES FR     = French      << text >>
    	.SMARTQUOTES IT     = Italian     << text >>
    	.SMARTQUOTES NL     = Dutch       ´´text´´
    	.SMARTQUOTES NO     = Norwegian   <<text>>
    	.SMARTQUOTES PT     = Portuguese  <<text>>
    	.SMARTQUOTES SV     = Swedish     >>text>>

Turn SMARTQUOTES off by passing it any argument not in the argument list (e.g. OFF, QUIT, X, etc.)

If you're using the document processing macros with PRINTSTYLE TYPESET, SMARTQUOTES is on by default (in the Anglo-American style); with PRINTSTYLE TYPEWRITE, it's off by default (and should probably stay that way).

Finally, if you're fussy about the kerning of quote marks in relation to the text they surround, or have special quoting needs, you have to enter quote marks by hand using groff's native inline escapes for special characters (see man groff_char for a complete list of special characters). Entering quote marks this way allows you to use mom's inline kerning escapes to fine-tune the look of quotes.

NOTE: SMARTQUOTES does not work on single quotes, which most people input with the apostrophe (found at the right-hand end of the "home row" on a QWERTY keyboard). Groff will interpret all instances of the apostrophe as an apostrophe, making the symbol useless as an open-single-quote. For open single quotes, input the backtick character typically found under the tilde on most keyboards. (Pour nous autres, "backtick" veut dire l'accent grave.) Here's an example of correct input copy with single quotes:

    	"But she said, `I don't want to!'"

ADDITIONAL NOTE: Whether or not you have SMARTQUOTES turned on, get into the habit of entering the foot- and inch-marks, when you need them, with the inline escapes \*[FOOT] and \*[INCH], instead of `'` and `"`.

### Convert to upper case

Macro: CAPS toggle

CAPS converts all lower case letters to upper case. Primarily, it's a support macro used by the document processing macros, but you may find it helpful on occasion. CAPS is a toggle, therefore no argument turns it on, any argument turns it off.

    	.CAPS
    	All work and no play makes Jack a dull boy.
    	.CAPS OFF

produces, on output

    	ALL WORK AND NO PLAY MAKES JACK A DULL BOY.

### User-defined strings

Macro: STRING <name> <what you want in the string>

You may find sometimes that you have to type out portions of text repeatedly. If you'd like not to wear out your fingers, you can define a "string" that, whenever you call it by name, outputs whatever you put into it.

For example, say you're creating a document that repeatedly uses the phrase "the Montreal/Windsor corridor". Instead of typing all that out every time, you could define a string, like this:

    	.STRING mw the Montreal/Windsor corridor

Once a string is defined, you can call it any time with the inline escape `\*[<stringname>]`. Using the example string above

    	The schedule for trains along \*[mw]:

produces, on output

    	The schedule for trains along the Montreal/Windsor corridor:

NOTE: Be very careful not to put any spaces at the ends of strings you're defining, unless you want them. Everything after the name argument you pass to STRING goes into the string, including trailing spaces.

Experts: STRING is an alias for ds. You can use either, or mix 'n' match with impunity.

### Single underscore

Macro: UNDERSCORE [ <distance below baseline> ] "<string>"
*Optional argument requires a unit of measure

By default, UNDERSCORE places an underscore 2 points beneath the required string argument. The string must be enclosed in double-quotes, like this:

    	.UNDERSCORE "Unmonitored monopolies breed high prices and poor products."

If you wish to change the distance of the rule from the baseline, use the optional argument <distance below baseline> (with a unit of measure).

    	.UNDERSCORE 3p "Unmonitored monopolies breed high prices and poor products."

The above places the underscore 3 points below the baseline.

NOTES:
UNDERSCORE does not work across line breaks in output copy, which is to say that you can't underscore a multi-line passage simply by putting the text of the whole thing in the string you pass to UNDERSCORE. Each output line or portion of an output line you want underscored must be plugged separately into UNDERSCORE. Bear in mind, though, that underscoring should at best be an occasional effect in typeset copy. If you want to emphasize an entire passage, it's much, much better to change fonts (e.g. to italic or bold).

You can easily and successfully underline entire passages in simulated typewriter-style copy (i.e. if your font is Courier, or you're using the document processing macro PRINTSTYLE TYPEWRITE), with the UNDERLINE macro. UNDERLINE is designed specifically for this purpose, but works only with the Courier font.

Mom doesn't always get the position and length of the underscore precisely right in justified copy, although she's fine with all the other fill modes, as well as with the no-fill modes. As of this writing, I have no solution to the occasional problems with justified copy.

UNDERSCORE tends to confuse gxditview, even though the output, when printed, looks fine. Generally, I recommend using gv to preview files anyway. See the section on previewing.

### Double underscore

Macro: UNDERSCORE2 [ <distance below baseline> [ <distance between rules> ] ] "<string>"
*Optional arguments require a unit of measure

By default, UNDERSCORE2 places a double underscore 2 points beneath the required string argument. The string must be enclosed in double-quotes, like this:

    	.UNDERSCORE2 "Unmonitored monopolies breed high prices and poor products."

The default distance between the two rules is 2 points.

If you wish to change the distance of the double underscore from the baseline, use the optional argument <distance below baseline> (with a unit of measure), e.g.,

    	.UNDERSCORE2 3p "Unmonitored monopolies breed high prices and poor products."

which places the double underscore 3 points below the baseline.

If you wish to change the distance between the two rules as well, use the second optional argument <distance between rules> (with a unit of measure). Be aware that you must give a value for the first optional argument if you want to use the second.

NOTE: the same restrictions and caveats apply to UNDERSCORE2 as to UNDERSCORE. See the NOTES for UNDERSCORE.

### Underline text -- Courier font only!

Macro: UNDERLINE toggle

If your font is Courier, or you're using the document processing macro PRINTSTYLE TYPEWRITE, UNDERLINE allows you to underline words and passages that, in typeset copy, would be italicized. You invoke UNDERLINE as you do with all toggle macros -- by itself (i.e. with no argument) to initiate underlining, and with any argument to turn underlining off.

When on, UNDERLINE underlines letters, words and numbers, but not punctuation or spaces. This makes for more readable copy than a solid underline.

NOTE: Underlining may also be turned on and off inline with the escapes \*[UL]...\*[ULX].

### Inline escape for underlining -- Courier font only!

Inline: \*[UL]...\*[ULX]

If your font is Courier, or you're using the document processing macro PRINTSTYLE TYPEWRITE, \*[UL]...\*[ULX] underlines words and passages that, in typeset copy, would be italicized.

\*[UL] underlines all letters, words and numbers following it, but not punctuation or spaces. This makes for more readable copy than a solid underline. When you no longer want underlining, \*[ULX] turns underlining off.

The macro UNDERLINE and the inline escape \*[UL] are functionally identical, hence

    	.FAM     C
    	.FT      R
    	.PT_SIZE 12
    	.LS      24
    	.SS      0
    	.QUAD    LEFT
    	Which should I heed?
    	.UNDERLINE
    	Just do it
    	.UNDERLINE OFF
    	or
    	.UNDERLINE
    	just say no?
    	.UNDERLINE OFF

produces the same result as

    	.FAM     C
    	.FT      R
    	.PT_SIZE 12
    	.LS      24
    	.SS      0
    	.QUAD    LEFT
    	Which should I heed? \*[UL]Just do it\*[ULX] or \*[UL]just say no?\*[ULX]

### Insert space into lines

Macro: PAD "<string with pad markers inserted>" [NOBREAK]

With PAD, you can insert unspecified amounts of whitespace into a line. The optional NOBREAK argument tells mom not to advance on the page after the PAD macro has been invoked.

PAD calculates the difference between the length of text on the line and the distance remaining to its end, then inserts the difference (as whitespace) at the place(s) you specify.

Take, for example, the following relatively common typesetting situation, found at the bottom of legal agreements:

    	Date             Signature                               |

The person signing the agreement is supposed to fill in the date as well as a signature. Space needs to be left for both, but the exact amount is neither known, nor important. All that matters is that there be a little space after Date, and rather more space after Signature. (In the above, | represents the end of the line at the prevailing line length.)

The pad marker (see below) is # (the pound or number sign on your keyboard) and can be used multiple times in a line. With that in mind, here's how you'd input the Date/Signature line (assuming a length of 30 picas):

    	.LL 30P
    	.PAD "Date#Signature###"

When the line is output, the space remaining on the line, after "Date" and "Signature" have been taken into account, is split into four (because there are four # signs). One quarter of the space is inserted between Date and Signature, the remainder is inserted after Signature.

One rarely wants merely to insert space in a line; one usually wants to fill it with something, hence PAD is particularly useful in conjunction with string tabs. The following uses the Date/Signature example above, but adds rules into the whitespace through the use of string tabs and mom's inline escape \*[RULE]. (Instead of \*[RULE], groff's line drawing function, \l could be used.)

    	.LL 30P
    	.PAD "Date \*[ST1]#\*[ST1X] Signature \*[ST2]###\*[ST2X]" NOBREAK
    	.ST 1 J
    	.ST 2 J
    	.TAB 1
    	\*[RULE]
    	.TN
    	\*[RULE]
    	.TQ

If you're not a typesetter, and if you're new to groff, the example probably looks like gibberish. My apologies. However, remember that typesetting is a craft, and without having studied the craft, it takes a while to grasp its concepts.

Basically, what the example does is:

1. Pads the Date/Signature line (using the pad marker #), encloses the padded space with two string tabs markers, and outputs the line.
2. Sets the two string tabs (notice the use of EL beforehand; you don't want mom to advance a line at this point).
3. Calls the first string tab and draws a rule to its full length.
4. Calls the second tab with TN (which moves to tab 2 and stays on the same baseline) then draws a rule to the full length of string tab 2.

Often, when setting up string tabs this way, you don't want the padded line to print immediately. To accomplish this, use SILENT. See the quickie tutorial on string tabs for an example.

NOTE: Because the pound sign (#) is used as the pad marker, you can't use it as a literal part of the pad string. If you need the sign to appear in the text of a padded line, change the pad marker with PAD_MARKER. Also, be aware that # as a pad marker only applies within the PAD macro; at all other times it prints literally, just as you'd expect.

Another important consideration when using PAD is that because the string must be enclosed in double-quotes, you can't use the double-quote (") as part of the string. The way to circumvent this is to use the groff inline escapes \(lq and \(rq (leftquote and rightquote respectively) whenever double-quotes are required in the string passed to PAD.

### Change/set the marker used with PAD

Macro: PAD_MARKER <character to use as the pad marker>

If you need to change mom's default pad marker (#), either because you want a literal # in the padded line, or simply because you want to use another character instead, use PAD_MARKER, whose argument is the new pad marker character you want.

    	.PAD_MARKER @

changes the pad marker to @.

Once you've changed the pad marker, the new marker remains in effect for every instance of PAD until you change it again (say, back to the pound sign).

### Inline escape to add leaders to a line

Inline: \*[LEADER]

Whenever you want to fill a line or tab with leaders, use the inline escape \*[LEADER]. The remainder of the line or tab will be filled with the leader character. Mom's default leader character is a period (dot), but you can change it to any character you like with LEADER_CHARACTER.

NOTE: \*[LEADER] fills lines or tabs right to their end. You cannot insert leaders into a line or tab and have text following the leader on the same line or in the same tab. Should you wish to achieve such an effect typographically, create tabs for each element of the line and fill them appropriately with the text and leaders you need. String tabs are perfect for this. An example follows.

    	.LL 30P
    	.PAD "Date\*[ST1]#\*[ST1X]Signature\*[ST2]###\*[ST2X]"
    	.EL
    	.ST 1 J
    	.ST 2 J
    	.TAB 1
    	\*[LEADER]
    	.TN
    	\*[LEADER]
    	.TQ

The PAD line sets the words Date and Signature, and marks string tabs around the pad space inserted in the line. The string tabs are then "set", called, and filled with leaders. The result looks like this:

    	Date.............Signature.....................................

### Change/set the leader character

Macro: LEADER_CHARACTER <character>

LEADER_CHARACTER takes one argument: a single character you would like to be used for leaders. (See \*[LEADER] for an explanation of how to fill lines with leaders.)

For example, to change the leader character from mom's default (a period) to the underscore character, enter

    	.LEADER_CHARACTER _

### Drop caps

Macro: DROPCAP <dropcap letter> <number of lines to drop> [ COND <percentage> | EXT <percentage> ]

The first two arguments to DROPCAP are the letter you want to be the drop cap and the number of lines you want it to drop. By default, mom uses the current family and font for the drop cap.

The optional argument (COND or EXT) indicates that you want the drop cap condensed (narrower) or extended (wider). If you use COND or EXT, you must follow the argument with the percentage of the letter's normal width you want it condensed or extended. No percent sign (%) is required.

Mom will do her very best to get the drop cap to line up with the first line of text indented beside it, then set the correct number of indented lines, and restore your left margin when the number of drop cap lines has been reached.

Beginning a paragraph with a drop cap "T" looks like this:

    	.DROPCAP T 3 COND 90
    	he thousand injuries of Fortunato I had borne as best I
    	could, but when he ventured upon insult, I vowed revenge.
    	You who so well know the nature of my soul will not suppose,
    	however, that I gave utterance to a threat...

The drop cap, slightly condensed but in the current family and font, will be three lines tall, with whatever text fills those three lines indented to the right of the letter. The remainder of the paragraph's text will revert to the left margin.

NOTE: When using the document processing macro PP, DROPCAP only works

- with initial paragraphs (i.e. at the start of the document, or after HEAD),
- when DROPCAP comes immediately after PP,
- and when the PRINTSTYLE is TYPESET.

If these conditions aren't met, DROPCAP is silently ignored.

WARNING: DROPCAP puts a bit of a strain on resource-challenged systems. If you have such a system and use drop caps extensively in a document, be prepared for a wait while mom does her thing.

### Support macros for DROPCAP

Drop caps are the bane of most typesetters' existence. It's very difficult to get the size of the drop cap right for the number of drop lines, especially if the drop cap is in a different family from the prevailing family of running text. Not only that, but there's the gutter around the drop cap to take into account, plus the fact that the letter may be too wide or too narrow to look anything but odd or misplaced.

Mom solves the last of these problems with the COND and EXT arguments. The rest she solves with macros that change the default behaviour of DROPCAP, namely

DROPCAP_FAMILY,
DROPCAP_FONT,
DROPCAP_COLOR,
DROPCAP_ADJUST
and
DROPCAP_GUTTER.

These macros must, of course, come before you invoke DROPCAP.

### DROPCAP_FAMILY

Set the drop cap family by giving DROPCAP_FAMILY the name of the family you want, e.g.

    	.DROPCAP_FAMILY H

which will set the family to Helvetica for the drop cap only.

### DROPCAP_FONT

Set the drop cap font by giving DROPCAP_FONT the name of the font you want, e.g.

    	.DROPCAP_FONT I

which will set the font to italic for the drop cap only.

### DROPCAP_ADJUST

If the size mom calculates for the drop cap isn't precisely what you want, you can increase or decrease it with DROPCAP_ADJUST, like this: e.g.

    	.DROPCAP_ADJUST +1
    	    or
    	.DROPCAP_ADJUST -.75

DROPCAP_ADJUST only understands points, therefore do not append any unit of measure to the argument. And always be sure to prepend the plus or minus sign, depending on whether you want the drop cap larger or smaller.

### DROPCAP_COLOR

If you'd like your drop cap colourized, simply invoke DROPCAP_COLOR with the name of a colour you've already created ("initialized") with NEWCOLOR or XCOLOR. Only the drop cap will be colourized; all other text will remain at the current colour default (usually black).

### DROPCAP_GUTTER

By default, mom puts three points of space between the drop cap and the text indented beside it. If you want another value, use DROPCAP_GUTTER (with a unit of measure), like this:

    	.DROPCAP_GUTTER 6p

### Superscript

Inlines: \*[SUP]...\*[SUPX]

Superscripts are accomplished inline. Whenever you need one, typically for numerals, all you need to do is surround the superscript with the inlines above. \*[SUP] begins superscripting; \*[SUPX] turns it off.

If your running type is pseudo-condensed or pseudo-extended and you want your superscripts to be equivalently pseudo-condensed or -extended, use \*[CONDSUP]...\*[CONDSUPX] or \*[EXTSUP]...\*[EXTSUPX].

The superscript inlines are primarily used by the document processing macros for automatic generation of numbered footnotes. However, you may find them useful for other purposes.

NOTE: Mom does a pretty fine job of making superscripts look good in any font and at any size. If you're fussy, though (and I am), about precise vertical placement, kerning, weight, size, and so on, you may want to roll your own solution. And sorry, there's no mom equivalent for subscripts. I'm neither a mathematician nor a chemist, so I don't need them. Of course, anyone who wishes to contribute a subscript routine to mom will receive eternal blessings not only in this lifetime, but in all lifetimes to come.

Next Prev Top Back to Table of Contents