I want to add comments to the sty file that should not be printed to the pdf, because the description is almost identical.

Is it possible to configure the dtx file, such that not every code added to the sty file is also printed in the pdf?

  • Short (end of line) comments or long (blocks of code) ones? – Joseph Wright Jun 3 '12 at 15:53
  • Can you give an example of what you mean? – egreg Jun 3 '12 at 16:07

The idiom used in the dtx files in the latex base is

% \iffalse
%% a comment to be copied to the .sty file
% \fi

The %% causes the comment to be copied to the generated files, and the \iffalse causes it to be skipped while typesetting.

Or you could do

% \iffalse
%    \begin{macrocode}
% a comment
%    \end{macrocode}
% \fi
  • Is it also possible to add single % comments to the sty file? – Matthias Pospiech Jun 3 '12 at 17:00
  • 1
    I will give one way, but why do you want to do this? – David Carlisle Jun 3 '12 at 17:09
  • Mainly because double comment chars are not necessary from the TeX language itself they are more or less enforced by the dtx structure. I tend to document my code in the sty file itself, not only in the dtx files. But it looks strange with %% at each comment line. – Matthias Pospiech Jun 3 '12 at 20:11
  • The macrocode way that I added later is probably the way you want then, although it seems that you will be forever "fighting" docstrip which at its heart really wants to remove all comments. It might be better to modify docstrip to have a less verbose guard that does this, but then that complicates deployment.... – David Carlisle Jun 3 '12 at 20:17
  • Indeed, I am fighting with docstrip. But also I am struggling with ltxdoc and its very tiny set of commands. My personal estimation is that we need a better doc class that provides as much documented commands as those wonderful classes that are used (for example the one used by biblatex), but completely undocumented. – Matthias Pospiech Jun 3 '12 at 20:54

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.