Back to Table of Contents Next: The document element tags

Document processing with mom

Table of contents



Introduction to document processing

Document processing with mom uses markup tags to identify document elements such as headings, paragraphs, blockquotes, and so on. The tags are, of course, macros, but with sensible, readable names that make them easy to grasp and easy to remember. (And don’t forget: if you don’t like the “official” name of a tag — too long, cumbersome to type in, not “intuitive” enough — you can change it with the ALIAS macro.)

In addition to the tags themselves, mom has an extensive array of macros that control how they look and behave.

Setting up a mom doc is a simple, four-part procedure. You begin by entering metadata about the document itself (title, subtitle, author, etc.). Next, you tell mom what kind of document you’re creating (e.g., chapter, letter, abstract, etc...) and what kind of output you want (typeset, typewritten, draft-style, etc) — essentially, templates. Thirdly, you make as many or as few changes to the templates as you wish; in other words, create a style sheet. Lastly, you invoke the START macro. Voilà! You’re ready to write.

Document defaults

As is to be expected, mom has defaults for everything. If you want to know a particular default, read about it in the description of the pertinent tag.

I fear the following may not be adequately covered in the documentation, so just in case:

Vertical whitespace management

Mom takes evenly-aligned bottom margins in running text very seriously. Only under a very few, exceptional circumstances will she allow a bottom margin to “hang” (ie to fall short).

Mom offers two modes of operation for ensuring flush bottom margins: shimming and flex-spacing. Shimming means that mom nudges the next line after a significant break in running text back onto the baseline grid (e.g., after the insertion of a graphic). Flex-spacing means that any vertical whitespace remaining between the end of running text and the bottom margin is distributed equally at logical points on the page.

Mom uses the leading of running text (the “document leading”) that’s in effect at the start of running text on each page to establish the grid and space document elements such as heads or blockquotes so that they adhere to it. (Prior to invoking START, the document leading is set with the typesetting macro LS, afterwards with the document control macro DOC_LEAD.)

What this means is that documents whose paragraphs are not separated by whitepace and which do not contain graphics or pre-processor material will fill the page completely to the bottom margin. However, if your paragraphs are spaced, or if there are any leading changes on a page, or if graphics or pre-processor material are inserted, it’s very likely the bottom margins will hang unless shimming or flex-spacing is enabled.

Shimming vs. flex-spacing

Shimming is mom's default mode of operation. She applies it automatically before headings, around quotes and blockquotes, and beneath floats and pre-processor material. In addition, the SHIM macro can be inserted into a document to make sure that the text following falls on the baseline grid.

This mode of operation works well in documents whose paragraphs are not spaced. Deviations from the baseline grid, usually caused by floats or pre-processor material, are corrected immediately. If the shimming results in slightly unbalanced whitespace around them, it can easily be remedied by passing the ADJUST argument to the appropriate macro.

If you do not want mom shimming automatically, NO_SHIM turns shimming off globally and suppresses the SHIM macro. If you want to disable shimming only for a particular float or pre-processor, the NO_SHIM argument may be given to the appropriate macro.

Flex-spacing kicks in automatically whenever you turn shimming off. In other words, if you want a document flex-spaced, .NO_SHIM is how you achieve it. If, in addition to not shimming, you don’t want mom flex-spacing either, NO_FLEX lets you disable it, too.

Flex-spacing differs from shimming in that mom doesn’t correct deviations from the baseline grid. Rather, she distributes whitespace left at the bottom of the page equally in appropriate places. Like shimming, flex-spacing is automatically applied before heads, after floats and pre-processor material, and around quotes and blockquotes. Like shimming, flex-spacing can be disabled for individual floats or pre-processor material with the NO_FLEX flag.

In addition, you can use the FLEX macro to insert flex-spacing yourself into the document, which you will almost certainly want to do if your paragraphs are spaced. This is because paragraphs are not flex-spaced. Typographically, the ideal for spaced paragraphs is that the space between them remain constant. Paradoxically, the only way to achieve flush bottom margins, or to correct excessive flex-spacing before a heading, is by adding flex-space between paragraphs. This requires human judgment, and mom does not presume to decide for you.

Shimming and flex-spacing are mutually exclusive. If the one is active, the other isn’t unless you have disabled both. This means that you cannot use the FLEX macro when shimming is enabled, or the SHIM macro when flex-spacing is enabled. Mom will issue a warning if you do.

The choice of whether to use shimming or flex-spacing depends on whether or not your paragraphs are spaced. In a document with indented, non-spaced paragraphs, shimming and flex-spacing produce nearly the same result, with shimming winning by an aesthetic hair. In documents with spaced paragraphs, flex-spacing is the only way to achieve flush bottom margins.

SHIM

Macro: SHIM

When shimming is enabled, which it is by default, the SHIM macro allows you to nudge the line following it back onto the baseline grid. In documents with non-spaced paragraphs, this prevents the bottom margins from hanging.

Mom herself automatically applies shimming

You may sometimes find the amount of space generated by SHIM looks too big, whether inserted manually into a document or as a result of automatic shimming. The situation occurs when the amount of shimming applied comes close to the leading currently in effect, making it seem as if there’s one linespace too much whitespace.

The solution is simply to add .SPACE -1v or .RLD 1v to the document immediately after .SHIM. (Both .SPACE -1v and .RLD 1v back up by one linespace.)

NO_SHIM

Macro: NO_SHIM <none> | <anything>

NO_SHIM, without an argument, disables automatic shimming, suppresses the SHIM macro, and enables flex-spacing.

NO_SHIM with any argument (e.g., OFF, QUIT, END, X, etc) re-enables shimming if it has been disabled and disables flex-spacing.

FLEX

Macro: FLEX [ FORCE ]

When flex-spacing is enabled, the FLEX macro inserts flexible vertical whitespace into a document. The amount of flex-space is determined from any extra whitespace at the bottom of a page divided by the number of flex points on the same page.

If flex-spacing is enabled, mom herself automatically applies flex-spacing

Near the bottom of some pages, you may find that floated or pre-proccesor material, including images, or a single line of text afterward, is not flush with the bottom margin. This is a result of mom flex-spacing after such material but not before. The solution to is insert .FLEX immediately beforehand.

There are some instances where mom inhibits flex-spacing, notably after outputting deferred floats and pre-processor material. Introducing FLEX by itself in these instances—say, before a head or paragraph—will not have any effect; you must pass FLEX the FORCE argument.

Important note on flex-spacing policy:
Mom disables flex-spacing on

If this is not what you want, insert .NO_FLEX OFF before the first flex-space point on the affected page or in the affected column.

Flex-spacing is also disabled for any page or column where insufficient room at or near the bottom causes a HEADING or table to be moved to the top of the next page. These situations cannot be harmonized with flex-spacing except by adjusting your layout to prevent them. You may try re-enabling flex-spacing for the page (.NO_FLEX OFF) and manually inserting flex-spaces at appropriate points, but the original whitespace is usually large enough that re-distributing it merely changes one layout gaffe into another.

Very occasionally you may notice that a document element (spaced paragraph, floated material, pre-processor material, or a PDF image) near the bottom of page has also caused mom to disable flex-spacing for that page. This occurs when the document element following it is a spaced paragraph.

It is typographically acceptable for there to be space between insertions in running text (e.g., an image) and the bottom margin when the next page begins with a paragraph. If you’d like to nudge the insertion a little closer to the bottom margin—not all the way; that isn’t possible without pushing it to the next page and disrupting subsequent flex-spacing—insert a small amount of space beforehand with SP. Do not, in these cases, use the ADJUST argument (for example to PDF_IMAGE.)

In the case of a spaced paragraph itself near the bottom of the page causing a break, re-enabling flex-spacing (.NO_FLEX OFF) at an appropriate place in your input file will resolve the issue, provided there is at least one flex-point on the page. If not, add one or more.

NO_FLEX

Macro: NO_FLEX <none> | <anything>

NO_FLEX, without an argument, disables automatic flex-spacing and suppresses the FLEX macro. If, in addition to NO_FLEX, NO_SHIM has also been given, your document will be neither flex-spaced nor shimmed.

NO_FLEX with any argument (e.g., OFF, QUIT, END, X, etc) re-enables flex-spacing if it has been disabled.


Preliminary document setup

Tutorial – Setting up a mom document

There are four parts to setting up a mom doc (three, actually, with one optional). Before we proceed, though, be reassured that something as simple as
.TITLE "By the Shores of Lake Attica" .AUTHOR "Rosemary Winspeare" .PRINTSTYLE TYPESET .START produces a beautifully typeset 8.5x11 document, with a docheader at the top of page 1, page headers with the title and author on subsequent pages, and page numbers at the bottom of each page. In the course of the document, headings, citations, quotes, epigraphs, and so on, all come out looking neat, trim, and professional.

For the purposes of this tutorial, we’re going to set up a short story—My Pulitzer Winner—by Joe Blow. Thankfully, we don’t have to look at story itself, just the setup. Joe wants the document

Joe Blow has no taste in typography. His draft won’t look pretty, but this is, after all, a tutorial; we’re after examples, not beauty.

Step 1

