www.delorie.com/gnu/docs/groff/groff_55.html   search  
 
Buy GNU books!


The GNU Troff Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.6.1 Headers and footers

For documents that do not distinguish between odd and even pages, set the following strings:

String: \*[LH]
String: \*[CH]
String: \*[RH]
Sets the left, center, and right headers.

String: \*[LF]
String: \*[CF]
String: \*[RF]
Sets the left, center, and right footers.

For documents that need different information printed in the even and odd pages, use the following macros:

Macro: .OH '
Macro: .EH '
Macro: .OF '
Macro: .EF '
The OH and EH macros define headers for the odd and even pages; the OF and EF macros define footers for the odd and even pages. This is more flexible than defining the individual strings.

You can replace the quote (') marks with any character not appearing in the header or footer text.

4.3.6.2 Margins

You control margins using a set of number registers. See section 4.3.3 Document control registers, for details.

4.3.6.3 Multiple columns

The `ms' macros can set text in as many columns as will reasonably fit on the page. The following macros are available; all of them force a page break if a multi-column mode is already set. However, if the current mode is single-column, starting a multi-column mode does not force a page break.

Macro: .1C
Single-column mode.

Macro: .2C
Two-column mode.

Macro: .MC [{width
Multi-column mode. If you specify no arguments, it is equivalent to the 2C macro. Otherwise, width is the width of each column and gutter is the space between columns. The MINGW number register controls the default gutter width.

4.3.6.4 Creating a table of contents

The facilities in the `ms' macro package for creating a table of contents are semi-automated at best. Assuming that you want the table of contents to consist of the document's headings, you need to repeat those headings wrapped in XS and XE macros.

Macro: .XS [{page
Macro: .XA [{page
Macro: .XE
These macros define a table of contents or an individual entry in the table of contents, depending on their use. The macros are very simple; they cannot indent a heading based on its level. The easiest way to work around this is to add tabs to the table of contents string. The following is an example:

 
.NH 1
Introduction
.XS
Introduction
.XE
.LP
...
.CW
.NH 2
Methodology
.XS
	Methodology
.XE
.LP
...

You can manually create a table of contents by beginning with the XS macro for the first entry, specifying the page number for that entry as the argument to XS. Add subsequent entries using the XA macro, specifying the page number for that entry as the argument to XA. The following is an example:

 
.XS 1
Introduction
.XA 2
A Brief History of the Universe
.XA 729
Details of Galactic Formation
...
.XE

Macro: .TC [no
Prints the table of contents on a new page, setting the page number to i (Roman numeral one). You should usually place this macro at the end of the file, since groff is a single-pass formatter and can only print what has been collected up to the point that the TC macro appears.

The optional argument no suppresses printing the title specified by the string register TOC.

Macro: .PX [no
Prints the table of contents on a new page, using the current page numbering sequence. Use this macro to print a manually-generated table of contents at the beginning of your document.

The optional argument no suppresses printing the title specified by the string register TOC.

The Groff and Friends HOWTO includes a sed script that automatically inserts XS and XE macro entries after each heading in a document.

Altering the NH macro to automatically build the table of contents is perhaps initially more difficult, but would save a great deal of time in the long run if you use `ms' regularly.

4.3.6.5 Strings and Special Characters

The `ms' macros provide the following predefined strings. You can change the string definitions to help in creating documents in languages other than English.

String: \*[REFERENCES]
Contains the string printed at the beginning of the references (bibliography) page. The default is `References'.

String: \*[ABSTRACT]
Contains the string printed at the beginning of the abstract. The default is `ABSTRACT'.

String: \*[TOC]
Contains the string printed at the beginning of the table of contents.

String: \*[MONTH1]
String: \*[MONTH2]
String: \*[MONTH3]
String: \*[MONTH4]
String: \*[MONTH5]
String: \*[MONTH6]
String: \*[MONTH7]
String: \*[MONTH8]
String: \*[MONTH9]
String: \*[MONTH10]
String: \*[MONTH11]
String: \*[MONTH12]
Prints the full name of the month in dates. The default is `January', `February', etc.

The following special characters are available(6); g is either an ASCII character or a special character (\(gg or \[ggg]); the condition is also true if g has been defined by the char request.

Note that these operators can't be combined with other operators like `:' or `&'; only a leading `!' (without whitespace between the exclamation mark and the operator) can be used to negate the result.

 
.nr xxx 1
.ie !r xxx \
true
.el \
false
    => false

A whitespace after `!' always evaluates to zero (this bizarre behaviour is due to compatibility with UNIX troff).

 
.nr xxx 1
.ie ! r xxx \
true
.el \
false
    => r xxx true

It is possible to omit the whitespace before the argument to the `r', `d', and `c' operators.

See section 5.4 Expressions.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003