1

I started using DocStrip and Doc. I already managed to use different guards or modules, to create different package files from one single .dtx-source and I am happy with that.

I am wondering, if it would be possible, to automatically integrate the module name into macro names?

For example, lets imagine, my foobar.ins file looks like this:

\input docstrip.tex

\generate{\file{foo.sty}{\from{foobar.dtx}{foo}}}
\generate{\file{bar.sty}{\from{foobar.dtx}{bar}}}

Further, lets suppose, my foobar.dtx file has some code like this:

% \begin{macro}{\ifmy@foo@baz}
% \begin{macro}{\ifmy@bar@baz}
% This boolean switch is used to activate special baz options.
%    \begin{macrocode}
%<foo>\ifmy@foo@baz
%<bar>\ifmy@bar@baz
%    \end{macrocode}

This works, no question. It would on the other hand, be much more elegant to set up the macro name automatically and being dependent on the guard/modulename which is used in the .ins file. When I run tex foobar.ins and look afterwards in the freshly created foo.sty file, I find at the top of the file something like This is file foo.sty, ... with option 'foo'. Docstrip is of course able to insert the actual option name into the file, it is creating (at least as comment).

Something like this would be nice:

%    \begin{macrocode}
\ifmy@\actualoption@baz
%    \end{macrocode}

as it would then be sufficient, to use only one line to generate all desired variants.

3
  • 1
    the l3 version of this (l3doc) has %<@@=⟨module ⟩> for exactly this use you could back port some of that logic to doc probably Jun 26 at 11:05
  • @DavidCarlisle thank you. This adds __ in Front of the module name but this seems to be the new future? Anyways, I think, this should do the trick. Thank you, David!
    – Jan
    Jun 28 at 7:17
  • @DavidCarlisle having updated my TeXLive, I think, l3doc has made it into the final state. At least the file docstrip.pdf now lists also this %<@@=module> feature.
    – Jan
    Jun 30 at 19:29

Your Answer

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

Browse other questions tagged or ask your own question.