PATGEN(1)
β¨ PATGEN(1) β¨
okay so first things first, bestie: this is patgen, and it lives in the General Commands Manual section 1. yes we're doing manpage section lore now, it's a whole thing π
π NAME π
patgen β generate patterns for TeX hyphenation
like, it literally makes hyphenation patterns. that's the whole gig. iconic.
π¦ SYNOPSIS π¦
patgen dictionary_file pattern_file patout_file translate_file
four files, in that exact order, no swapsies. periodt.
πΈ DESCRIPTION πΈ
so here's the vibe π β the patgen program reads a dictionary_file that's got a list of hyphenated words in it, plus a pattern_file that holds previously-generated patterns (if there even are any) for a particular language. and heads up: that pattern file is not a complete TeX source file, okay? see below, iykyk.
then it produces the patout_file, which contains the previously-generated plus the newly-generated hyphenation patterns for that language. slay.
the translate_file is where you define language-specific values for the parameters left_hyphen_min and right_hyphen_min that TeX's hyphenation algorithm uses, plus the external representation of the lower and upper case version(s) of all the letters of that language.
all the further details of the pattern generation process β think hyphenation levels and pattern lengths β get requested interactively from the user's terminal. so yes, you gotta be there for it. π
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 little receipt of what happened.
the patterns generated by patgen can be read by initex(1) for use in hyphenating words π«Ά. and for the original example of patgen's output, go look at (in TeX Live) $TEXMFMAIN/tex/generic/hyphen/hyphen.tex β that's the one containing the patterns TeX uses for English by default. in TeX Live, patterns for (many) other languages are available too (unless someone chose not to install them, which, rude, but okay).
β οΈ real talk: all filenames must be complete. no adding of default extensions, no path searching. nothing. it does not go looking for your files, bestie. you bring the files.
β FILE FORMATS β
π§ Letters
when initex digests hyphenation patterns, TeX first expands macros, and the result must entirely consist of digits (those are hyphenation levels), dots (. , meaning the edge of a word), and letters.
in pattern files for non-English languages, letters are often represented by macros or other expandable constructs. for patgen's purposes these are just character sequences β subject to the condition that no such sequence is a prefix of another one. no prefix-stealing in this house. π
π Dictionary file
a dictionary file contains a weighted list of hyphenated words, one word per line, each 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
goodhyphens (correctly found by the patterns)badhyphens (erroneously found by the patterns)
respectively. and when reading a dictionary file, * is treated like - and . is ignored. noted. π
π 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 an invalid pattern file for TeX.
\patterns{%
...
}
pattern files can only contain the actual patterns, i.e., the .... that's it. that's the whole file. π₯
π Translate file
a translate file starts with a line containing:
- the values of
left_hyphen_minin columns 1-2 right_hyphen_minin 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 extended with blanks as for many TeX related programs. very TeX-core of them.
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 default values are left_hyphen_min=2, right_hyphen_min=3, and the 26 lower case letters a...z with their upper case representations A...Z. defaults are lowkey serving.
π 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 interactive, it wants to chat. π«Ά
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. (should! respect the should!)
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. so y/Y = yes, literally anything else = no. no judgement. π
π FILES π
$TEXMFMAIN/tex/generic/hyphen/hyphen.texβ the original hyphenation patterns for English, by Donald Knuth and Frank Liang. the blueprint. the moment. β$TEXMFMAIN/tex/generic/hyphen/zerohyph.texβ a pattern file with no patterns, for languages that don't use hyphenation. zero patterns, zero problems. π¦
π 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, Appendix H.
https://ctan.org/pkg/hyphenexβ hyphenation exceptions for American English, maintained by the TUGboat editors, and used in TUGboat articles by default.https://ctan.org/pkg/hyph-utf8β collected hyphenation patterns for many languages in many formats.https://ctan.org/pkg/ushyphβ large set of additional hyphenation patterns for English, extended by Gerard Kuiken.https://ctan.org/tex-archive/language/β general CTAN directory for patterns and support for many other languages.https://tug.org/TUGboat/Contents/listkeyword.html#CatTAGMultilingualDocumentProcessingβ TUGboat articles on hyphenation and other aspects of language-specific document processing.
π 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. π
Public discussion list and bug reports: https://lists.tug.org/tex-k β go say hi, they're nice.
π okay that's the whole page!! this edition is brought to you by Web2C 2026, dated 10 January 2026 β so go forth, generate those patterns, and remember: complete filenames only. mwah. π β¨
π¦ where this page comes from
- alpine 3.24: texmf-dist-binextra-doc 2026.0-r0 Β· LPPL-1.0 AND LPPL-1.1 AND LPPL-1.2 AND LPPL-1.3a AND LPPL-1.3c AND GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms