Latest news 2019-11-04: The giveaway of two signed copies of “Quack, quack, quack. Give my hat back!” has closed and the winning entrants have been selected. Thank you to everyone who took part.

A.1 DTX and INS Files

[Documented LaTeX sources (.dtx files)]Not all packages are provided in the TDS format. Instead (or additionally) many are supplied with the code and documentation all bundled together in one file. This file usually has the extension .dtx, and it usually comes with an installation script that has the extension .ins. Once you have downloaded the .dtx and .ins files, you will then have to extract the code before you can use it. Let's go back to the previous example. The package sample-package is now distributed in a DTX file, so the sample-package.zip archive contains the files
sample-package.dtx sample-package.ins
(with hopefully a README or INSTALL file). Note that this archive, unlike the TDS one, doesn't contain any .sty files. The documentation source and the package code (sample-package.sty, sample-foo.sty and sample-bar.sty) are all contained in the file sample-package.dtx. This is how to extract them:
  1. Extract the contents of sample-package.zip to a temporary directory.

  2. Run LaTeX on the file sample-package.ins. If you are using a terminal, you can type the following at the command prompt:
    latex sample-package.ins
    If you are using a front-end, such as TeXWorks, open the .ins file (for example sample-package.ins), and click on the build/typeset button.

    This will create the files containing the package code. In this example it will create the main package file sample-package.sty and supplementary packages sample-foo.sty and sample-bar.sty.

  3. Make a sub-directory of <TEXMF-LOCAL>/tex/latexA.2 in which to place these files. In this example, the package is called “sample-package”, so make a sub-directory called sample-package.

  4. Move the files created in Step 2 into the new sub-directory you created in the previous step.

  5. Run PDFLaTeX on the file sample-package.dtx. (The same as in Step 2, but use the file sample-package.dtx instead of sample-package.ins.) This will create a file called sample-package.pdf. You may need to repeat this step to ensure that the cross references are up-to-date. Check the README file or INSTALL file to see if there is anything else you need to do. (If you have downloaded the package from CTAN, it's possible that the documentation has already been supplied, as package authors are encouraged to supply a PDF version of the documentation for on-line viewing. If so, you can omit this step.)

  6. Make a sub-directory of <TEXMF-LOCAL>/doc/latexA.3 in which to place the documentation. In this example, the package is called “sample-package”, so make a sub-directory called sample-package.

  7. Move the files created in Step 5 into the new sub-directory you created in the previous step.

As mentioned above, on older TeX-distributions, you would then need to refresh the TeX database, but this isn't required for <TEXMF-HOME> installs on new distributions.


or <TEXMF-LOCAL>\tex\latex on Windows
or <TEXMF-LOCAL>\doc\latex on Windows

This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-00-5).

© 2012 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs