PATGEN(1)
πΈ NAME πΈ
patgen β generate patterns for TeX hyphenation π
β¨ SYNOPSIS β¨
patgen dictionary_file pattern_file patout_file translate_file
π DESCRIPTION π
okay bestie, real talk first: this manual page is not meant to be exhaustive. Not even a little. If you want the whole lore, go read the Info file, or the manual Web2C: A TeX implementation, which ships as part of the TeX Live distribution or lives at http://tug.org/web2c. π«Ά
So. What does patgen actually do? It reads the dictionary_file, which holds a list of hyphenated words, plus the pattern_file, which holds previously-generated patterns (if any) for a particular language β and heads up, that is not a complete TeX source file, see below for the tea β β and it produces the patout_file containing (previously- plus newly-generated) hyphenation patterns for that language. Iconic. π
The translate_file is the one that defines the language specific values for the parameters left_hyphen_min and right_hyphen_min used by TeX's hyphenation algorithm, and also the external representation of the lower and upper case version(s) of all letters of that language. β¨
Further details of the pattern generation process β like hyphenation levels and pattern lengths β are requested interactively from the user's terminal. Yes bestie, it's gonna ask you stuff. Be ready. π
Optionally, 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. Cute, right? πΈ
The patterns generated by patgen can be read by initex for use in hyphenating words. For a real-life example of patgen's output, look at $TEXMFMAIN/tex/generic/hyphen/hyphen.tex β that's the file with 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. Like, none. Don't @ me. π
π 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 sequences, subject to the condition that no such sequence is a prefix of another one. No cap. π§
π Dictionary file
A dictionary file contains a weighted list of hyphenated words, one word per line starting in column 1.
- A digit in column 1 indicates a global word weight (initially
=1) applicable to all following words up to the next global word weight. - A digit at some intercharacter 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. And when reading a dictionary file, * is treated like - and . is ignored. Periodt. π
π 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 .... That's it. That's the whole vibe check. β
π 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. She's structured, your honor. π
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. Defaults ate. π
β Terminal input
After reading the translate_file and any previously-generated patterns from pattern_file, patgen requests input from the user's terminal. Yes, it's talking to you directly. Main character energy. π
First the integer values of hyph_start and hyph_finish, the lowest and highest hyphenation 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. Important!! π¨
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 hyphenated word list. Just y. Or Y. Anything else is a no. π
π FILES π
$TEXMFMAIN/tex/generic/hyphen/hyphen.texβ The original hyphenation patterns for English, by Donald Knuth and Frank Liang. The blueprint. The blueprint blueprint. π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. A whole buffet. π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. thesis, 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. Legends, all of them. π«Άβ¨
and that's the whole page, bestie!! this came to you from the Web2C 2025 era, dated 16 June 2015, and it's the PATGEN(1) page from the General Commands Manual. go generate some patterns and slay π
π
π¦ where this page comes from
- alpine 3.24: texlive-doc 2026.0-r0 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- fedora 44: texlive-patgen 12:svn77830-105.fc44 Β· LicenseRef-Fedora-Public-Domain
- fedora 44: texlive-patgen 12:svn77830-111.fc44 Β· LicenseRef-Fedora-Public-Domain
- opensuse-leap 16.0: texlive-patgen 2025.221.2.4svn73848-160000.3.1 Β· SUSE-Public-Domain
- ubuntu resolute: texlive-binaries 2025.20250727.75242+ds-5build1 Β· TeX-Live
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms