निरंजन
Consider these files:
#### `duck.dtx`
```
% \iffalse meta-comment
%<*driver>
\documentclass{l3doc}
\begin{document}
\DocInput{duck.dtx}
\end{document}
%</driver>
% \fi
% \begin{macrocode}
%<*bar>
\def\duck{duck}
%</bar>
%<*foo>
\def\quack{quack}
%</foo>
%<*bar>
\def\foo{bar}
%</bar>
% \end{macrocode}
```
#### `duck.ins`
```
\input l3docstrip.tex
\generate{%
\file{\jobname.sty}{\from{\jobname.dtx}{bar}}%
}
\generate{%
\file{another-\jobname.sty}{\from{\jobname.dtx}{foo}}%
}
\endbatchfile
```
Running the duck.ins produces `duck.sty` and `another-duck.sty` which look as follows:
#### `duck.sty`
```
%%
%% This is file `duck.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% duck.dtx (with options: `bar')
%%
%% IMPORTANT NOTICE:
%%
%% For the copyright see the source file.
%%
%% Any modified versions of this file must be renamed
%% with new filenames distinct from duck.sty.
%%
%% For distribution of the original source see the terms
%% for copying and modification in the file duck.dtx.
%%
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
\def\duck{duck}
\def\foo{bar}
\endinput
%%
%% End of file `duck.sty'.
```
#### `another-duck.sty`
```
%%
%% This is file `another-duck.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% duck.dtx (with options: `foo')
%%
%% IMPORTANT NOTICE:
%%
%% For the copyright see the source file.
%%
%% Any modified versions of this file must be renamed
%% with new filenames distinct from another-duck.sty.
%%
%% For distribution of the original source see the terms
%% for copying and modification in the file duck.dtx.
%%
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
\def\quack{quack}
\endinput
%%
%% End of file `another-duck.sty'.
```
Embedding these tags, (i.e., `foo` and `bar`) produces weird results both in the generated files as well as the typeset documentation. I wanted to ask if it is possible to export the contents of a tag to two files at a time, so in the case of this example, is it possible to have the content of tag `foo`, (i.e., `\def\quack{quack}`) in both the generated files, while keeping the other content only for the specified files?
Top Answer
Skillmon
The second argument to `\from` is actually a comma separated list of tags you want to include, so to have both `foo` and `bar` in the output of a single file you just use
```
\generate{\file{<name>}{\from{<source>}{foo,bar}}}
```
In case you didn't know, you can also put multiple `\file`-commands in a single `\generate`, so your `duck.ins` might look like the following:
```
\input l3docstrip.tex
\generate{%
\file{\jobname.sty}{\from{\jobname.dtx}{foo,bar}}%
\file{another-\jobname.sty}{\from{\jobname.dtx}{foo}}%
}
\endbatchfile
```