Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

1 Answer 1

up vote 7 down vote accepted

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
share|improve this answer
    
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
add comment

Your Answer

 
discard

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.