Go to the first, previous, next, last question, table of contents.

Documented LaTeX sources (.dtx files)

LaTeX2e, and many support macro packages, are now written in a literate programming style, with source and documentation in the same file. This format, known as `doc', was originated by Frank Mittelbach. The documented sources conventionally have the suffix .dtx, and should normally be stripped of documentation before use with LaTeX. Alternatively you can run LaTeX on a .dtx file to produce a nicely formatted version of the documented code. An installation script (with suffix .ins) is usually provided, which needs the standard LaTeX2e docstrip package (among other things, the installation process strips all the comments that make up the documentation for speed when loading the file into a running LaTeX system). Several packages can be included in one .dtx file, with conditional sections, and there facilities for indices of macros etc. Anyone can write .dtx files; the format is explained in The LaTeX Companion (see books on TeX). There are no programs yet to assist in composition.

.dtx files are not used by LaTeX after they have been processed to produce .sty or .cls (or whatever) files. They need not be kept with the working system; however, for many packages the .dtx file is the primary source of documentation, so you may want to keep .dtx files elsewhere.


Go to the first, previous, next, last question, table of contents.