The first step in setting up any document is giving mom some reference information (metadata). The reference macros are:

  • TITLE
  • SUBTITLE
  • AUTHOR
  • CHAPTER – chapter number
  • CHAPTER_TITLE – chapter name
  • DRAFT – the draft number
  • REVISION – the revision number
  • COPYRIGHT – only used on cover pages
  • MISC – only used on cover pages
  • DOCTITLE
  • COVERTITLE
  • DOC_COVERTITLE
  • PDF_TITLE

You can use as many or as few as you wish, although at a minimum, you’ll probably fill in TITLE (unless the document’s a letter) and AUTHOR. Order doesn’t matter. You can separate the arguments from the macros by any number of spaces. The following are what you’d need to start Joe Blow’s story.
.TITLE "My Pulitzer Winner" .AUTHOR "Joe Blow" .DRAFT 7 .REVISION 39

Step 2

Once you’ve given mom the reference information she needs, you tell her how you want your document formatted. What kind of document is it? Should it be typeset or typewritten? Is this a final copy (for the world to see) or just a draft? Mom calls the macros that answer these questions “the docstyle macros”, and they're essentially templates.

Mom has defaults for DOCTYPE and COPYSTYLE; if they’re what you want, you don’t need to include them. However, PRINTSTYLE has no default and must be present in every formatted document. If you omit it, mom won’t process the document AND she’ll complain (both to stderr and as a single printed sheet with a warning). Moms—they can be so annoying sometimes. <sigh>

Adding to what we already have, the next bit of setup for Joe Blow’s story looks like this:
.TITLE "My Pulitzer Winner" .AUTHOR "Joe Blow" .DRAFT 7 .REVISION 39 \# .DOCTYPE DEFAULT \"Superfluous; mom uses DOCTYPE DEFAULT by default .PRINTSTYLE TYPESET .COPYSTYLE DRAFT Notice the use of the comment line ( \# ), a handy way to keep groups of macros visually separated for easy reading in a text editor.

Step 3

This step—completely optional—is where you, the user, take charge. Mom has reasonable defaults for every document element and tag, but who’s ever satisfied with defaults? Use any of the typesetting macros here to change mom’s document defaults (paper size, margins, family, point size, line space, rag, etc), or any of the document processing control macros. This is the style-sheet section of a document, and must come after the PRINTSTYLE directive. Failure to observe this condition will result in PRINTSTYLE overriding your changes.

Joe Blow wants his story printed in Helvetica, 12 on 14, rag right, with page footers instead of page headers and a single asterisk for the linebreak character. None of these requirements conforms to mom’s defaults for the chosen PRINTSTYLE (TYPESET), so we change them here. The setup for Joe Blow’s story now looks like this:
.TITLE "My Pulitzer Winner" .AUTHOR "Joe Blow" .DRAFT 7 .REVISION 39 \# .DOCTYPE DEFAULT .PRINTSTYLE TYPESET .COPYSTYLE DRAFT \# .FAMILY H .PT_SIZE 12 .LS 14 .QUAD LEFT \"ie rag right .FOOTERS .LINEBREAK_CHAR *

Step 4

The final step in setting up a document is telling mom to start document processing. It’s a no-brainer, just the single macro START. Other than PRINTSTYLE, it’s the only macro required for document processing.

Here’s the complete setup for My Pulitzer Winner:
.TITLE "My Pulitzer Winner" .AUTHOR "Joe Blow" .DRAFT 7 .REVISION 39 \# .DOCTYPE DEFAULT .PRINTSTYLE TYPESET .COPYSTYLE DRAFT \# .FAMILY H .PT_SIZE 12 .LS 14 .QUAD LEFT \"ie rag right .FOOTERS .LINEBREAK_CHAR * \# .START As pointed out earlier, Joe Blow is no typographer. Given that all he needs is a printed draft of his work, a simpler setup would have been:
.TITLE "My Pulitzer Winner" .AUTHOR "Joe Blow" .DRAFT 7 .REVISION 39 \# .PRINTSTYLE TYPEWRITE .COPYSTYLE DRAFT \# .START .PRINTSTYLE TYPEWRITE, above, means that Joe’s work will come out “typewritten, double-spaced”, making the blue-pencilling he (or someone else) is sure to do much easier (which is why many publishers and agents still insist on typewritten, double-spaced copy).

When J. Blow stops re-writing and decides to print off a final, typeset copy of his work for the world to see, he need only make two changes to the (simplified) setup:
.TITLE "My Pulitzer Winner" .AUTHOR "Joe Blow" .DRAFT 7 .REVISION 39 \# .PRINTSTYLE TYPESET \"first change .COPYSTYLE FINAL \"second change \# .START In the above, .DRAFT 7, .REVISION 39, and .COPYSTYLE FINAL are actually superfluous. The draft and revision numbers aren’t used when COPYSTYLE is FINAL, and COPYSTYLE FINAL is mom’s default unless you tell her otherwise.

But... to judge from the number of drafts already, J. Blow may very well decide his “final” version still isn’t up to snuff. Hence, he might as well leave in the superfluous macros. That way, when draft 7, rev. 62 becomes draft 8, rev. 1, he’ll be ready to tackle his Pulitzer winner again.


The reference macros (metadata)

The reference macros give mom the metadata she needs to generate docheaders, page headers, and covers. They must go at the top of any file that uses mom’s document processing macros.

Reference macros

TITLE

Macro: TITLE "<title string>" ["<2nd line>" ["<3rd line>" ... ] ]

• Arguments must be enclosed in double-quotes

The title string can be caps or caps/lower-case; it’s up to you. In PRINTSTYLE TYPESET, the title will appear in the docheader exactly as you typed it. However, mom converts the title to all caps in page headers unless you turn that feature off (see HEADER_<POSITION>_CAPS). In PRINTSTYLE TYPEWRITE, the title always gets converted to caps.

TITLE accepts multiple arguments, each surrounded by double-quotes. Each argument is printed on a separate line, permitting you to create multi-line titles in your docheaders.

Note: If your DOCTYPE is CHAPTER, TITLE should be the title of the opus, not “CHAPTER whatever”.

DOCUMENT TITLE

Macro: DOCTITLE "<overall document title>" ["<2nd line>" ["<3rd line>" ... ] ]

• Arguments must be enclosed in double-quotes

Note: This macro should be used only if your DOCTYPE is DEFAULT (which is mom’s default). If your DOCTYPE is CHAPTER, use TITLE to set the overall document title for cover pages, document cover pages, and page headers or footers.

When you’re creating a single document, say, an essay or a short story, you have no need of this macro. TITLE takes care of all your title needs.

However if you’re collating a bunch of documents together, say, to print out a report containing many articles with different titles, or a book of short stories with different authors, you need DOCTITLE.

DOCTITLE tells mom the title of the complete document (as opposed to the title of each article or entitled section), and appears

  1. as the window title in PDF viewers (e.g., Okular or Evince)
  2. in the initial rightmost position of page headers in the document

Moreover, DOCTITLE does not appear in the PDF outline, as its presence in window title would make it redundant.

The doctitle string can be caps or caps/lower-case; it’s up to you. In PRINTSTYLE TYPESET, by default, the doctitle in page headers is all in caps, unless you turn that feature off (see HEADER_<POSITION>_CAPS). In PRINTSTYLE TYPEWRITE, the doctitle always gets converted to caps.

DOCTITLE accepts multiple arguments, each surrounded by double-quotes. Each argument is printed on a separate line, permitting you to create multi-line document titles for use on Covers and/or Doc covers.

Note: If your DOCTYPE is CHAPTER, you don’t need DOCTITLE. TITLE takes care of everything.

SUBTITLE

Macro: SUBTITLE [COVER | DOC_COVER] "<subtitle>" ["<2nd line>" ["<3rd line>" ... ] ]

• String arguments must be enclosed in double-quotes

The subtitle string can be caps or caps/lower-case. I recommend caps/lower case.

SUBTITLE accepts multiple arguments, each surrounded by double-quotes. Each argument is printed on a separate line, permitting you to create multi-line subtitles.

If the optional argument, COVER or DOC_COVER, is given to SUBTITLE, the remaining string arguments represent the subtitle that will appear on cover or document cover pages (see the Introduction to cover pages for a description of the difference between “document covers” and “covers”). Thus, it is possible to have differing subtitles appear on the document cover, the cover (“title”) page, and in the document header. An extreme example would be:
.SUBTITLE "The Docheader Subtitle" .SUBTITLE DOC_COVER "The Document Cover Subtitle" .SUBTITLE COVER "The Cover Subtitle" The first invocation of .SUBTITLE establishes the subtitle that appears in the docheader at the top of the first page of a document. The second invocation establishes the subtitle that appears on the document cover; the third establishes the subtitle that appears on the cover (“title”) page.

If you don’t require differing subtitles for doc cover and cover pages, .SUBTITLE, without the optional first argument, is sufficient, provided you give the word, SUBTITLE, as an argument to the macro DOC_COVER or COVER

AUTHOR

Macro: AUTHOR [COVER | DOC_COVER] "<author>" [ "<author2>" ["<author3>" ... ] ]

Alias: EDITOR

• String arguments must be enclosed in double-quotes

