manpagez: man pages & more
info groff
Home | html | info | man

File: groff.info,  Node: Manipulating Spacing,  Next: Tabs and Fields,  Prev: Manipulating Hyphenation,  Up: GNU troff Reference

5.11 Manipulating Spacing
=========================

A break causes the formatter to update the vertical drawing position at
which the new text baseline is aligned.  You can alter this location.

 -- Request: .sp [distance]
     Break and move the next text baseline down by DISTANCE, or until
     springing a page location trap.(1)  (*note Manipulating
     Spacing-Footnote-1::) If invoked with the no-break control
     character, 'sp' moves the pending output line's text baseline by
     DISTANCE.  A negative DISTANCE will not reduce the position of the
     text baseline below zero.  Inside a diversion, any DISTANCE
     argument is ignored.  The default scaling unit is 'v'.  If DISTANCE
     is not specified, '1v' is assumed.

          .pl 5v \" Set page length to 5 vees.
          .de xx
          \-\-\-
          .  br
          ..
          .wh 0 xx \" Set a trap at the top of the page.
          foo on page \n%
          .sp 2v
          bar on page \n%
          .sp 50v \" This will cause a page break.
          baz on page \n%
          .pl \n(nlu \" Truncate page to current position.
              => ---
              => foo on page 1
              =>
              =>
              => bar on page 1
              => ---
              => baz on page 2

     You might use the following macros to set the baseline of the next
     output text at a given distance from the top or the bottom of the
     page.  We subtract one line height ('\n[.v]') because the '|'
     operator moves to one vee below the page top (recall *note Numeric
     Expressions::).

          .de y-from-top-down
          .  sp |\\$1-\\n[.v]u
          ..
          .
          .de y-from-bot-up
          .  sp |\\n[.p]u-\\$1-\\n[.v]u
          ..

     A call to '.y-from-bot-up 10c' means that the next text baseline
     will be 10 cm from the bottom edge of the paper.

 -- Request: .ls [count]
 -- Register: \n[.L]
     Set the line spacing; add COUNT-1 blank lines after each line of
     text.  With no argument, GNU 'troff' uses the previous value before
     the last 'ls' call.  The default is '1'.

     The read-only register '.L' contains the current line spacing; it
     is associated with the environment (*note Environments::).

   The 'ls' request is a coarse mechanism.  *Note Changing the Type
Size::, for the requests 'vs' and 'pvs' as alternatives to 'ls'.

 -- Escape sequence: \x'spacing'
 -- Register: \n[.a]
     Sometimes, an output line requires additional vertical spacing, for
     instance to allow room for a tall construct like an inline equation
     with exponents or subscripts (particularly if they are iterated).
     The '\x' escape sequence takes a delimited measurement (like
     '\x'3p'') to increase the vertical spacing of the pending output
     line.  The default scaling unit is 'v'.  If the measurement is
     positive, extra vertical space is inserted below the current line;
     a negative measurement adds space above.  If '\x' is applied to the
     pending output line multiple times, the maxima of the positive and
     negative adjustments are separately applied.  The delimiter need
     not be a neutral apostrophe; see *note Delimiters::.

     The '.a' read-only register contains the extra vertical spacing
     _after_ the text baseline of the most recently emitted output line.
     (In other words, it is the largest positive argument to '\x'
     encountered on that line.)  This quantity is exposed via a register
     because if an output line requires this "extra post-vertical line
     spacing", and the subsequent output line requires "extra
     pre-vertical line spacing" (a negative argument to '\x'), then
     applying both can lead to excessive spacing between the output
     lines.  Text that is piling high on line N might not require (as
     much) extra pre-vertical line spacing if line N-1 carries extra
     post-vertical line spacing.

     Use of '\x' can be necessary in combination with the
     bracket-building escape sequence '\b',(2) (*note Manipulating
     Spacing-Footnote-2::) as the following example shows.

          .nf
          This is a test of \[rs]b (1).
          This is a test of \[rs]b (2).
          This is a test of \b'xyz'\x'-1m'\x'1m' (3).
          This is a test of \[rs]b (4).
          This is a test of \[rs]b (5).
              => This is a test of \b (1).
              => This is a test of \b (2).
              =>                   x
              => This is a test of y (3).
              =>                   z
              => This is a test of \b (4).
              => This is a test of \b (5).

Without '\x', the backslashes on the lines marked '(2)' and '(4)' would
be overprinted.

 -- Request: .ns
 -- Request: .rs
 -- Register: \n[.ns]
     Enable "no-space mode".  Vertical spacing, whether by 'sp' requests
     or blank input lines, is disabled.  The 'bp' request to advance to
     the next page is also disabled, unless it is accompanied by a page
     number (*note Page Control::).  No-space mode ends automatically
     when text(3) (*note Manipulating Spacing-Footnote-3::) is formatted
     for output (4) (*note Manipulating Spacing-Footnote-4::) or the
     'rs' request is invoked, which ends no-space mode.  The read-only
     register '.ns' interpolates a Boolean value indicating the
     enablement of no-space mode.

     A paragraphing macro might ordinarily insert vertical space to
     separate paragraphs.  A section heading macro could invoke 'ns' to
     suppress this spacing for the first paragraph in a section.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.