# patgen - generate patterns for TeX hyphenation - man(1) - [phpMan]

[_PATGEN_(1)](https://www.chedong.com/phpMan.php/man/PATGEN/1/markdown)                              General Commands Manual                             [_PATGEN_(1)](https://www.chedong.com/phpMan.php/man/PATGEN/1/markdown)

## NAME
       patgen - generate patterns for TeX hyphenation

## SYNOPSIS
       **patgen _**dictionary_file_ _pattern_file_ _patout_file_ _translate_file_

## DESCRIPTION
       This  manual  page  is not meant to be exhaustive.  See also the Info file or manual _Web2C:_ _A_
       _TeX_ _implementation_ available as part of the TeX Live distribution or at _<http://tug.org/web2c_>.

       The _patgen_ program reads the _dictionary_file_ containing a list of hyphenated  words  and  the
       _pattern_file_ containing previously-generated patterns (if any) for a particular language (not
       a  complete  TeX source file; see below), and produces the _patout_file_ with (previously- plus
       newly-generated) hyphenation patterns for that language. The _translate_file_ defines  language
       specific values for the parameters _left_hyphen_min_ and _right_hyphen_min_ used by TeX's hyphen‐
       ation algorithm and the external representation of the lower and upper case version(s) of all
       `letters' of that language. Further details of the pattern generation process such as hyphen‐
       ation  levels  and  pattern lengths are requested interactively from the user's terminal. Op‐
       tionally _patgen_ creates a new dictionary file **pattmp._**n_ showing the good and bad hyphens found
       by the generated patterns, where _n_ is the highest hyphenation level.

       The patterns generated by _patgen_ can be read by **initex **for use in hyphenating  words.  For  a
       real-life  example  of  _patgen_'s  output, see _$TEXMFMAIN/tex/generic/hyphen/hyphen.tex_, which
       contains the patterns TeX uses for English by default.  At some sites,  patterns  for  (many)
       other languages may be available, and the local **tex **programs may have them preloaded.

       All filenames must be complete; no adding of default extensions or path searching is done.

## FILE FORMATS
### Letters
           When  **initex  **digests  hyphenation patterns, TeX first expands macros and the result must
           entirely consist of digits (hyphenation levels), dots (`.', edge of a word), and letters.
           In pattern files for non-English languages letters are often  represented  by  macros  or
           other  expandable  constructs.   For  the  purpose of _patgen_ these are just character se‐
           quences, subject to the condition that no such sequence is a prefix of another one.

### Dictionary file
           A dictionary file contains a weighted list of hyphenated words, one word per line  start‐
           ing  in  column  1. A digit in column 1 indicates a global word weight (initially =1) ap‐
           plicable to all following words up to the next global word weight. A digit at some inter‐
           character position indicates a weight for that position only.

           The hyphens in a word are indicated by `-', `*', or `.' (or their replacements as defined
           in the translate file) for hyphens yet to be found, `good' hyphens  (correctly  found  by
           the  patterns),  and `bad' hyphens (erroneously found by the patterns) respectively; when
           reading a dictionary file `*' is treated like `-' and `.' is ignored.

### Pattern file
           A pattern file contains only patterns in the format above, e.g., from a previous  run  of
           patgen.  It may _not_ contain any TeX comments or control sequences.  For instance, this is
           not a valid pattern file:

           % this is a pattern file read by TeX.
           \patterns{%
            ...
           }
           It can only contain the actual patterns, i.e., the `...'.

### Translate file
           A  translate  file starts with a line containing the values of _left_hyphen_min_ in columns
           1-2, _right_hyphen_min_ in columns 3-4, and either a blank or the replacement  for  one  of
           the "hyphen" characters `-', `*', and `.' in columns 5, 6, and 7. (Input lines are padded
           with blanks as for many TeX related programs.)

           Each  following  line defines one `letter': an arbitrary delimiter character in column 1,
           followed by one or more external representations of that  character  (first  the  `lower'
           case  one  used  for output), each one terminated by the delimiter and the whole sequence
           terminated by another delimiter.

           If the translate file is empty, the values _left_hyphen_min_=2, _right_hyphen_min_=3, and the
           26 lower case letters **a**...**z **with their upper case representations **A**...**Z **are assumed.

### Terminal input
           After reading the _translate_file_ and any previously-generated patterns from _pattern_file_,
           _patgen_ requests input from the user's terminal.

           First the integer values of _hyph_start_ and _hyph_finish_, the lowest  and  highest  hyphen‐
           ation  level  for  which  patterns are to be generated. The value of _hyph_start_ should be
           larger than any hyphenation level already present in _pattern_file_.

           Then, for each hyphenation level, the integer values of  _pat_start_  and  _pat_finish_,  the
           smallest  and  largest pattern length to be analyzed, as well as _good_ _weight_, _bad_ _weight_,
           and _threshold_, the weights for good and bad hyphens and a  weight  threshold  for  useful
           patterns.

           Finally  the  decision (`y' or `Y' vs. anything else) whether or not to produce a hyphen‐
           ated word list.

## FILES
       _$TEXMFMAIN/tex/generic/hyphen/hyphen.tex_
           The original hyphenation patterns for English, by Donald Knuth and Frank Liang.

       _<http://www.ctan.org/pkg/ushyph_>
           Additional hyphenation patterns for English, extended by Gerard Kuiken.

       _<http://www.ctan.org/pkg/hyph-utf8_>
           Collected hyphenation patterns for many languages in many formats.

       _<http://www.ctan.org/tex-archive/language/_>
           General CTAN directory for patterns and support for many other languages.

## SEE ALSO
       Frank Liang and Peter Breitenlohner, patgen.web.

       Frank Liang, _Word_ _hy-phen-a-tion_ _by_ _com-puter_, STAN-CS-83-977, Stanford University Ph.D. the‐
       sis, 1983, <http://tug.org/docs/liang>.

       Donald E. Knuth, _The_ _TeXbook_, Addison-Wesley, 1986, ISBN 0-201-13447-0, Appendix H.

## AUTHORS
       Frank Liang wrote the first version of this program.  Peter Breitenlohner made a  substantial
       revision  in  1991 for TeX 3.  The first version was published as the appendix to the _TeXware_
       technical report. Howard Trickey originally ported it to Unix.

Web2C 2023                                  16 June 2015                                   [_PATGEN_(1)](https://www.chedong.com/phpMan.php/man/PATGEN/1/markdown)
