Up: ms Introduction [Contents][Index]
Prepare an ms document with your preferred text editor. Call an ms macro early in the document to initialize the package. A macro is a formatting instruction to ms. Put a macro call on a line by itself with a dot before its name. Use ‘.PP’ if you want your paragraph’s first line indented, or ‘.LP’ if you don’t. Then type text normally. It is a good practice to start each sentence on a new line, or to put two spaces after sentence-ending punctuation, so that the formatter knows where the sentence boundaries are. You can separate paragraphs with further paragraphing macros, or with blank lines, and you can indent with tabs. When you need one of the features mentioned earlier (see ms), return to this subsection.
Format the document with the
groff
command.
nroff
can be useful for previewing.
$ editor radical.ms # vim, emacs, nano, … $ nroff -ww -z -ms radical.ms # check for errors $ nroff -ms radical.ms | less -R $ groff -T ps -ms radical.ms > radical.ps $ see radical.ps # or your favorite PDF viewer
Our radical.ms document might look like this.
.LP Radical novelties are so disturbing that they tend to be suppressed or ignored, to the extent that even the possibility of their existence in general is more often denied than admitted. →That's what Dijkstra said, anyway.
ms exposes many aspects of document layout to user control via
groff’s registers and strings, which store numbers
and text, respectively. Measurements in groff are expressed with
a suffix called a scaling unit.
iinches
ccentimeters
ppoints (1/72 inch)
Ppicas (1/6 inch)
vvees; current vertical spacing
mems; width of an “M” in the current font
nens; one-half em (same as m on terminals)
Set registers with the nr request and strings with the ds
request. Requests are like macro calls; they go on lines by
themselves and start with the control character, a dot (.).
The difference is that they directly instruct the formatter program,
rather than the macro package. We’ll discuss a few as applicable. It
is wise to specify a scaling unit when setting any register that
represents a length, size, or distance.
.nr PS 10.5p \" Use 10.5-point type. .ds FAM P \" Use Palatino font family.
In the foregoing,
we see that
\"
begins a comment.
This is an example of an
escape sequence,
the other kind of formatting instruction.
Escape sequences can appear almost anywhere.
They begin with the escape character
(\)
and are followed by at least one more character.
ms
documents
tend to use only a few of
groff’s
many requests and escape sequences;
see Request Index and Escape Sequence Index or the
groff(7)
man page for complete lists.
\"Begin comment; ignore remainder of line.
\n[reg]Interpolate value of register reg.
\nrabbreviation of \n[r];
the name r must be only one character
\*[str]Interpolate contents of string str.
\*sabbreviation of \*[s]; the name s must be only one
character
\[char]Interpolate glyph of special character named char.
\&dummy character
\~Insert an unbreakable space that is adjustable like a normal space.
\|Move horizontally by one-sixth em (“thin space”).
Prefix any words that start with a dot ‘.’ or neutral apostrophe
‘'’ with \& if they are at the beginning of an input line
(or might become that way in editing) to prevent them from being
interpreted as macro calls or requests. Suffix ‘.’, ‘?’, and
‘!’ with \& when needed to cancel end-of-sentence detection.
My exposure was \&.5 to \&.6 Sv of neutrons, said Dr.\& Wallace after the criticality incident.
Up: ms Introduction [Contents][Index]