GNU Info

Info Node: (groff)Manipulating Hyphenation

(groff)Manipulating Hyphenation


Next: Manipulating Spacing Prev: Manipulating Filling and Adjusting Up: gtroff Reference
Enter node , (file) or (file)node

Manipulating Hyphenation
========================

   As discussed in Note: Hyphenation, `gtroff' hyphenates words.
There are a number of ways to influence hyphenation.

 - Request: .hy [mode]
 - Register: \n[.hy]
     Enable hyphenation.  The request has an optional numeric argument,
     MODE, to restrict hyphenation if necessary:

    `1'
          The default argument if MODE is omitted.  Hyphenate without
          restrictions.  This is also the start-up value of `gtroff'.

    `2'
          Do not hyphenate the last word on a page or column.

    `4'
          Do not hyphenate the last two characters of a word.

    `8'
          Do not hyphenate the first two characters of a word.

     Values in the previous table are additive.  For example, the
     value 12 causes `gtroff' to neither hyphenate the last two nor the
     first two characters of a word.

     The current hyphenation restrictions can be found in the read-only
     number register `.hy'.

     The hyphenation mode is associated with the current environment
     (Note: Environments).

 - Request: .nh
     Disable hyphenation (i.e., set the hyphenation mode to zero).  Note
     that the hyphenation mode of the last call to `hy' is not
     remembered.

     The hyphenation mode is associated with the current environment
     (Note: Environments).

 - Request: .hlm [nnn]
 - Register: \n[.hlm]
 - Register: \n[.hlc]
     Set the maximum number of consecutive hyphenated lines to NNN.  If
     this number is negative, there is no maximum.  The default value
     is -1 if NNN is omitted.  This value is associated with the
     current environment (Note: Environments).  Only lines output
     from a given environment count towards the maximum associated with
     that environment.  Hyphens resulting from `\%' are counted;
     explicit hyphens are not.

     The current setting of `hlm' is available in the `.hlm' read-only
     number register.  Also the number of immediately preceding
     consecutive hyphenated lines are available in the read-only number
     register `.hlc'.

 - Request: .hw word1 word2 ...
     Define how WORD1, WORD2, etc. are to be hyphenated.  The words
     must be given with hyphens at the hyphenation points.  For example:


          .hw in-sa-lub-rious

     Besides the space character, any character whose hyphenation code
     value is zero can be used to separate the arguments of `hw' (see
     the documentation for the `hcode' request below for more
     information).  In addition, this request can be used more than
     once.

     Hyphenation exceptions specified with the `hw' request are
     associated with the current hyphenation language; it causes an
     error if there is no current hyphenation language.

     This request is ignored if there is no parameter.

     In old versions of `troff' there was a limited amount of space to
     store such information; fortunately, with `gtroff', this is no
     longer a restriction.

 - Escape: \%
     To tell `gtroff' how to hyphenate words on the fly, use the `\%'
     escape, also known as the "hyphenation character".  Preceding a
     word with this character prevents it from being hyphenated;
     putting it inside a word indicates to `gtroff' that the word may
     be hyphenated at that point.  Note that this mechanism only
     affects that one occurrence of the word; to change the hyphenation
     of a word for the entire document, use the `hw' request.

 - Request: .hc [char]
     Change the hyphenation character to CHAR.  This character then
     works the same as the `\%' escape, and thus, no longer appears in
     the output.  Without an argument, `hc' resets the hyphenation
     character to be `\%' (the default) only.

     The hyphenation character is associated with the current
     environment (Note: Environments).

 - Request: .hpf pattern_file
     Read in a file of hyphenation patterns.  This file is searched for
     in the same way as `NAME.tmac' (or `tmac.NAME') is searched for if
     the `-mNAME' option is specified.

     It should have the same format as the argument to the `\patterns'
     primitive in TeX (without using TeX's macro expansion); the
     letters appearing in this file are interpreted as hyphenation
     codes.  A `%' character in the patterns file introduces a comment
     that continues to the end of the line.

     If no `hpf' request is specified (either in the document or in a
     macro package), `gtroff' won't hyphenate at all.

     The set of hyphenation patterns is associated with the current
     language set by the `hla' request.  The `hpf' request is usually
     invoked by the `troffrc' or `troffrc-end' file; by default,
     `troffrc' loads hyphenation patterns for American English (in file
     `hyphen.us').

     Invoking `hpf' causes an error if there is no current hyphenation
     language.

 - Request: .hcode c1 code1 c2 code2 ...
     Set the hyphenation code of character C1 to CODE1, that of C2 to
     CODE2, etc.  A hyphenation code must be a single input character
     (not a special character) other than a digit or a space.
     Initially each lower-case letter (`a'-`z') has its hyphenation set
     to itself, and each upper-case letter (`A'-`Z') has a hyphenation
     code which is the lower-case version of itself.

     This request is ignored if it has no parameter.

 - Request: .hym [length]
 - Register: \n[.hym]
     Set the (right) hyphenation margin to LENGTH.  If the current
     adjustment mode is not `b' or `n', the line is not hyphenated if
     it is shorter than LENGTH.  Without an argument, the hyphenation
     margin is reset to its default value, which is 0.  The default
     scaling indicator for this request is `m'.  The hyphenation margin
     is associated with the current environment (Note: Environments).

     A negative argument resets the hyphenation margin to zero, emitting
     a warning of type `range'.

     The current hyphenation margin is available in the `.hym' read-only
     number register.

 - Request: .hys [hyphenation_space]
 - Register: \n[.hys]
     Set the hyphenation space to HYPHENATION_SPACE.  If the current
     adjustment mode is `b' or `n', don't hyphenate the line if it can
     be justified by adding no more than HYPHENATION_SPACE extra space
     to each word space.  Without argument, the hyphenation space is
     set to its default value, which is 0.  The default scaling
     indicator for this request is `m'.  The hyphenation space is
     associated with the current environment (Note: Environments).

     A negative argument resets the hyphenation space to zero, emitting
     a warning of type `range'.

     The current hyphenation space is available in the `.hys' read-only
     number register.

 - Request: .shc [char]
     Set the soft hyphen character to CHAR.  If the argument is
     omitted, the soft hyphen character is set to the default character
     `\(hy' (this is the start-up value of `gtroff' also).  The soft
     hyphen character is the character that is inserted when a word is
     hyphenated at a line break.  If the soft hyphen character does not
     exist in the font of the character immediately preceding a
     potential break point, then the line is not broken at that point.
     Neither definitions (specified with the `char' request) nor
     translations (specified with the `tr' request) are considered when
     finding the soft hyphen character.

 - Request: .hla language
 - Register: \n[.hla]
     Set the current hyphenation language to the string LANGUAGE.
     Hyphenation exceptions specified with the `hw' request and
     hyphenation patterns specified with the `hpf' request are both
     associated with the current hyphenation language.  The `hla'
     request is usually invoked by the `troffrc' or the `troffrc-end'
     files; `troffrc' sets the default language to `us'.

     The current hyphenation language is available as a string in the
     read-only number register `.hla'.


          .ds curr_language \n[.hla]
          \*[curr_language]
              => us



automatically generated by info2www version 1.2.2.9