5.17 Page Layout

GNU troff provides some primitive operations for controlling page layout.

Request: .pl [length]
Request: .pl +length
Request: .pl -length
Register: \n[.p]

Set the page length to length (or increment or decrement the current value by length). This is the length of the physical output page. The default scaling indicator is ‘v’.

The current setting can be found in the read-only register ‘.p’.

This specifies only the size of the page, not the top and bottom margins. Those are not set by GNU troff directly. See Traps, for further information on how to do this.

Negative pl values are possible also, but not very useful: no trap is sprung, and each line is output on a single page (thus suppressing all vertical spacing).

If no argument or an invalid argument is given, pl sets the page length to 11i.

GNU troff provides several operations that help in setting up top and bottom titles (also known as headers and footers).

Request: .tl 'left'center'right'

Print a title line. It consists of three parts: a left-justified portion, a centered portion, and a right-justified portion. The argument separator ‘'’ can be replaced with any character not occurring in the title line. The ‘%’ character is replaced with the current page number. This character can be changed with the pc request (see below). The delimiter need not be a neutral apostrophe: tl accepts the same delimiters as most escape sequences; see Delimiters. Without an argument, tl is ignored.

  • The line length set by the ll request is not honoured by tl; use the lt request (described below) instead, to control line length for text set by tl.
  • A title line is not restricted to the top or bottom of a page.
  • tl prints the title line immediately, ignoring a partially collected line (which stays untouched).
  • It is not an error to omit closing delimiters. For example, ‘.tl /foo is equivalent to ‘.tl /foo///: It prints a title line with the left-justified word ‘foo’; the centered and right-justified parts are empty.
Request: .lt [length]
Request: .lt +length
Request: .lt -length
Register: \n[.lt]

The title line is printed using its own line length, which is specified (or incremented or decremented) with the lt request. Initially, the title line length is set to 6.5i. If a negative line length is specified (which is not allowed), gtroff emits a warning in category ‘range’ and sets the title line length to zero. The default scaling indicator is ‘m’. If lt is called without an argument, the title length is reset to the previous value before the last call to lt. The current setting is available in the .lt read-only register; it is associated with the environment (see Environments).

Request: .pn page
Request: .pn +page
Request: .pn -page
Register: \n[.pn]

Change (increase or decrease) the page number of the next page. The only argument is the page number; the request is ignored without a parameter.

The read-only register .pn contains the number of the next page: either the value set by a pn request, or the number of the current page plus 1.

Request: .pc [char]

Change the page number character (used by the tl request) to a different character. With no argument, this mechanism is disabled. This doesn’t affect the register %.

See Traps.