Next: , Previous: Highlighting in ms, Up: ms Body Text


4.3.5.4 Lists

The IP macro handles duties for all lists.

— Macro: .IP [marker [width]]

The marker is usually a bullet glyph (\[bu]) for unordered lists, a number (or auto-incrementing number register) for numbered lists, or a word or phrase for indented (glossary-style) lists.

The width specifies the indentation for the body of each list item; its default unit is ‘n’. Once specified, the indentation remains the same for all list items in the document until specified again.

The PORPHANS register (see ms Document Control Registers) operates in conjunction with the IP macro, to inhibit the printing of orphaned list markers at the bottom of any page.

The following is an example of a bulleted list.

     
     A bulleted list:
     .IP \[bu] 2
     lawyers
     .IP \[bu]
     guns
     .IP \[bu]
     money

Produces:

     
     A bulleted list:
     
     o lawyers
     
     o guns
     
     o money

The following is an example of a numbered list.

     
     .nr step 1 1
     A numbered list:
     .IP \n[step] 3
     lawyers
     .IP \n+[step]
     guns
     .IP \n+[step]
     money

Produces:

     
     A numbered list:
     
     1. lawyers
     
     2. guns
     
     3. money

Note the use of the auto-incrementing number register in this example.

The following is an example of a glossary-style list.

     
     A glossary-style list:
     .IP lawyers 0.4i
     Two or more attorneys.
     .IP guns
     Firearms, preferably
     large-caliber.
     .IP money
     Gotta pay for those
     lawyers and guns!

Produces:

     
     A glossary-style list:
     
     lawyers
           Two or more attorneys.
     
     guns  Firearms, preferably large-caliber.
     
     money
           Gotta pay for those lawyers and guns!

In the last example, the IP macro places the definition on the same line as the term if it has enough space; otherwise, it breaks to the next line and starts the definition below the term. This may or may not be the effect you want, especially if some of the definitions break and some do not. The following examples show two possible ways to force a break.

The first workaround uses the br request to force a break after printing the term or label.

     
     A glossary-style list:
     .IP lawyers 0.4i
     Two or more attorneys.
     .IP guns
     .br
     Firearms, preferably large-caliber.
     .IP money
     Gotta pay for those lawyers and guns!

The second workaround uses the \p escape to force the break. Note the space following the escape; this is important. If you omit the space, groff prints the first word on the same line as the term or label (if it fits) then breaks the line.

     
     A glossary-style list:
     .IP lawyers 0.4i
     Two or more attorneys.
     .IP guns
     \p Firearms, preferably large-caliber.
     .IP money
     Gotta pay for those lawyers and guns!

To set nested lists, use the RS and RE macros. See Indentation values in ms, for more information. For example:

     
     .IP \[bu] 2
     Lawyers:
     .RS
     .IP \[bu]
     Dewey,
     .IP \[bu]
     Cheatham,
     .IP \[bu]
     and Howe.
     .RE
     .IP \[bu]
     Guns

Produces:

     
     o Lawyers:
     
       o  Dewey,
     
       o  Cheatham,
     
       o  and Howe.
     
     o Guns