5

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}.

⟨*afterpreamble⟩
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{pkgindoc}
         [1994/10/20 v1.1 Package Interface in Document (DPC)]
\def\reserved@a#1\do\@classoptionslist#2\do\filec@ntents#3\relax{%  
  \gdef\@preamblecmds{#1#3}}
\expandafter\reserved@a\@preamblecmds\relax
⟨/afterpreamble⟩
  • 3
    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
  • 1
    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
5

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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