Info Node: (groff)Manipulating Filling and Adjusting
(groff)Manipulating Filling and Adjusting
Manipulating Filling and Adjusting
==================================
Various ways of causing "breaks" were given in Note:Implicit Line
Breaks. The `br' request likewise causes a break. Several other
requests also cause breaks, but implicitly. These are `bp', `ce',
`cf', `fi', `fl', `in', `nf', `rj', `sp', `ti', and `trf'.
- Request: .br
Break the current line, i.e., the input collected so far is emitted
without adjustment.
If the no-break control character is used, `gtroff' suppresses the
break:
a
'br
b
=> a b
Initially, `gtroff' fills and adjusts text to both margins. Filling
can be disabled via the `nf' request and re-enabled with the `fi'
request.
- Request: .fi
- Register: \n[.u]
Activate fill mode (which is the default). This request implicitly
enables adjusting; it also inserts a break in the text currently
being filled. The read-only number register `.u' is set to 1.
The fill mode status is associated with the current environment
(Note:Environments).
- Request: .nf
Activate no-fill mode. Input lines are output as-is, retaining
line breaks and ignoring the current line length. This command
implicitly disables adjusting; it also causes a break. The number
register `.u' is set to 0.
The fill mode status is associated with the current environment
(Note:Environments).
- Request: .ad [mode]
- Register: \n[.j]
Set adjusting mode.
Activation and deactivation of adjusting is done implicitly with
calls to the `fi' or `nf' requests.
MODE can have one of the following values:
`l'
Adjust text to the left margin. This produces what is
traditionally called ragged-right text.
`r'
Adjust text to the right margin, producing ragged-left text.
`c'
Center filled text. This is different to the `ce' request
which only centers text without filling.
`b'
`n'
Justify to both margins. This is the default used by
`gtroff'.
With no argument, `gtroff' adjusts lines in the same way it did
before adjusting was deactivated (with a call to `na', for
example).
text
.ad r
text
.ad c
text
.na
text
.ad \" back to centering
text
The current adjustment mode is available in the read-only number
register `.j'; it can be stored and subsequently used to set
adjustment.
The adjustment mode status is associated with the current
environment (Note:Environments).
- Request: .na
Disable adjusting. This request won't change the current
adjustment mode: A subsequent call to `ad' uses the previous
adjustment setting.
The adjustment mode status is associated with the current
environment (Note:Environments).
- Escape: \p
Adjust the current line and cause a break.
In most cases this produces very ugly results, since `gtroff'
doesn't have a sophisticated paragraph building algorithm (as TeX
have, for example); instead, `gtroff' fills and adjusts a paragraph
line by line:
This is an uninteresting sentence.
This is an uninteresting sentence.\p
This is an uninteresting sentence.
is formatted as
This is an uninteresting sentence. This is an
uninteresting sentence.
This is an uninteresting sentence.
- Request: .ss word_space_size [sentence_space_size]
- Register: \n[.ss]
- Register: \n[.sss]
Change the minimum size of a space between filled words. It takes
its units as one twelfth of the space width parameter for the
current font. Initially both the WORD_SPACE_SIZE and
SENTENCE_SPACE_SIZE are 12.
If two arguments are given to the `ss' request, the second
argument sets the sentence space size. If the second argument is
not given, sentence space size is set to WORD_SPACE_SIZE. The
sentence space size is used in two circumstances: If the end of a
sentence occurs at the end of a line in fill mode, then both an
inter-word space and a sentence space are added; if two spaces
follow the end of a sentence in the middle of a line, then the
second space is a sentence space. If a second argument is never
given to the `ss' request, the behaviour of UNIX `troff' is the
same as that exhibited by GNU `troff'. In GNU `troff', as in UNIX
`troff', a sentence should always be followed by either a newline
or two spaces.
The read-only number registers `.ss' and `.sss' hold the values of
the parameters set by the first and second arguments of the `ss'
request.
The word space and sentence space values are associated with the
current environment (Note:Environments).
Contrary to traditional Unix `troff', this request is _not_
ignored if a tty output device is used; the given values are then
rounded down to a multiple of 12.
The request is ignored if there is no parameter.
- Request: .ce [nnn]
- Register: \n[.ce]
Center text. While the `.ad c' request also centers text, it
fills the text as well. `ce' does not fill the text it affects.
This request causes a break.
The following example demonstrates the differences. Here the
input:
.ll 4i
.ce 1000
This is a small text fragment which shows the differences
between the `.ce' and the `.ad c' request.
.ce 0
.ad c
This is a small text fragment which shows the differences
between the `.ce' and the `.ad c' request.
And here the result:
This is a small text fragment which
shows the differences
between the `.ce' and the `.ad c' request.
This is a small text fragment which
shows the differences between the `.ce'
and the `.ad c' request.
With no arguments, `ce' centers the next line of text. NNN
specifies the number of lines to be centered. If the argument is
zero or negative, centering is disabled.
The basic length for centering text is the line length (as set
with the `ll' request) minus the indentation (as set with the `in'
request). Temporary indentation is ignored.
As can be seen in the previous example, it is a common idiom to
turn on centering for a large number of lines, and to turn off
centering after text to be centered. This is useful for any
request which takes a number of lines as an argument.
The `.ce' read-only number register contains the number of lines
remaining to be centered, as set by the `ce' request.
- Request: .rj [nnn]
- Register: \n[.rj]
Justify unfilled text to the right margin. Arguments are
identical to the `ce' request. The `.rj' read-only number
register is the number of lines to be right-justified as set by
the `rj' request. This request causes a break.