Each author string can hold as many names as you like, e.g.,
.AUTHOR "Joe Blow" or
.AUTHOR "Joe Blow, Jane Doe" "John Hancock" Mom prints each string that’s enclosed in double-quotes on a separate line in the docheader, however only the first string appears in page headers. If you want mom to put something else in the author part of page headers (say, just the last names of a document’s two authors), redefine the appropriate part of the header (see header/footer control).

The strings can be caps or caps/lower-case. I recommend caps/lower case.

If the optional argument, COVER or DOC_COVER, is given to AUTHOR, the remaining string arguments represent the author(s) that will appear on cover or document cover pages (see the Introduction to cover pages for a description of the difference between “document covers” and “covers”). Thus, it is possible to have differing authors on the document cover, the cover (“title”) page, in the document first-page header and subsequent page headers/footers. An example might be:
.AUTHOR "Joe Blow" .EDITOR DOC_COVER "John Smith" "and" "Jane Doe" \" EDITOR is an alias for AUTHOR .AUTHOR COVER "Joe Blow" "(assisted by Jane Doe)" The first invocation of .AUTHOR establishes the author that appears in the docheader at the top of the first page of a document and in subsequent page headers/footers. The second invocation establishes the authors (editors, in this instance) that appear on the document cover; the third establishes the author(s) that appear(s) on the cover (“title”) page.

If you don’t require differing authors for doc cover and cover pages, .AUTHOR, without the optional first argument, is sufficient, provided you give the word, AUTHOR as an argument to the macro DOC_COVER or COVER

CHAPTER

Macro: CHAPTER <chapter number>

The chapter number can be in any form you like—a digit, a roman numeral, a word. If you choose DOCTYPE CHAPTER, mom prints whatever argument you pass CHAPTER beside the word, “Chapter”, as a single line docheader. She also puts the same thing in the middle of page headers.

Please note that if your argument to CHAPTER runs to more than one word, you must enclose the argument in double-quotes.

If you’re not using DOCTYPE CHAPTER, the macro can be used to identify any document as a chapter for the purpose of prepending a chapter number to numbered head elements, provided you pass it a numeric argument. See PREFIX_CHAPTER_NUMBER.

Chapter string

If you’re not writing in English, you can ask mom to use the word for “chapter” in your own language by telling her what it is with the CHAPTER_STRING macro, like this:
.CHAPTER_STRING "Chapître"

If you would like a blank chapter string, ie you’d like the chapter number to appear without “Chapter” beforehand, enter .CHAPTER_STRING "\&".

CHAPTER_TITLE

Macro: CHAPTER_TITLE "<chapter title>" ["<2nd line>" ["<3rd line>" ... ] ]

• Arguments must be enclosed in double-quotes

If, either in addition to or instead of “Chapter <n>” appearing at the top of chapters, you want your chapter to have a title, use CHAPTER_TITLE, with your title enclosed in double-quotes, like this:
.CHAPTER_TITLE "The DMCA Nazis"

CHAPTER_TITLE accepts multiple arguments, each surrounded by double-quotes. Each argument is printed on a separate line, permitting you to create multi-line chapter titles in your docheaders.

If you’ve used CHAPTER to give the chapter a number, both “Chapter <n>” and the chapter title will appear at the top of the chapter, like this:
Chapter 1 The DMCA Nazis In such a case, by default, only the chapter’s title will appear in the page headers, not “Chapter <n>”.

If you omit CHAPTER when setting up your reference macros, only the title will appear, both at the top of page one and in subsequent page headers.

The style of the chapter title can be altered by control macros, e.g., CHAPTER_TITLE_FAMILY, CHAPTER_TITLE_FONT, etc. The default family, font and point size are Times Roman, Bold Italic, 4 points larger than running text.

DRAFT

Macro: DRAFT <draft number>

DRAFT only gets used with COPYSTYLE DRAFT. If the COPYSTYLE is FINAL (the default), mom ignores DRAFT. DRAFT accepts both alphabetic and numeric arguments, hence it’s possible to do either
.DRAFT 2 or .DRAFT Two

Mom prints the argument to .DRAFT (ie the draft number) beside the word “Draft” in the middle part of page headers.

A small word of caution: If your argument to .DRAFT is more than one word long, you must enclose the argument in double-quotes.

You may, if you wish, invoke .DRAFT without an argument, in which case, no draft number will be printed beside “Draft” in headers or footers.

The draft string

If you’re not writing in English, you can ask mom to use the word for “draft” in your own language by telling her what it is with the DRAFT_STRING macro, like this:
.DRAFT_STRING "Jet"

Equally, DRAFT_STRING can be used to roll your own solution to something other than the word “Draft.” For example, you might want “Trial run alpha-three” to appear in the headers of a draft version. You’d accomplish this by doing
.DRAFT alpha-three .DRAFT_STRING "Trial run"

If you wanted only “Trial run” to appear, entering .DRAFT without an argument as well as .DRAFT_STRING "Trial run" is how you’d do it.

Note: If you define both a blank .DRAFT and a blank .DRAFT_STRING, mom skips the draft field in headers entirely. If this is what you want, this is also the only way to do it. Simply omitting invocations of .DRAFT and .DRAFT_STRING will result in mom using her default, which is to print “Draft <number>”.

REVISION

Macro: REVISION <revision number>

REVISION only gets used with COPYSTYLE DRAFT. If the COPYSTYLE is FINAL (the default), mom ignores the REVISION macro. REVISION accepts both alphabetic and numeric arguments, hence it’s possible to do either
.REVISION 2 or .REVISION Two

Mom prints the revision number beside the shortform “Rev.” in the middle part of page headers.

A small word of caution: If your argument to .REVISION is more than one word long, you must enclose the argument in double-quotes.

You may, if you wish, invoke .REVISION without an argument, in which case, no revision number will be printed beside “Rev.” in headers or footers.

The revision string

If you’re not writing in English, you can ask mom to use the word for “revision,” or a shortform thereof, in your own language by telling her what it is with the REVISION_STRING macro, like this:
.REVISION_STRING "Rév."

Additionally, you may sometimes want to make use of mom’s COPYSTYLE DRAFT but not actually require any draft information. For example, you might like mom to indicate only the revision number of your document. The way to do that is to define an empty .DRAFT and .DRAFT_STRING in addition to .REVISION, like this:
.DRAFT .DRAFT_STRING .REVISION 2

Equally, if you want to roll your own solution to what revision information appears in headers, you could do something like this:
.DRAFT .DRAFT_STRING .REVISION "two-twenty-two" .REVISION_STRING "Revision"

The above, naturally, has no draft information. If you want to roll your own .DRAFT and/or .DRAFT_STRING as well, simply supply arguments to either or both.

Macro: COPYRIGHT [COVER | DOC_COVER] "<copyright info>"

• Argument must be enclosed in double-quotes

The argument passed to COPYRIGHT is only used on cover or doc cover pages, and then only if the argument COPYRIGHT is passed to COVER or DOC_COVER. Do not include the copyright symbol in the argument passed to COPYRIGHT; mom puts it in for you.

If the optional argument, COVER or DOC_COVER, is given to COPYRIGHT, the string argument represents the copyright information that will appear on cover or document cover pages (see the Introduction to cover pages for a description of the difference between “document covers” and “covers”). Thus, it is possible to have differing copyright information on the document cover and on the cover (“title”) page. An example might be:
.COPYRIGHT DOC_COVER "2010 John Smith and Jane Doe" .COPYRIGHT COVER "2008 Joe Blow" The first invocation of .COPYRIGHT establishes the copyright information that appears on the document cover; the second establishes the copyright information that appears on the cover (“title”) page.

If you don’t require differing copyright information for doc cover and cover pages, .COPYRIGHT, without the optional first argument, is sufficient, provided you give the word, COPYRIGHT, as an argument to the macro DOC_COVER or COVER

Style parameters for the copyright line may be entered as individual macros or grouped, e.g.,
.COPYRIGHT_FAMILY H .COPYRIGHT_FONT R .COPYRIGHT_SIZE -2 or
.COPYRIGHT_STYLE \ FAMILY H \ FONT R \ SIZE -2 The vertical position of the copyright line may be raised (-) or lowered (+) with the macro COPYRIGHT_V_ADJUST. For example, to raise the copyright line by 3 points, you’d do
.COPYRIGHT_V_ADJUST -3p Alternatively, the COPYRIGHT_STYLE macro may be used with the argument V_ADJUST: .COPYRIGHT_STYLE \ FAMILY H \ FONT R \ SIZE -2 \ V_ADJUST -3p

MISC

Macro: MISC [COVER | DOC_COVER] "<argument 1>" ["<argument 2>" "<argument 3>" ...]

• String arguments must be enclosed in double-quotes

The argument(s) passed to MISC are only used on cover or doc cover pages, and then only if the argument MISC is passed to COVER or DOC_COVER. MISC can contain any information you like. Each argument appears on a separate line at the bottom of the cover or doc cover page.

For example, if you’re submitting an essay where the prof has requested that you include the course number, his name and the date, you could do
.MISC "Music History 101" "Professor Hasbeen" "Dec. 24, 2010" and the information would appear on the essay’s cover page.

