TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

During a discussion of this question, I looked a bit into the pkgindoc.sty buried in ltclass.dtx (docstrip option afterpreamble). While I understand how this works (and it works in an ugly way IMHO), I am quite curious if anybody knows what the original purpose of it was (and whether it's documented anywhere)? (It seems that pkgindoc.sty is not generated during normal LaTeX installation, and I've never heard about it from anywhere, including the previous two answers to the above-mentioned question.)

Here is the relevant section from ltclass.dtx for reference:

71   After Preamble

Finally we declare a package that allows all the commands declared above to be \@onlypreamble to be used after \begin{document}.

         [1994/10/20 v1.1 Package Interface in Document (DPC)]
share|improve this question
Instead of showing the (longer) generated file you can just cite section 71 of the LaTeX2e sources. – Andrey Vihrov Aug 1 '11 at 6:28
You're right, done. – mbork Aug 1 '11 at 8:47
I've taken the liberty to improve the citation yet more. If you don't like it, please revert it. – Andrey Vihrov Aug 1 '11 at 9:10
Great, thank you! I don't know Markdown, so I couldn't do it that nice at all":). – mbork Aug 1 '11 at 11:41
up vote 5 down vote accepted

It is used to allow things like \usepackage in the document body. This seems to have been used occasionally by members of the LaTeX Project for writing documentation (see for example this file written by Robin Fairbairns). However, I don't think it's documented anywhere.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.