PATGEN(1)

πŸ“¦ version 2026.0, in alpine 3.24

✨ 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
  • good hyphens (correctly found by the patterns)
  • bad hyphens (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_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 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 🌟


πŸŽ€ 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