If the optional argument, COVER or DOC_COVER, is given to MISC, the string arguments represent the miscellaneous information that will appear on cover or document cover pages (see the Introduction to cover pages for a description of the difference between “document covers” and “covers”). Thus, it is possible to have differing miscellaneous information on the document cover and on the cover (“title”) page. An example might be:
.MISC DOC_COVER "Music History 101" "Professor Hasbeen" .MISC COVER "Spring Term Paper"

The first invocation of .MISC establishes the miscellaneous information that appears on the document cover; the second establishes the miscellaneous information that appears on the cover (“title”) page.

If you don’t require differing miscellaneous information for doc cover and cover pages, .MISC, without the optional first argument, is sufficient, provided you give the word “MISC” as an argument to the macro DOC_COVER or COVER

COVERTITLE & DOC_COVERTITLE

Macro: COVERTITLE "<user defined cover page title>" ["<2nd line>" ["<3rd line>" ... ] ]

• Arguments must be enclosed in double-quotes

Macro: DOC_COVERTITLE "<user defined document cover page title>" ["<2nd line>" ["<3rd line>" ... ] ]

• Arguments must be enclosed in double-quotes

The arguments passed to COVERTITLE or DOC_COVERTITLE are only used on cover or doc cover pages, and then only if the argument COVERTITLE or DOC_COVERTITLE is passed to COVER or DOC_COVER.

The only time you require a COVERTITLE or DOC_COVERTITLE is when none of the required first arguments to COVER or DOC_COVER fits your needs for the title you want to appear on cover (or doc cover) pages.

COVERTITLE and DOC_COVERTITLE accept multiple arguments, each surrounded by double-quotes. Each argument is printed on a separate line, permitting you to create multi-line titles on your cover and/or doc cover pages.

PDF Title

Macro: PDF_TITLE "<pdf viewer window title>"

• Arguments must be enclosed in double-quotes

Except for DOCTITLE, mom does not, by default, provide PDF viewers with a document title. You may set one, if you like, with PDF_TITLE.


The docstyle macros

The docstyle macros tell mom what type of document you’re writing, whether you want the output typeset or “typewritten, double-spaced”, and whether you want a draft copy (with draft and revision information in the headers) or a final copy.

Docstyle macros

DOCTYPE

Macro: DOCTYPE DEFAULT | CHAPTER | NAMED "<name>" | LETTER | SLIDES

The arguments DEFAULT, CHAPTER and NAMED tell mom what to put in the docheader and page headers. LETTER and SLIDES tells her you want to write a letter or create slides.

Mom’s default DOCTYPE is DEFAULT. If that’s what you want, you don’t have to give a DOCTYPE command.

DEFAULT prints a docheader containing the title, subtitle and author information given to the reference macros, and page headers with the author and title. (See Default specs for headers for how mom outputs each part of the page header.)

CHAPTER prints “Chapter <n>” in place of a docheader (<n> is what you gave to the reference macro, CHAPTER). If you give the chapter a title with CHAPTER_TITLE, mom prints “Chapter <n>” and the title underneath. If you omit the CHAPTER reference macro but supply a CHAPTER_TITLE, mom prints only the chapter title.

The page headers in DOCTYPE CHAPTER contain the author, the title of the book (which you gave with TITLE), and “Chapter <n>” (or the chapter title). See Default Specs for Headers for mom’s default type parameters for each part of the page header.

NAMED takes an additional argument: a name for this particular kind of document (e.g., outline, synopsis, abstract, memorandum), enclosed in double-quotes. NAMED is identical to DEFAULT except that mom prints the argument to NAMED beneath the docheader, as well as in page headers. (See Default specs for headers for how mom outputs each part of the page header.)

Note: version 2.1 change
DOCTYPE NAMED "string" no longer accepts a color argument after "string". Setting the color of the string is now done with DOCTYPE_COLOR <color>. Default underscoring of "string" in the docheader and on covers has been removed. Use DOCTYPE_UNDERLINE, DOC_COVER_DOCTYPE_UNDERLINE and/or COVER_DOCTYPE_UNDERLINE to re-enable it. All three take the same arguments listed in the Underline style, rule weight section of Arguments to the control macros.

LETTER tells mom you’re writing a letter. See the section Writing Letters for instructions on using mom to format letters.

Slides

PDF slides are a special kind of mom document, formatted for viewing in a PDF reader’s presentation mode. In most respects, they behave identically to the other document types. Key differences are:

DOCTYPE SLIDES takes up to five optional arguments, which come immediately after SLIDES. They may be entered in any order.
DOCTYPE SLIDES \ ASPECT 4:3 | 16:9 \ HEADER "left" "centre" "right" \ FOOTER "left" "centre" "right" \ TRANSITION "<slide transition effect>" (mode + parameters) \ PAUSE "<text reveal effect>" (mode + parameters) For convenience, you many want to enter each argument on a single line as shown above; all but the last must be terminated by a backslash.

Aspect

Slides can be formatted for one of two aspect ratios common to monitors and screens: 4:3 and 16:9. The default is 16:9. 4:3 16:9 media size: 11" x 8.25" media size: 11" x 8.1875" left/right margins: 36 points left/right margins: 36 points top margin: 90 points top margin: 80 points bottom margin: 84 points bottom margin: 72 points base text size: 16 points base text size: 14 points autoleading: 6 points, adjusted autoleading: 4 points, adjusted (header/footer size: -3 points) (header/footer size: -2 points) Note that both media sizes fit on either A4 or US LETTER papersizes.

Headers, footers, and pagination

If you want a header, footer, or both for your slides, pass SLIDES the HEADER and/or FOOTER argument(s). Both take three additional string arguments, which must be enclosed in double-quotes, defining the left, centre, and right parts of the header/footer. Any parts you want left blank should be entered as two double-quotes. For example, HEADER "" "My slide presentation" "" will result in a header with only the centre part.

