The DTX format allows to generate both the package code (
.sty file) and documentation (
Is it possible to generate several PDFs (for example for different languages) from a single dtx file?
My answers is split in two parts: first I show how DTX files, i.e. docstrip tags, can be used to extract different parts for different language and then I discuss the issue that you have in a real DTX file for a package.
In general you can use the docstrip tags
Then have a INS file like this:
And compile it as follows:
However, note that the normal documentation in a DTX file is commented out, so that it is not (and cannot) be extracted. If you want to have multiple languages in one DTX file you could use some if-switches in the documentation part and then have a small wrapper which sets this if-switch accordantly.
I did something like this for my
There I have at the beginning of the DTX file, just before
In the document I use it like this:
Then at the end I have the following wrapper code which sets the if-switch to false which enables the German parts and simply inputs the DTX file. For this to work you need to use an explicit name in
The INS file contains instructions to extract this to to a TEX file:
Then to compile the manual in English run
You can use