When generating files with the docstrip utility, it adds a preamble of %-commented lines. This easily violates the syntax of output files, if they are not latex formats.

E.g. running pdftex on the file minimal.dtx (see below), will produce a syntactically incorrect skeleton starting with

%% This is file `minimal.py',
%% generated with the docstrip utility.
%% The original source files were:
%% ...
%% End of file `minimal.py'.


%\iffalse -- Ignore driver section when typesetting.
\iffalse ---- SINGLE-FILE: INS FILE INCLUDED ---- \fi
% \section{Imports}
%    \begin{macrocode}
import sys
import os
%    \end{macrocode}

The solution is to use the \nopreamble and \nopostamble commands before invoking \generate, which suppress this output.

If the output file is sensitive to empty lines at the beginning of the file, it is additionally important to properly comment out all empty lines, that are not delimited by docstrip tags (%<tag> or %<*tag>...%</tag>).

See docstrip.pdf on CTAN for details.

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.