Next: , Previous: , Up: ms Introduction   [Contents][Index] Basic information

ms documents are plain text files; prepare them with your preferred text editor. If you’re in a hurry to start, know that ms needs one of its macros called at the beginning of a document so that it can initialize. A macro is a formatting instruction to ms. Put a macro call on a line by itself. Use ‘.PP’ if you want your paragraph’s first line to be indented, or ‘.LP’ if you don’t.

After that, start typing 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 part of the manual.

Format the document with the groff command. nroff can be useful for previewing.

$ editor
$ nroff -ww -z -ms # check for errors
$ nroff -ms | less -R
$ groff -T ps -ms >
$ see

Our document might look like this.

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.






points (1/72 inch)


picas (1/6 inch)


vees; current vertical spacing


ems; width of an “M” in the current font


ens; one-half em

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


Interpolate value of register reg.


Interpolate contents of string str.


abbreviation of \*[s]; the name s must be only one character


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.

Next: , Previous: , Up: ms Introduction   [Contents][Index]