28.03.2013 Views

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

464 Appendix D. L AT E X Programming<br />

it behaves like a driver file. However, the .drv file can be edited by the<br />

user <strong>to</strong> select, say, just the user manual <strong>and</strong> <strong>to</strong> suppress the programmer<br />

notes.<br />

The next sections describe first the extraction program DocStrip, which<br />

can be used for many other applications as well (e.g. cus<strong>to</strong>m-bib, Section<br />

14.3), <strong>and</strong> then the integrated documentation scheme in the following<br />

section.<br />

D.7.1 The DocStrip utility<br />

Since the T E X program is a programming as well as a text formatting<br />

language, it can be exploited <strong>to</strong> provide a number of utility ‘programs’ <strong>to</strong><br />

manipulate files. Such programs are immediately portable: if you have<br />

T E X, you can run them. One example of such a program is the DocStrip<br />

utility for extracting functioning code out of one or more source files<br />

containing documentation, as comments. The program was originally<br />

written by Frank Mittelbach <strong>and</strong> further developed by Johannes Braams,<br />

Denys Duchier, Marcin Woliński, <strong>and</strong> Mark Wooding.<br />

The basic idea was <strong>to</strong> copy one file <strong>to</strong> another leaving off all the<br />

comment lines. From this simple concept came two additional features<br />

that extended the application of DocStrip: alternative lines of coding<br />

could be selectively suppressed or included depending on options chosen<br />

at processing time; <strong>and</strong> multiple files, or modules, could be input <strong>to</strong> form<br />

a single output file. This means that one source file can be the home<br />

of several different L AT E X packages, <strong>and</strong> that a single package file can be<br />

constructed out of many different components, as for the main L AT E X file<br />

latex.ltx mentioned above.<br />

Running interactively<br />

The simplest way of running DocStrip on a file is <strong>to</strong> invoke it with T E X (or<br />

L AT E X, but T E X is faster), as<br />

tex docstrip<br />

which produces the response<br />

**********************************************************<br />

* This program converts documented macro-files in<strong>to</strong> fast *<br />

* loadable files by stripping off (nearly) all comments! *<br />

**********************************************************<br />

****************************************************<br />

* First type the extension of your input file(s): *<br />

\infileext=<br />

****************************************************

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!