If you are going to write a large class or package for LaTeX then
you should consider using the doc
software which comes with
LaTeX.
LaTeX classes and packages written using this can be
processed in two ways: they can be run through LaTeX, to produce
documentation; and they can be processed with docstrip
, to produce
the .cls
or .sty
file.
The doc
software can automatically generate indexes of definitions,
indexes of command use, and change-log lists. It is very useful for
maintaining and documenting large TeX sources.
The documented sources of the LaTeX kernel itself, and of the
standard classes, etc, are doc
documents; they are in the .dtx
files in the distribution. You can, in fact, typeset the source code
of the kernel as one long document, complete with index, by running
LaTeX on source2e.tex
.
For more information on doc
and docstrip
, consult the files
docstrip.dtx
, doc.dtx
, and The LaTeX Companion. For examples of its
use, look at the .dtx
files.