Linux cli command groff_mom
8 minute read
Name
groff_mom - modern macros for document composition with GNU roff
Synopsis
groff -mom [*option *. . .] [*file *. . .] groff -m mom [*option *. . .] [*file *. . .]
Description
mom is a macro set for groff, designed primarily to prepare documents for PDF and PostScript output. mom provides macros in two categories: typesetting and document processing. The former provide access to groff’s typesetting capabilities in ways that are simpler to master than groff’s requests and escape sequences. The latter provide highly customizable markup tags that allow the user to design and output professional-looking documents with a minimum of typesetting intervention.
Files processed with
produce PDF documents. The documents include a PDF outline that appears in the navigation pane panel of document viewers, and may contain clickable internal and external links.
Normally. groff’s native PDF driver,
is used to generate the output. When pdfmom is given the “-T ps” option, it still produces PDF, but processing is delegated to pdfroff, which uses groff’s PostScript driver,
Not all PDF features are available when -T ps is given; its primary use is to allow processing of files with embedded PostScript images.
Files processed with groff -mom (or -m mom) format for the device specified with the -T option. (In this installation, ps is the default output device.)
mom comes with her own comprehensive documentation in HTML. A PDF manual, “Producing PDFs with groff and mom”, discusses preparation of PDF documents with mom in detail.
Files
/usr/share/groff/1.23.0/tmac/mom.tmac
is a wrapper enabling the package to be loaded with “groff -m mom”.
/usr/share/groff/1.23.0/tmac/om.tmac
implements the package.
/usr/share/doc/groff-base/html/mom/toc.html
is the entry point to the HTML documentation.
/usr/share/doc/groff-base/pdf/mom-pdf.pdf
is “Producing PDFs with groff and mom”, by Deri James and Peter Schaffter.
/usr/share/doc/groff-base/examples/mom/*.mom
are examples of mom usage.
Reference
Escape sequences
begin using an initialized colour inline
move backward in a line
\[BOLDER]
invoke pseudo bold inline (related to macro .SETBOLDER)
\[BOLDERX]
off pseudo bold inline (related to macro .SETBOLDER)
move characters pairs closer together inline (related to macro .KERN)
\[COND]
invoke pseudo condensing inline (related to macro .CONDENSE)
\[CONDX]
off pseudo condensing inline (related to macro .CONDENSE)
pseudo-condensed superscript
temporarily move downward in a line
\[EN-MARK]
mark initial line of a range of line numbers (for use with line numbered endnotes)
\[EXT]
invoke pseudo extending inline (related to macro .EXTEND)
\[EXTX]
off pseudo condensing inline (related to macro .EXTEND)
pseudo extended superscript
move characters pairs further apart inline (related to macro .KERN)
move forward in a line
\[LEADER]
insert leaders at the end of a line
\[RULE]
draw a full measure rule
change the point size inline (related to macro .PT_SIZE)
\[SLANT]
invoke pseudo italic inline (related to macro .SETSLANT)
\[SLANTX]
off pseudo italic inline (related to macro .SETSLANT)
string tabs (mark tab positions inline)
superscript
\[TB+]
inline escape for .TN (Tab Next)
invoke underlining inline (fixed width fonts only)
temporarily move upward in a line
Macros
.AUTOLEAD
set the linespacing relative to the point size
.B_MARGIN
set a bottom margin
.BR
break a justified line
.CENTER
set line-by-line quad centre
.CONDENSE
set the amount to pseudo condense
.EL
break a line without advancing on the page
.EXTEND
set the amount to pseudo extend
.FALLBACK_FONT
establish a fallback font (for missing fonts)
.FAM
alias to .FAMILY
**.FAMILY **<family>
set the family type
.FT
set the font style (roman, italic, etc.)
.HI [* <measure> *]
hanging indent
.HY
automatic hyphenation on/off
.HY_SET
set automatic hyphenation parameters
.IB [* <left measure> <right measure> *]
indent both
.IBX [ CLEAR ]
exit indent both
.IL [* <measure> *]
indent left
.ILX [ CLEAR ]
exit indent left
.IQ [ CLEAR ]
quit any/all indents
.IR [* <measure> *]
indent right
.IRX [ CLEAR ]
exit indent right
.JUSTIFY
justify text to both margins
.KERN
automatic character pair kerning on/off
.L_MARGIN
set a left margin (page offset)
.LEFT
set line-by-line quad left
.LL
set a line length
.LS
set a linespacing (leading)
.PAGE
set explicit page dimensions and margins
.PAGEWIDTH
set a custom page width
.PAGELENGTH
set a custom page length
.PAPER* <paper_type>*
set common paper sizes (letter, A4, etc)
.PT_SIZE
set the point size
.QUAD
“justify” text left, centre, or right
.R_MARGIN
set a right margin
.RIGHT
set line-by-line quad right
.SETBOLDER
set the amount of emboldening
.SETSLANT
set the degree of slant
.SPREAD
force justify a line
.SS
set the sentence space size
.T_MARGIN
set a top margin
.TI [* <measure> *]
temporary left indent
.WS
set the minimum word space size
Documentation of details
Details of inline escape sequences in alphabetical order
begin using an initialized colour inline
move backward in a line
\[BOLDER]
\[BOLDERX]
Emboldening on/off
\[BOLDER] begins emboldening type. \[BOLDERX] turns the feature off. Both are inline escape sequences; therefore, they should not appear as separate lines, but rather be embedded in text lines, like this:
Alternatively, if you wanted the whole line emboldened, you should do
Once \[BOLDER] is invoked, it remains in effect until turned off.
Note: If you’re using the document processing macros with .PRINTSTYLE TYPEWRITE, mom ignores \[BOLDER] requests.
move characters pairs closer together inline (related to macro .KERN)
\[COND]
\[CONDX]
Pseudo-condensing on/off
\[COND] begins pseudo-condensing type. \[CONDX] turns the feature off. Both are inline escape sequences; therefore, they should not appear as separate lines, but rather be embedded in text lines, like this:
\[COND] remains in effect until you turn it off with \[CONDX].
IMPORTANT: You must turn \[COND] off before making any changes to the point size of your type, either via the .PT_SIZE macro or with the \s inline escape sequence. If you wish the new point size to be pseudo-condensed, simply reinvoke \[COND] afterward. Equally, \[COND] must be turned off before changing the condense percentage with .CONDENSE.
Note: If you’re using the document processing macros with .PRINTSTYLE TYPEWRITE, mom ignores \[COND] requests.
pseudo-condensed superscript
temporarily move downward in a line
\[EN-MARK]
mark initial line of a range of line numbers (for use with line numbered endnotes)
\[EXT]
\[EXTX]
Pseudo-extending on/off
\[EXT] begins pseudo-extending type. \[EXTX] turns the feature off. Both are inline escape sequences; therefore, they should not appear as separate lines, but rather be embedded in text lines, like this:
\[EXT] remains in effect until you turn it off with \[EXTX].
IMPORTANT: You must turn \[EXT] off before making any changes to the point size of your type, either via the .PT_SIZE macro or with the \s inline escape sequence. If you wish the new point size to be pseudo-extended, simply reinvoke \[EXT] afterward. Equally, \[EXT] must be turned off before changing the extend percentage with .EXTEND.
Note: If you are using the document processing macros with .PRINTSTYLE TYPEWRITE, mom ignores \[EXT] requests.
pseudo extended superscript
move characters pairs further apart inline (related to macro .KERN)
move forward in a line
\[LEADER]
insert leaders at the end of a line
\[RULE]
draw a full measure rule
change the point size inline (related to macro .PT_SIZE)
\[SLANT]
\[SLANTX]
Pseudo italic on/off
\[SLANT] begins pseudo-italicizing type. \[SLANTX] turns the feature off. Both are inline escape sequences; therefore, they should not appear as separate lines, but rather be embedded in text lines, like this:
Alternatively, if you wanted the whole line pseudo-italicized, you’d do
Once \[SLANT] is invoked, it remains in effect until turned off.
Note: If you’re using the document processing macros with .PRINTSTYLE TYPEWRITE, mom underlines pseudo-italics by default. To change this behaviour, use the special macro .SLANT_MEANS_SLANT.
Mark positions of string tabs
The quad direction must be LEFT or JUSTIFY (see .QUAD and .JUSTIFY) or the no-fill mode set to LEFT in order for these inlines to function properly. Please see IMPORTANT, below.
String tabs need to be marked off with inline escape sequences before being set up with the .ST macro. Any input line may contain string tab markers. <number>, above, means the numeric identifier of the tab.
The following shows a sample input line with string tab markers.
*[ST1]De minimus*[ST1X] non curat*[ST2]lex*[ST2X].
String tab 1 begins at the start of the line and ends after the word time. String tab 2 starts at good and ends after men. Inline escape sequences (e.g., font or point size changes, or horizontal movements, including padding) are taken into account when mom determines the position and length of string tabs.
Up to nineteen string tabs may be marked (not necessarily all on the same line, of course), and they must be numbered between 1 and 19.
Once string tabs have been marked in input lines, they have to be set with .ST, after which they may be called, by number, with .TAB.
Note: Lines with string tabs marked off in them are normal input lines, i.e. they get printed, just like any input line. If you want to set up string tabs without the line printing, use the .SILENT macro.
IMPORTANT: Owing to the way groff processes input lines and turns them into output lines, it is not possible for mom to guess the correct starting position of string tabs marked off in lines that are centered or set flush right.
Equally, she cannot guess the starting position if a line is fully justified and broken with .SPREAD.
In other words, in order to use string tabs, LEFT must be active, or, if .QUAD LEFT or JUSTIFY are active, the line on which the string tabs are marked must be broken manually with .BR (but not .SPREAD).
To circumvent this behaviour, I recommend using the PAD to set up string tabs in centered or flush right lines. Say, for example, you want to use a string tab to underscore the text of a centered line with a rule. Rather than this,
.CENTER *[ST1]A line of text*[ST1X]
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.