.dtx, and will normally be ‘stripped’ before use with LaTeX; an installation file (
.ins) is normally provided, to automate this process of removing comments for speed of loading. To read the comments, you can run LaTeX on the
.dtxfile to produce a nicely formatted version of the documented code. Several packages can be included in one
.dtxfile (they’re sorted out by the
.insfile), with conditional sections, and there are facilities for indexes of macros, etc. Anyone can write
.dtxfiles; the format is explained in The LaTeX Companion, and a tutorial is available from CTAN (which comes with skeleton
.insfiles). Composition of
.dtxfiles is supported in emacs by AUC-TeX. Another useful way of generating
.dtxfiles is to write the documentation and the code separately, and then to combine them using the makedtx system. This technique has particular value in that the documentation file can be used separately to generate HTML output; it is often quite difficult to make LaTeX to HTML conversion tools deal with
.dtxfiles, since they use an unusual class file. The sty2dtx system goes one step further: it attempts to create a
.dtxfile from a ‘normal’
.styfile with comments. It works well, in some circumstances, but can become confused by comments that aspire to “structure” (e.g., tabular material, as in many older packages’ file headers). The
.dtxfiles are not used by LaTeX after they have been processed to produce
.cls(or whatever) files. They need not be kept with the working system; however, for many packages the
.dtxfile is the primary source of documentation, so you may want to keep
.dtxfiles elsewhere. An interesting sideline to the story of
.dtxfiles is the docmfp package, which extends the model of the doc package to Metafont and MetaPost, thus permitting documented distribution of bundles containing code for Metafont and MetaPost together with related LaTeX code.
This answer last edited: 2011-06-01
Go to previous question, or next question
Go to FAQ home.
URL for this question: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=dtx
Comments, suggestions, or error reports? - see “how to improve the FAQ”.
This is FAQ version 3.26, released on 2013-02-25.