TeX format 2026-11-05
A TeX format is a prepared collection of definitions and initialization state used with TeX. A TeX format file, conventionally ending in
.fmt, stores internal structures so they can be loaded efficiently instead of reconstructed from the original initialization input.[ref]Plain TeX supplies one such foundation; LaTeX supplies another, with document-level conventions and facilities. The same mathematical input
$x^2$ can be embedded in either system, but an authoring command defined by one format need not be available in the other.Keeping the layers separate helps diagnose a failed document. The TeX implementation provides TeX primitives; the format makes further TeX macros and defaults available; a document invokes those definitions. Loading a different format can change the meaning or availability of commands without changing their spelling in the input file.
TeX format file 2026-11-05
A TeX format file stores initialized internal structures for a TeX format, usually under a
.fmt filename. Loading it reconstructs prepared definitions and related state more quickly than rereading the initialization input. Creating it uses the initialization facility and the \dump command.[ref]TeX by Topic by Victor Eijkhout. §33.1.2, pp.257–258: compact internal dump, load and initialization
This is an example of serialization. Suppose an initialization input defines
\def\banner{First} and its state is saved. Changing the original input to define Second does not by itself replace the already saved state. The format must be regenerated, or the loaded definition explicitly changed, for subsequent processing to use that new initialization.A loaded TeX format file initializes future document processing. The document can then add further TeX macros, change parameters and request mathematical typesetting. The relevant implementation must be able to read the saved representation; a
.fmt suffix alone does not establish compatibility between different implementations.