Home

dtx

dtx is a file extension used in the TeX/LaTeX ecosystem for documented source files. A dtx file, short for documented TeX, combines human-readable documentation with TeX/LaTeX code in a single literate source. The standard workflow is to write the package as a dtx, then use the docstrip tool to extract the actual code into a .sty or .cls file and to generate a separate documentation file, usually a PDF or TeX document.

Dtx files are commonly associated with the LaTeX project and with the package authoring conventions from the

To build a package, one typically runs latex on the .dtx to produce the rendered documentation, and

The dtx format remains widely used for traditional LaTeX packages, although newer tooling and packaging practices

TeX
distribution.
The
documentation
portion
explains
the
package's
purpose,
commands,
and
usage,
while
the
code
portion
contains
the
implementation.
Portions
of
the
source
are
marked
for
extraction
by
docstrip;
these
code
blocks
are
removed
from
the
documentation
when
producing
the
installation
file.
runs
latex
on
the
.ins
file
(or
uses
a
build
script)
to
extract
the
code
into
the
final
package
file(s)
such
as
.sty
or
.cls.
This
approach
supports
both
documentation
and
distribution
from
a
single
literate
source,
simplifying
updates
and
versioning.
complement
or
supplant
it
in
some
projects.
Notable
examples
include
many
core
LaTeX
packages
that
are
distributed
with
both
documentation
and
code
in
.dtx
form.