I am maintaining a bunch of files, presenting packages and classes for my university corporate design. In order to use literate programming and have better documentation, I am playing around with DocStrip
. I was able to build the necessary basic .ins
-file and a .dtx
-file. I could build an useless sample.sty
from the .dtx
as well as a readable documentation from the same source.
I plan, to split the code of my packages and classes onto several .dtx
-sources, as a lot of code is identical in one or another resulting file.
I especially would love to have a dedicated version.dtx
file, which should be included in every package and class, DocStrip shall create. I intend to have a unique version info from the "package release date" in every single derived style and class.
What would be the best way? Is there any tutorial, that shows this trick?
Trying to set a LaTeX-Variable in the .ins
-file did not work, as the macro was not expanded.
Here is my sample.ins
:
\input docstrip.tex
\keepsilent
\preamble
Project Sample Test -- Versuche mit einer oder mehreren DTX-Dateien
\endpreamble
\usedir{tex/latex/sample}
%%% DOES NOT WORK!
%%% Define a version for all subsequent generated files
\def\TUC@Version{2017/02/05 v0.01a}
\generate{\file{sample.sty}{\from{sample.dtx}{package}}}
And this is the stripped down sample.dtx
:
% \iffalse meta-comment
Project Sample Test -- Versuche mit einer oder mehreren DTX-Dateien
% \fi
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<package>\ProvidesPackage{sample}
%<package> [\TUC@Version (Test with DocStrip)]
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{sample}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
\DocInput{sample.dtx}
\end{document}
%</driver>
% \fi
% \Finale
%
\endinput
\def
in the.ins
-file was just try -- and desaster :-) – Jan Feb 5 '17 at 18:08