Normal pagination is disabled for slides. If you want your slides numbered, the slide number must be given to one of the header/footer parts with the inline escape
\*[SLIDE#]. For example: HEADER "" "My slide presentation" "" \ FOOTER "" "" "\*[SLIDE#]" will give you a centred header with numbering at the bottom right of the slide.

The overall family, size, and colour of headers may be set with HEADER_FAMILY, HEADER_SIZE, and HEADER_COLOR. If you request FOOTERS, you may use the FOOTER_ equivalent of these macros. If you request both headers and footers, use one or the other but not both. For example, in a header/footer situation, HEADER_FAMILY would determine the family for both headers and footers, but if you attempted to do this .HEADER_FAMILY T .FOOTER_FAMILY H FOOTER_FAMILY would take precedence, and your header family would be “H”.

All other formatting of individual header/footer parts must be entered as inline escapes inside the double-quotes. If you want, say, your headers to be red but your footer page numbering to be black and two points larger, this is how you’d do it: .HEADER_COLOR red .DOCTYPE SLIDES \ HEADER "" "My slide presentation" "" \ FOOTER "" "" "\*[black]\*S[+2]\*[SLIDE#]\*S[-2]"

Note: Do not use mom’s \*[SIZE ±n] inline escape to change point size in the strings passed to HEADER or FOOTER. Prefer either mom’s \*S[±n] or groff's \s[±n].

Transition

“Transition” refers to how new slides appear during a presentation. The official PDF specification lists a number of modes, each with a choice of configurable parameters. Modes include Box, Blinds, Wipe, Fade, and several others. Parameters include things like duration, dimension, and direction. There are a total of twelve modes; for each one there are from one to six configurable parameters. Consult man gropdf(1) for a complete listing of modes and parameters.

If you pass SLIDES the TRANSTION argument, you must at a minimum follow it with a mode. Afterwards, you may give as many or as few parameters as you wish. Parameters are, in order, 1. duration 2. dimension 3. motion 4. direction 5. scale 6. bool You don't have to fill them all out. If you only need the first three, that's all you need to input. If you need the first and third, enter the second as a period (dot), which is used any time you want to leave a parameter at its current default or when it isn’t applicable. For example, if you want a Box transition that lasts 1 second, filling the screen from the centre outwards, you'd enter TRANSITION "Box 1 . O" because Box does not take a “dimension” parameter but it does take a motion parameter.

Notice that the entire string (mode+parameters) must be enclosed in double-quotes.

Note: Not all PDF viewers support all modes. Any that are not supported are replaced by the “R” mode, which simply replaces one slide with the next unless the PDF viewer has a different default transition mode.

Pause

A “pause” occurs when material on a slide is halted (see PAUSE), awaiting a mouse click, PgDown, Next, or the spacebar to reveal subsequent material. All the same modes and parameters as TRANSITION may be used. The manner of entering them is is identical, including that the entire mode+parameter string must be enclosed in double-quotes.

SLIDE MACROS

Macro: NEWSLIDE ["<transition mode and parameters>"]

Unless you want material from one slide to flow onto the next, you need to tell mom when to start a new slide with the macro NEWSLIDE. Without any arguments, the new slide will appear with the default TRANSTION you gave to DOCTYPE SLIDES.

If you would like a different transition, you may pass NEWSLIDE a new mode and associated parameters, following the same rules as the TRANSITION argument to DOCTYPE. Note that the new effect becomes the default. If you wish to return to the original transition, you must give it explicitly to the appropriate NEWSLIDE.

Macro: PAUSE ["<pause mode and parameters>"]

Pauses in slides are accomplished by entering the macro PAUSE at desired locations in your input file. Subsequent material will be revealed using the pause mode given to DOCTYPE SLIDES.

If you would like a different mode, you may pass PAUSE a new mode and associated parameters, following the same rules as the PAUSE argument to DOCTYPE.

Macro: TRANSITION ["<transition mode and parameters>"]

If for some reason you have material that flows from one slide to the next and you want the next slide to have a transition different from the current one, you can tell mom about the new transition with the macro TRANSITION anywhere prior to the break to the next slide.

Printing slides

If you want to print slides as handouts, you have to tell pdfmom or gropdf, otherwise printing will stop at the first pause. Simply precede pdfmom or gropdf with GROPDF_NOSLIDE=1, like this:
GROPDF_NOSLIDE=1 pdfmom <options> slidefile.mom > slidefile.pdf

PRINTSTYLE

Macro: PRINTSTYLE TYPESET | TYPEWRITE [ SINGLESPACE ]

• Required for document processing, except in the case of slides
Must come before any changes to default document style

PRINTSTYLE tells mom whether to typeset a document, or to print it out “typewritten, doubled-spaced”.

Important: This macro may not be omitted. In order for document processing to take place, mom requires a PRINTSTYLE. If you don’t give one, mom will warn you on stderr and print a single page with a nasty message.

Just as important: PRINTSTYLE must precede any and all page and style parameters associated with a document with the exception of PAPER, PAGEWIDTH, and/or PAGELENGTH, which should be placed at the top of your file. PRINTSTYLE sets up complete templates that include default margins, family, fonts, point sizes, and so on. Therefore, changes to any aspect of document style must come afterwards. For example,
.PAPER A4 .LS 14 .QUAD LEFT .PRINTSTYLE TYPESET will not change mom’s default document leading to 14 points, nor the default justification style (fully justified) to left justified, whereas
.PAPER A4 .PRINTSTYLE TYPESET .LS 14 .QUAD LEFT will.

TYPESET, as the argument implies, typesets documents (by default in Times Roman; see TYPESET defaults). You have full access to all the typesetting macros as well as the style control macros of document processing.

With TYPEWRITE, mom does her best to reproduce the look and feel of typewritten, double-spaced copy (see TYPEWRITE defaults). Control macros and typesetting macros that alter family, font, point size, and leading are (mostly) ignored. An important exception is HEADER_SIZE (and, by extension, FOOTER_SIZE), which allows you to reduce the point size of headers/footers should they become too crowded. Most of mom’s inlines affecting the appearance of type are also ignored (\*S[<size>] is an exception; there may be a few others).

In short, TYPEWRITE never produces effects other than those available on a typewriter. Don’t be fooled by how brainless this sounds; mom is remarkably sophisticated when it comes to conveying the typographic sense of a document within the confines of TYPEWRITE.

The primary uses of TYPEWRITE are: outputting hard copy drafts of your work (for editing) and producing documents for submission to publishers and agents who (wisely) insist on typewritten, double-spaced copy. To get a nicely typeset version of work that’s in the submission phase of its life (say, to show fellow writers for critiquing), simply change TYPEWRITE to TYPESET and print out a copy.

If, for some reason, you would prefer the output of TYPEWRITE single-spaced, pass PRINTSTYLE TYPEWRITE the optional argument, SINGLESPACE.

PRINTSTYLE TYPESET defaults

Family = Times Roman Point size = 12.5 Paragraph leading = 16 points, adjusted Fill mode = justified Hyphenation = enabled max. lines = 2 margin = 36 points interword adjustment = 1 point Kerning = enabled Ligatures = enabled Smartquotes = enabled Word space = groff default Sentence space = 0

PRINTSTYLE TYPEWRITE defaults

Family = Courier Italics = underlined Point size = 12 Paragraph leading = 24 points, adjusted; 12 points for SINGLESPACE Fill mode = left Hyphenation = disabled Kerning = disabled Ligatures = disabled Smartquotes = disabled Word space = groff default Sentence space = groff default Columns = ignored

PRINTSTYLE TYPEWRITE control macros

Family

If you’d prefer a monospace family for PRINTSTYLE TYPEWRITE other than than mom's default, Courier, you can change it with .TYPEWRITER_FAMILY <family> (or .TYPEWRITER_FAM). Since groff ships with only the Courier family, you will have to install any other monospace family yourself. See Adding fonts to groff.

Point size

If you’d like a smaller or larger point size for for PRINTSTYLE TYPEWRITE (mom’s default is 12-point), you can change it with .TYPEWRITER_SIZE <size>. There’s no need to add a unit of measure to the <size> argument; points is assumed. Be aware, however, that regardless of point size, mom’s leading/linespacing for TYPEWRITE is fixed at 24-point for double-spaced, and 12-point for single-spaced.

Underlining of italics

In PRINTSTYLE TYPEWRITE, mom, by default, underlines anything that looks like italics. This includes the \*[SLANT] inline escape for pseudo-italics.

If you’d prefer that mom were less bloody-minded about pretending to be a typewriter (ie you’d like italics and pseudo-italics to come out as italics), use the control macros
.ITALIC_MEANS_ITALIC and .SLANT_MEANS_SLANT Neither requires an argument.

Although it’s unlikely, should you wish to reverse the sense of these macros in the midst of a document, .UNDERLINE_ITALIC and .UNDERLINE_SLANT restore underlining of italics and pseudo-italics.

Additionally, by default, mom underlines quotes (but not blockquotes) in PRINTSTYLE TYPEWRITE. If you don’t like this behaviour, turn it off with
.UNDERLINE_QUOTES OFF

To turn underlining of quotes back on, use UNDERLINE_QUOTES without an argument.

While most of the control macros have no effect on PRINTSTYLE TYPEWRITE, there is an important exception: HEADER_SIZE (and by extension, FOOTER_SIZE). This is particularly useful for reducing the point size of headers/footers should they become crowded (quite likely to happen if the title of your document is long and your COPYSTYLE is DRAFT).

COPYSTYLE

Macro: COPYSTYLE DRAFT | FINAL

Mom’s default COPYSTYLE is FINAL, so you don’t have to use this macro unless you want to.

COPYSTYLE DRAFT exhibits the following behaviour:

  1. Documents start on page 1, whether or not you request a different starting page number with PAGENUMBER.
  2. Page numbers are set in lower case roman numerals.
  3. The draft number supplied by DRAFT and a revision number, if supplied with REVISION (see reference macros), appear in the centre part of page headers (or footers, depending on which you’ve selected) along with any other information that normally appears there.

Important: If you define your own centre part for page headers with HEADER_CENTER, no draft and/or revision number will appear there. If you want draft and revision information in this circumstance, use DRAFT_WITH_PAGENUMBER.

COPYSTYLE FINAL differs from DRAFT in that:

  1. It respects the starting page number you give the document.
  2. Page numbers are set in normal (Arabic) digits.
  3. No draft or revision number appears in the page headers.

Note: The centre part of page headers can get crowded, especially with DOCTYPE CHAPTER and DOCTYPE NAMED, when the COPYSTYLE is DRAFT. Three mechanisms are available to overcome this problem. One is to reduce the overall size of headers (with HEADER_SIZE). Another, which only works with PRINTSTYLE TYPESET, is to reduce the size of the header’s centre part only (with HEADER_CENTER_SIZE). And finally, you can elect to have the draft/revision information attached to page numbers instead of having it appear in the centre of page headers (see DRAFT_WITH_PAGENUMBER).


Initiate document processing

In order to use mom’s document element macros (tags), you have to tell her you want them. The macro to do this is START.

START collects the information you gave mom in the setup section at the top of your file (see Tutorial – Setting up a mom document), merges it with her defaults, sets up headers and page numbering, and prepares mom to process your document using the document element tags. No document processing takes place until you invoke .START.

START

Macro: START

• Required for document processing

START takes no arguments. It simply instructs mom to begin document processing. If you don’t want document processing (ie you only want the typesetting macros), don’t use START.

At a barest minimum before START, you must enter a PRINTSTYLE command.


Establishing typestyle and formatting parameters before START

In the third (optional) part of setting up a document (the stylesheet; see Tutorial – Setting up a mom document), you can use the typesetting macros to change mom’s document-wide defaults for margins, line length, family, base point size, leading, and justification style.

Two additional style concerns have to be addressed here (ie in macros before START): changes to the docheader, and whether you want you want the document’s nominal leading adjusted to fill pages fully to the bottom margin.

Type & formatting parameters before START

Behaviour of the typesetting macros before START

From time to time (or maybe frequently), you’ll want the overall look of a document to differ from mom’s defaults. Perhaps you’d like her to use a different family, or a different overall leading, or have different left and/or right page margins.

To accomplish such alterations, use the appropriate typesetting macros (listed below) after PRINTSTYLE and before START.

More than one user has, quite understandably, not fully grasped the significance of the preceding sentence. The part they’ve missed is after PRINTSTYLE.

Changes to any aspect of the default look and/or formatting of a mom document must come after PRINTSTYLE. For example, it might seem natural to set up page margins at the very top of a document with
.L_MARGIN 1i .R_MARGIN 1.5i However, when you invoke .PRINTSTYLE, those margins will be overridden. The correct place to set margins—and all other changes to the look of a document—is after PRINTSTYLE.

Important: Do not use the macros listed in Changing document-wide typesetting parameters after START prior to START; they are exclusively for use afterwards.

Meanings

When used before START, the typesetting macros, below have the following meanings:
L_MARGIN Left margin of pages, including headers/footers R_MARGIN Right margin of pages, including headers/footers T_MARGIN The point at which running text (ie not headers/footers or page numbers) starts on each page B_MARGIN* The point at which running text (ie not (see note) headers/footers or page numbers) ends on each page PAGE If you use PAGE, its final four arguments have the same meaning as L_ R_ T_ and B_MARGIN (above). LL The line length for everything on the page; equivalent to setting the right margin with R_MARGIN FAMILY The family of all type in the document PT_SIZE The point size of type in paragraphs; mom uses this to calculate automatic point size changes (e.g., for heads, footnotes, quotes, headers, etc) LS/AUTOLEAD** The leading used in paragraphs; all leading and spacing of running text is calculated from this QUAD/JUSTIFY Affects paragraphs only LEFT*** No effect RIGHT*** No effect CENTER*** No effect ------ *See FOOTER MARGIN AND BOTTOM MARGIN for an important warning **See DOC_LEAD_ADJUST ***See Special note

Other macros that deal with type style, or refinements thereof (KERN, LIGATURES, HY, WS, SS, etc.), behave normally. It is not recommended that you set up tabs or indents prior to START.

If you want to change any of the basic parameters (above) after START and have them affect a document globally (as if you’d entered them before START), you must use the macros listed in Changing document-wide style parameters after START.

Special note on LEFT, RIGHT and CENTER prior to START

In a word, these three macros have no effect on document processing when invoked prior to START.

All mom’s document element tags (PP, HEAD, BLOCKQUOTE, FOOTNOTE, etc.) except QUOTE set a fill mode as soon as they’re invoked. If you wish to turn fill mode off for the duration of any tag (with LEFT, RIGHT or CENTER) you must do so immediately after invoking the tag. Furthermore, the change affects only the current invocation of the tag. Subsequent invocations of the same tag for which you want the same change require that you invoke .LEFT, .RIGHT or .CENTER immediately after every invocation of the tag.

Including (sourcing) style sheets and files

If you routinely make the same changes to mom’s defaults in order to create similar documents in a similar style—in other words, you need a template— you can create style-sheet files and include, or "source", them into your mom documents with the macro INCLUDE. The right place for such style sheets is after PRINTSTYLE and before START.

Say, for example, in a particular kind of document, you always want main heads set in Helvetica Bold Italic, flush left, with no underscore. You’d create a file, let’s call it head-template, in which you’d place the pertinent HEAD control macros.
.HEADING_STYLE 1 \ FAMILY H \ FONT BI \ QUAD L \ NO_UNDERSCORE Then, in the preliminary document set-up section of your main file, you’d include the style sheet, or template, like this:
.TITLE "Sample Document .AUTHOR "Joe Blow .PRINTSTYLE TYPESET \# .INCLUDE head-template \# .START The blank comment lines ( \# ) aren’t required, but they do make your file(s) easier to read.

If the file to be included is in the same directory as the file you’re working, you simply enter the filename after .INCLUDE. If the file’s in another directory, you must provide a full path name to it. For example, if you’re working in a directory called /home/joe/stories and your style-sheet is in /home/joe/style-sheets, the above example would have to look like this:
.TITLE "Sample Document .AUTHOR "Joe Blow .PRINTSTYLE TYPESET \# .INCLUDE /home/joe/style-sheets/head-template \# .START

INCLUDE is not restricted to style sheets or templates. You can include any file at any point into a document, provided the file contains only text and valid groff or mom formatting commands. Neither is INCLUDE restricted to use with mom’s document processing macros. You can use it in plain typeset documents as well.

Experts: INCLUDE is an alias for the groff request, .so. Mix 'n' match with impunity.

Initializing colours

Although it doesn’t really matter where you define/initialize colours for use in document processing (see NEWCOLOR and XCOLOR in the section Coloured text), I recommend doing so before you begin document processing with START.

The macro COLOR and the inline escape, \*[<colorname>] can be used at any time during document processing for occasional colour effects. However, consistent and reliable colourizing of various document elements (the docheader, heads, linebreaks, footnotes, pagenumbers, and so on) must be managed through the use of the document element control macros.

Note: If you plan to have mom generate a table of contents, do not embed colour inline escapes (\*[<colorname>]) in the string arguments given to any of the reference macros, nor in the string arguments given to HEADING. Use, rather, the control macros mom provides to automatically colourize these elements.

Adjust linespacing to fill pages and align bottom margins

Macro: DOC_LEAD_ADJUST toggle

• Must come after LS or AUTOLEAD and before START

DOC_LEAD_ADJUST is a special macro to adjust document leading so that bottom margins fall precisely where you expect.

When you invoke .DOC_LEAD_ADJUST, mom takes the number of lines that fit on the page at your requested leading, then incrementally adds machine units to the leading until the maximum number of lines at the new leading that fit on the page coincides perfectly with the bottom margin of running text.

In most instances, the difference between the requested lead and the adjusted lead is unnoticeable, and since in almost all cases adjusted leading is what you want, it’s mom’s default and you don't have to invoke it explicitly.

However, should you not want adjusted document leading, you must turn it off manually, like this:
.DOC_LEAD_ADJUST OFF

If you set the document leading prior to START with LS or AUTOLEAD, DOC_LEAD_ADJUST OFF must come afterwards, like this:
.LS 12 .DOC_LEAD_ADJUST OFF In this scenario, the maximum number of lines that fit on a page at a leading of 12 points determine where mom ends a page. The effect will be that last lines usually fall (slightly) short of the “official” bottom margin.

In PRINTSTYLE TYPEWRITE, the leading is always adjusted and can’t be turned off.

Note: DOC_LEAD_ADJUST, if used, must be invoked after LS or AUTOLEAD and before START.

Additional note: Even if you disable DOC_LEAD_ADJUST, mom will still adjust the leading of endnotes pages and toc pages. See ENDNOTE_LEAD and TOC_LEAD for an explanation of how to disable this default behaviour.

Managing the docheader

Macro: DOCHEADER <toggle> [ distance to advance from top of page ] [ NO_SHIM ]

• Must come before START; distance requires a unit of measure

By default, mom prints a docheader on the first page of any document (see below for a description of the docheader). If you don’t want a docheader, turn it off with
.DOCHEADER OFF DOCHEADER is a toggle macro, so the argument doesn’t have to be OFF; it can be anything you like.

If you turn the docheader off, mom, by default, starts the running text of your document on the same top baseline as all subsequent pages. If you’d like her to start at a different vertical position, give her the distance you’d like as a second argument.
.DOCHEADER OFF 1.5i This starts the document 1.5 inches from the top of the page PLUS whatever spacing adjustment mom has to make in order to ensure that the first baseline of running text falls on a “valid” baseline (ie one that ensures that the bottom margin of the first page falls where it should). The distance is measured from the top edge of the paper to the baseline of the first line of type.

With DOCHEADER OFF, it is possible to create your own custom docheaders (after START) using mom’s typesetting macros. It is recommended that if you do create a custom docheader, you make .SHIM the last macro before the first item of your document (for example, PP or HEADING 1.

Note: You may have tried DOCHEAHER OFF with a distance argument and discovered that mom will not budge the starting position of the document from her chosen default location. This is byproduct of shimming, which mom always applies before the first line of running text after the docheader, regardless of which vertical whitespace management strategy is in effect. If you encounter the problem, pass DOCHEADER OFF <distance> the additional final argument, NO_SHIM.

Docheader control: How to change the look of docheaders

In PRINTSTYLE TYPEWRITE, the look of docheaders is carved in stone. In PRINTSTYLE TYPESET, however, you can make a lot of changes. Macros that alter docheaders must come before START.

Docheader description

A typeset docheader has the following characteristics:

TITLE bold, 3.5 points larger than running text (not necessarily caps) Subtitle medium, same size as running text by medium italic, same size as running text Author(s) medium italic, same size as running text (Document type) bold italic, 3 points larger than running text

Or, if the DOCTYPE is CHAPTER,

Chapter <n> bold, 4 points larger than running text Chapter Title bold italic, 4 points larger than running text

The family is the prevailing family of the whole document. Title, subtitle, author and document type are what you supply with the reference macros. Any you leave out will not appear; mom will compensate:

Note: If your DOCTYPE is CHAPTER and you have both “Chapter <n>” and a “Chapter Title” (as above), mom inserts a small amount of whitespace between them, equal to one-quarter of the leading in effect. If this doesn’t suit you, you can remove or alter the space with CHAPTER_TITLE_SPACE_BEFORE.

Docheader control

With the docheader control macros, you can change the family, colour, leading and quad direction of the entire docheader. You can also set the style parameters for each part individually. Style parameters include family, font, size, colour, lead, space before, caps, smallcaps and underscoring.

1. Changes to the whole docheader

Change the starting position of the docheader

By default, a docheader starts on the same baseline as running text. If you’d like it to start somewhere else, use the macro DOCHEADER_ADVANCE and give it the distance you want (measured from the top edge of the paper to the first baseline of the docheader), like this:
.DOCHEADER_ADVANCE 4P A unit of measure is required.

Note: If HEADERS are OFF, mom’s normal top margin for running text (7.5 picas) changes to 6 picas (visually approx. 1 inch). Since the first baseline of the docheader falls on the same baseline as the first line of running text (on pages after page 1), you might find the docheaders a bit high when headers are off. Use DOCHEADER_ADVANCE to place them where you want.

Change the quad direction of the docheader

By default, mom centres the docheader. If you’d prefer to have your docheaders set flush left or right, or need to restore the default centreing, invoke .DOCHEADER_QUAD with the quad direction you want, either LEFT (or L), RIGHT (or R) or CENTER (or C).

Change the family of the entire docheader

By default, mom sets the docheader in the same family used for running text. If you’d prefer to have your docheaders set in a different family, invoke .DOCHEADER_FAMILY with the family you want. The argument to DOCHEADER_FAMILY is the same as for FAMILY.

For example, mom’s default family for running text is Times Roman. If you’d like to keep that default, but have the docheaders set entirely in Helvetica,
.DOCHEADER_FAMILY H is how you’d do it.

Please note that if you use DOCHEADER_FAMILY, you can still alter the family of individual parts of the docheader.

Change the color of the entire docheader

The default color for docheaders is black, as you’d expect. If you wish to change it, use .DOCHEADER_COLOR <color>, where  <color> is a color pre-initialized with XCOLOR or NEWCOLOR.

Change the leading of the entire docheader

By default, mom uses the leading in effect for running text for docheaders. If you want to increase or decrease the overall docheader leading, use .DOCHEADER_LEAD +|-<amount>, where <amount> is the number of points by which to make the adjustment.

2. Part by part changes

Whenever you want to change the style parameters for any part of the docheader, simply join the name of the part to the parameter you wish to change using an underscore, then supply any necessary arguments. The subitle double-underlined? No problem.
.SUBTITLE_UNDERLINE DOUBLE Author in red?
.AUTHOR_COLOR red Title in smallcaps? .TITLE_SMALLCAPS

Note: Use ATTRIBUTE as the part name for the attribution string (“by”) that precedes the author, and DOCTYPE as the name for the string passed to DOCTYPE NAMED "string".

List of parameters with arguments
_FAMILY
Takes the same argument as FAMILY.
_FONT
Takes the same argument as FT.
_SIZE
Takes a + or - value relative to the size of running text.
_COLOR
Takes the same argument as COLOR. Colors should be pre-initialized with XCOLOR or NEWCOLOR.
_LEAD
Takes an absolute leading value, i.e. not relative to the overall leading of the docheader. The leading applies to multiple lines of type within the same docheader part, e.g. several authors or a long title that must be split over two lines. No unit of measure is required; points is assumed.
_SPACE
Takes a numeric value with a unit of measure appended to it. The value may be negative. This allows you to adjust the whitespace before a docheader part, for example if you want more whitespace between the title and the author. Note that TITLE does not have a _SPACE parameter; use DOCHEADER_ADVANCE to move the title further down on the page.
_CAPS
Capitalizes the entire docheader part. No argument is required.
_NO_CAPS
Only used if you need to reverse the sense of _CAPS, as can sometimes happen when collating documents that have differing docheader style requirements.
_SMALLCAPS
Set the entire docheader part in smallcaps. No argument is required.
_NO_SMALLCAPS
Only used if you need to reverse the sense of _SMALLCAPS, as can sometimes happen when collating documents that have differing docheader style requirements.
_UNDERSCORE
With no argument, underscores the docheader part. With a single, possibly decimal numeric argument, sets the weight of the underscore. A second numeric argument to which a unit of measure is appended (most likely p) sets the distance between the baseline and the underscore. If the argument DOUBLE is given, double underscores the docheader part. With a single, possibly decimal numeric argument afterwards, sets the weight of the underscore rules. A third numeric argument to which a unit of measure is appended (most likely p) sets the distance between the baseline and the first underscore rule. A fourth numeric argument to which a unit of measure is appended sets the distance between the two underscore rules. You may give _UNDERLINE as the parameter instead of _UNDERSCORE if you prefer.
NO_UNDERSCORE
Only used if you need to reverse the sense of _UNDERSCORE, as can sometimes happen when collating documents that have differing docheader style requirements.
Grouping part/parameter changes

If you want to change several parameters for a particular docheader part, you may group the changes together in a single macro by joining the name of the part to STYLE with an underscore, for example TITLE_STYLE or AUTHOR_STYLE. The following demonstrates: .CHAPTER_TITLE_STYLE \ FAMILY T \ SIZE +4 \ UNDERSCORE 2 \ SMALLCAPS Notice the use of the backslash character, which is required after the macro name and all parameters except the last. Grouping reduces clutter and the finger fatigue caused by entering .CHAPTER_TITLE_FAMILY T .CHAPTER_TITLE_SIZE +4 .CHAPTER_TITLE_UNDERSCORE 2 .CHAPTER_TITLE_SMALLCAPS

3. Changing or removing the attribution string (“by”)

If you’re not writing in English, you can change what mom prints where “by” appears in docheaders. For example,
.ATTRIBUTE_STRING "par" changes “by” to “par”. ATTRIBUTE_STRING can also be used, for example, to make the attribution read “Edited by”.

If you don’t want an attribution string at all, simply pass ATTRIBUTE_STRING an empty argument, like this:
.ATTRIBUTE_STRING "" Mom will deposit a blank line where the attribution string normally appears.

If the optional argument, COVER or DOC_COVER, is given to ATTRIBUTE_STRING, the string argument represents the attribution string that will appear on cover or document cover pages (see the Introduction to cover pages for a description of the difference between “document covers” and “covers”). Thus, it is possible to have different attribution strings on the document cover page, the cover (“title”) page, and in the first-page docheader. An extreme example would be:
.ATTRIBUTE_STRING "" .ATTRIBUTE_STRING DOC_COVER "Edited by" .ATTRIBUTE_STRING COVER "by" The first invocation of .ATTRIBUTE_STRING establishes a blank attribution string that will be incorporated in the first-page docheader. The second will print “Edited by” on the document cover; the third will print “by” on the cover (“title”) page.

If you don’t require differing attribute strings for doc cover pages, cover pages, or the first-page docheader, .ATTRIBUTE_STRING, without either of the optional first arguments, is sufficient.


Setting documents in columns

Setting documents in columns is easy with mom. All you have to do is is say how many columns you want and how much space you want between them (the gutters). That’s it. Mom takes care of everything else, from soup to nuts.

Some words of advice

If you want your type to achieve a pleasing justification or rag in columns, reduce the point size of type (and probably the leading as well). Mom’s default document point size is 12.5, which works well across her default 39 pica full page line length, but with even just two columns on a page, the default point size is awkward to work with.

Furthermore, you’ll absolutely need to reduce the indents for epigraphs, quotes, and blockquotes (and probably the paragraph first-line indent as well).

COLUMNS

Macro: COLUMNS <number of columns> <width of gutters>

• Should be the last macro before START
The second argument requires a unit of measure

COLUMNS takes two arguments: the number of columns you want on document pages, and the width of the gutter between them. For example, to set up a page with two columns separated by an 18 point gutter, you’d do
.COLUMNS 2 18p Nothing to it, really. However, as noted above, COLUMNS should always be the last document setup macro prior to START.

Note: Mom ignores columns completely when the PRINTSTYLE is TYPEWRITE. The notion of typewriter-style output in columns is just too ghastly for her to bear.

Marking the first page column start position

If you insert or remove space after the docheader, i.e. immediately after START in your input file, mom needs to know where your first column begins in order to align subsequent columns on the first page.

Macro: COL_MARK

COL_MARK tells mom where the first column after the docheader begins, in order for the top of subsequent columns on the first page to be aligned. Note that if you do not manually add or remove space after the docheader, there is no need to invoke COL_MARK.

Note: If you do add or subtract space after the docheader, e.g. with ALD or SP, and your unit of measure is something other than a multiple of “v”, be sure to follow the spacing command with SHIM before entering .COL_MARK unless shimming has been disabled with NO_SHIM. If your document is being flex-spaced, do not use FLEX. Rather, disable flex-spacing temporarily with
.NO_FLEX .NO_SHIM off .SHIM .COL_MARK and re-enable it afterwards with .NO_SHIM .NO_FLEX off

Using tabs when COLUMNS are enabled

Mom’s tabs (both typesetting tabs and string tabs) behave as you’d expect during document processing, even when COLUMNS are enabled. Tab structures set up during document processing carry over from page to page and column to column.

Breaking columns manually

Mom takes care of breaking columns when they reach the bottom margin of a page. However, there may be times you want to break the columns yourself. There are two macros for breaking columns manually: COL_NEXT and COL_BREAK.

Macro: COL_NEXT

.COL_NEXT breaks the line just before it, quads it left (assuming the type is justified or quad left), and moves over to the top of the next column. If the column happens to be the last (rightmost) one on the page, mom starts a new page at the “column 1” position. This is the macro to use when you want to start a new column after the end of a paragraph.

Macro: COL_BREAK

.COL_BREAK is almost the same as .COL_NEXT, except that instead of breaking and quadding the line preceding it, mom breaks and spreads it (see SPREAD). Use this macro whenever you need to start a new column in the middle of a paragraph.

Warning: If you need COL_BREAK in the middle of a blockquote or (god help you) an epigraph, you must do the following in order for COL_BREAK to work:
.SPREAD \!.COL_BREAK


Changing basic type and formatting parameters after START


Behaviour of the typesetting macros during document processing

During document processing, most of the typesetting macros affect type in the document globally. For example, if you turn kerning off, pairwise kerning is disabled not only in paragraphs, but also in headers, footers, quotes, and so on.

Typesetting macros that alter margins and line lengths affect running text globally (or at least try to), but leave headers/footers and footnotes alone. (To indent footnotes, see the full explanation of the FOOTNOTE macro.)

Mom’s tabs (both typesetting tabs and string tabs) behave as expected in running text during document processing. Tab structures that do not exceed the line length of running text are preserved sensibly from page to page, and, if COLUMNS are enabled, from column to column.

Some typesetting macros, however, when used during document processing, behave in special ways. These are the macros that deal with the basic parameters of type style: horizontal and vertical margins, line length, family, font, point size, leading, and quad.

Mom assumes that any changes to these parameters stem from a temporary need to set type in a style different from that provided by mom’s document element tags. In other words, you need to do a bit of creative typesetting in the middle of a document.

The following lists those typesetting macros whose behaviour during document processing requires some explanation. (Please refer to Top and bottom margins in document processing for information on how mom interprets T_MARGIN and B_MARGIN in document processing. Additionally, see ADD_SPACE if you encounter the problem of trying to get mom to put space at the tops of pages after the first.)

MACRO EFFECT DURING DOCUMENT PROCESSING ----- --------------------------------- L_MARGIN •The left margin of all running text assumes the new value. •The line length remains unaltered. •The header and footer left margin remain at the current document default. (You won’t use this often by itself. Most likely, you’ll use it in combination with R_MARGIN or LL.) R_MARGIN •The right margin of all running text assumes the new value. In other words, the line length is altered. •The header and footer right margin remain at the current document default. LL •The line length of all running text is set to the new value. •The header and footer line length remain at the current document default. FAMILY •Changes family for the duration of the current tag only. As soon as another document element tag is invoked, the family reverts to the current default for the new tag. FT •Changes font for the duration of the current tag only. As soon as another document element tag is entered, the font reverts to the current default for the new tag. N.B. — \*[SLANT] and \*[BOLDER] affect paragraph text, and remain in effect for all paragraphs until turned off. If you want to use them in a macro that takes a string argument, include the escape in the string. \*[COND] and \*[EXT] behave similarly. PT_SIZE •Changes point size for the duration of the current tag only. As soon as another document element tag is entered, the point size reverts to the current document default for the new tag. LS •Changes line space for the duration of the current tag only. As soon as another document element tag is entered, the line space reverts to the current document default for the new tag. Using LS to temporarily change leading within a document will almost certainly result in a bottom margin that doesn’t align with the bottom margin of subsequent pages. You’ll need to use the SHIM or FLEX macro to get mom back on track when you’re ready to return to the document’s default leading. AUTOLEAD •Invoked before START, sets the overall document leading as a function of the overall document point size (ie the point size used in paragraphs); subsequently disabled after START, except for calls to DOC_PT_SIZE •DOC_LEAD before DOC_PT_SIZE cancels the AUTOLEAD set before START •Invoked after START, remains in effect for all subsequent point size changes made with PT_SIZE, but does not affect the leading of the document element tags (e.g., HEADING, PP, QUOTE...), or calls to DOC_PT_SIZE QUAD •Changes quad for the duration of the current tag only. As soon as another document element tag is entered, the quad reverts to the current document default for the new tag. N.B. — Line-for-line quadding macros (LEFT, CENTER, RIGHT) are also temporary, overridden by the QUAD value of any subsequent document element tag.

Top and bottom margins in document processing

Normally, mom establishes the top and bottom margins of running text in documents from the values of HEADER_MARGIN + HEADER_GAP and FOOTER_MARGIN + FOOTER_GAP respectively. However, if you invoke T_MARGIN or B_MARGIN either before or after START, they set the top and bottom margins of running text irrespective of HEADER_GAP and FOOTER_GAP.

Put another way, in document processing, T_MARGIN and B_MARGIN set the top and bottom margins of running text, but have no effect on the placement of headers, footers, or page numbers.

Inserting space at the top of a new page

Occasionally, you may want to insert space before the start of running text on pages after the first.

You might have tried using ALD or SPACE and found it did nothing. This is because mom normally inhibits any extra space before the start of running text on pages after the first.

If you need the space, you must use the macro ADD_SPACE in conjunction with NEWPAGE.

ADD_SPACE/RESTORE_SPACE

Macro: ADD_SPACE <amount of space>
Macro: RESTORE_SPACE

• Requires a unit of measure

If your DOCTYPE is DEFAULT, CHAPTER, NAMED, or LETTER, ADD_SPACE takes as its single argument the distance you want mom to advance from the normal baseline position at the top of any page after the first (ie the one on which the docheader is normally printed). A unit of measure is required.

For example, say you wanted to insert 2 inches of space before the start of running text on a page other than the first. You’d accomplish it with
.NEWPAGE .ADD_SPACE 2i which would terminate your current page, break to a new page, print the header (assuming headers are on) and insert 2 inches of space before the start of running text.

Since adding space in this way is almost sure to disrupt mom’s ability to guarantee perfectly flush bottom margins, I highly recommend using the SHIM or FLEX macro immediately after ADD_SPACE, which will add the space plus whatever correction is required by the vertical whitespace management strategy in effect.

If your DOCTYPE is SLIDES, ADD_SPACE may be used on any slide including the first to introduce additional white space at the top.

RESTORE_SPACE

You may sometimes find that mom refuses to respect SP, ALD/RLD, SHIM, or FLEX after the first element (line of text, floated material) output at the top of a page. Should this happen, insert the macro RESTORE_SPACE before issuing the spacing command.

Changing document-wide style parameters after START

In the normal course of things, you establish the basic type style parameters of a document prior to invoking START, using the typesetting macros (L_MARGIN, FAMILY, PT_SIZE, LS, etc). After START, you must use the following macros if you wish to make global changes to the basic type style parameters, for example changing the overall leading or the justification style.

Important: Because these macros globally update the chosen parameter, they should only be used immediately prior to COLLATE or, if an occasional effect is desired, NEWPAGE. DOC_PT_SIZE, for example, updates the point size of every page element, including headers, footers, page numbers, and so on, which is almost certainly not what you want in the middle of a page.

Post-START global style change macros

DOC_LEFT_MARGIN

Macro: DOC_LEFT_MARGIN <left margin>

• Requires a unit of measure

Arguments and behaviour

DOC_RIGHT_MARGIN

Macro: DOC_RIGHT_MARGIN <right margin>

• Requires a unit of measure

Arguments and behaviour

DOC_LINE_LENGTH

Macro: DOC_LINE_LENGTH <length>

• Requires a unit of measure

Arguments and behaviour

DOC_FAMILY

Macro: DOC_FAMILY <family>

Arguments and behaviour

DOC_PT_SIZE

Macro: DOC_PT_SIZE <point size>

• Does not require a unit of measure; points is assumed

Arguments and behaviour

DOC_LEAD

Macro: DOC_LEAD <points> [ ADJUST ]

• Does not require a unit of measure; points is assumed

Arguments and behaviour

Note: Even if you don’t pass DOC_LEAD the optional argument ADJUST, mom will still adjust the leading of endnotes pages and toc pages. See ENDNOTE_LEAD and TOC_LEAD for an explanation of how to disable this default behaviour.

DOC_QUAD

Macro: DOC_QUAD L | R | C | J

Arguments and behaviour

Terminating a document

You need do nothing special to terminate a document. When groff finishes processing the last input line of a file, the page is ejected, subject to whatever routines are needed to complete it (e.g., printing footnotes or adding the page number).

It happens sometimes, however, that a last line of running text, falling on or very near the bottom of the page, tricks groff into breaking to a new page before terminating. The result is a blank page at the end of the formatted document.

The situation is rare, generally occurring only when some additional macro is required after the input text, e.g., to exit a list or terminate a quote. To prevent it from ever happening, I recommend getting into the habit of following the final input line of all your mom files with .EL. Depending on the fill mode in effect, you may also have to append the “join line” escape, \c, to the final line.

Thus, for normal text at the end of a paragraph, which is in fill mode,
and they all lived happily ever after. .EL or for ending a LIST (also in fill mode) .ITEM peaches, pears, plums .EL .LIST OFF whereas, at the end of a QUOTE (which is in nofill mode), Shall be lifted\[em]nevermore!\c .EL .QUOTE OFF Notice that the .EL comes after the last line of input text, not any macros following.

Note: \*[B] cannot be used as a replacement for .EL when terminating a document.

Back to Table of Contents Top Next: The document element tags