0

I just realized that I have three copyright sections in my DocTeX templates ??? I was trying to merge my templates, generated from the DTXTut by Scott Pakin, with the model DTX file, proposed by Joseph Wrights.

% ^^A Read Me and Copyright
%
% \iffalse meta-comment
% !TEX program = pdfLaTeX
%
%<*internal>
\iffalse
%</internal>
%<*readme>
----------------------------------------------------------------------
Package : <PACKAGE>
Author  : <AUTHOR>
E-Mail  : <E-MAIL>
Licence : LaTeX Project Public Licence (LPPL) v1.2 or later
          (See https://www.latex-project.org/lppl.txt)
----------------------------------------------------------------------

A LaTeX package providing a style/class file for use in ones documentation.

%</readme>
%<*internal>
\fi
%</internal>
%
% Copyright (C) 2019 by <AUTHOR> <<E_MAIL>>
% -----------------------------------------
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.2 of this license or (at your option) any later
% version. The latest version of this license is in:
%
% http://www.latex-project.org/lppl.txt
%
% and version 1.2 or later is part of all distributions 
% of LaTeX version 1999/12/01 or later.
%
% \fi

Then later on I have the same thing repeated no less then twice.

% \iffalse
%
% ^^A Package Installation
%
%<*batchfile>
\begingroup
%%
%% Copyright (C) 2019 by <AUTHOR> <<E_MAIL>>
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.2 of this license or (at your option) any later
%% version. The latest version of this license is in:
%%
%% http://www.latex-project.org/lppl.txt
%%
%% and version 1.2 or later is part of all distributions of
%% LaTeX version 1999/12/01 or later.
%%

\input docstrip.tex
\keepsilent
\askforoverwritefalse         % ^^A Always overwrite
\preamble

This is a file was autogenerate from the \jobname package.

\endpreamble
\postamble

Copyright (C) 2019 by <AUTHOR> <<E_MAIL>>

This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL),
either version 1.2 of this license or (at your option)
any later version. The latest version of this license 
is in:

  http://www.latex-project.org/lppl.txt

and version 1.2 or later is part of all distributions 
of LaTeX version 1999/12/01 or later.

\endpostamble

\usedir{doc/latex/\jobname}
\generate{
 \nopreamble
 \nopostamble
 \file{\jobname/README.txt}{\from{\jobname.dtx}{readme}}}
\usedir{source/latex/\jobname}
\generate{\file{\jobname/\jobname.ins}{\from{\jobname.dtx}{batchfile}}}
\usedir{source/latex/\jobname}
\generate{\file{\jobname/\jobname.sty}{\from{\jobname.dtx}{Pkg,Sty}}}
\nopreamble\nopostamble

\endgroup
%</batchfile>
% \fi

If I recall correctly the first repeat is from me copy/pasting the entire *.ins template directly into my *.dtx template many moons ago. The second repeat is to assist in the production of the Copyright message in the output files. I intend to delete the first repeat since the *.ins file is merged into the *.dtx file and I see no reason to regenerate it beyond debugging (Joseph Wright does so in his templates for some reason). For the second repeat I was wondering if one might merge it with the original in some way, perhaps there is some guard trickery I'm unaware of that might be leveraged ?

  • 1
    Do you mean duplicate? Duplicitous sounds rather accusatory and the rest of your question doesn't imply you're accusing anyone of deceit. – Chris H Jan 4 at 15:12
  • 2
    @ChrisH You had me reaching for old oxford there. Triplicate is probably best. Though dubious might be better since the author of the original templates (a.k.a. myself) was a touch sloppy and the O.P. (a.k.a. myself) has been duplicit in his use of duplicitous for some time it would seem... – Carel Jan 4 at 15:27
  • It seems that the \preamble...\endpreamble block was actually overwriting a default message produced by DocStrip itself that instructs the user of the generated files to consult the source *.dtx file for the copyright information. I'll leave the question open for a bit then close it with a fleshed out version of this comment. – Carel Jan 4 at 16:24
0

Firstly the inclusion of a \preamble is actually unnecessary, DocStrip will include the following message by default (I guess both DTXtut and the model DTX file are overwriting this for illustrative purposes). In my case the latter copyrights could've been dropped.

%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from invoice/invoice.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file invoice.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.)

To overwrite the default and produce a copyright in all of ones generated documents the following seems to work.

% \iffalse meta-comment
% !TEX program = pdfLaTeX
%
%<*batchfile>
\begingroup

\input docstrip.tex

\preamble

Copyright (C) 2019 by <AUTHOR> <<E-MAIL>>
-----------------------------------------

This file may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
version 1.2 of this license or (at your option) any later
version. The latest version of this license is in:

http://www.latex-project.org/lppl.txt

and version 1.2 or later is part of all distributions 
of LaTeX version 1999/12/01 or later.

\endpreamble
%</batchfile>
% \fi

A few things ought to be noted however :

  • This works since

    % \iffalse meta-content 
    ... 
    % \fi 
    

    is really a

    % \iffalse
    ... 
    % \fi
    

    block. meta-content has no meaning, it is merely a convention.

  • The above code opens a group with \begingroup, this needs to be closed later on with an \endgroup.

    % \iffalse
    %<*batchfile>
    \keepsilent
    \askforoverwritefalse
    % Read Me
    \usedir{doc/latex/\jobname}
    \generate{
      \nopreamble
      \nopostamble
      \file{\jobname/README.txt}{\from{\jobname.dtx}{readme}}}
    % Install File (Still not sure why this is done in Joseph's model DTX file)
    \usedir{source/latex/\jobname}
    \generate{\file{\jobname/\jobname.ins}{\from{\jobname.dtx}{batchfile}}}
    % Produce the Style/Class file itself
    \usedir{source/latex/\jobname}
    \generate{\file{\jobname/\jobname.sty}{\from{\jobname.dtx}{Pkg,Sty}}}
    \endgroup
    %</batchfile>
    % \fi
    

    I actually don't know if one may \endgroup and then continue the \begingroup later on ? These macros are new to me. The model DTX file uses a Plain TeX check when using these macros, probably a compatibility thing. I can recall one DTX related document saying these complex constructs were unnecessary but I can't recall the source nor the reason why.

  • We need to import docstrip.tex to make the \preamble and \endpreamble macros available. There are also \declarepreamble\BLOB and \declarepostamble\BLOB macros that one can use to name a pre/postamble, this is referenced wherever necessary using \usepreamble\BLOB and \usepostamble\BLOB respectively. I'm not sure if \BLOB's are interchangeable.

  • I moved the read me code out of the % \iffalse meta-content ... % \fi block into its own block. That is everything between

    <*internal>
    \iffalse
    </internal>
    ...
    

    and

    <*internal>
    \fi
    </internal>
    
  • I stand corrected on this but it seems <batchfile> is standard for the Doc/DocStrip utils. I'm unsure where the <install> tag comes from in the model DTX file. Perhaps they are synonymous ?

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.