Debian Codegraph @

texmf-dist/source/latex/oberdiek/stampinclude.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: stampinclude.dtx
4 % Version: 2016/05/16 v1.1
5 % Info: Include files based on time stamps
6 %
7 % Copyright (C)
8 % 2008 Heiko Oberdiek
9 % 2016-2019 Oberdiek Package Support Group
10 % https://github.com/ho-tex/oberdiek/issues
11 %
12 % This work may be distributed and/or modified under the
13 % conditions of the LaTeX Project Public License, either
14 % version 1.3c of this license or (at your option) any later
15 % version. This version of this license is in
16 % https://www.latex-project.org/lppl/lppl-1-3c.txt
17 % and the latest version of this license is in
18 % https://www.latex-project.org/lppl.txt
19 % and version 1.3 or later is part of all distributions of
20 % LaTeX version 2005/12/01 or later.
21 %
22 % This work has the LPPL maintenance status "maintained".
23 %
24 % The Current Maintainers of this work are
25 % Heiko Oberdiek and the Oberdiek Package Support Group
26 % https://github.com/ho-tex/oberdiek/issues
27 %
28 % This work consists of the main source file stampinclude.dtx
29 % and the derived files
30 % stampinclude.sty, stampinclude.pdf, stampinclude.ins, stampinclude.drv.
31 %
32 % Distribution:
33 % CTAN:macros/latex/contrib/oberdiek/stampinclude.dtx
34 % CTAN:macros/latex/contrib/oberdiek/stampinclude.pdf
35 %
36 % Unpacking:
37 % (a) If stampinclude.ins is present:
38 % tex stampinclude.ins
39 % (b) Without stampinclude.ins:
40 % tex stampinclude.dtx
41 % (c) If you insist on using LaTeX
42 % latex \let\install=y\input{stampinclude.dtx}
43 % (quote the arguments according to the demands of your shell)
44 %
45 % Documentation:
46 % (a) If stampinclude.drv is present:
47 % latex stampinclude.drv
48 % (b) Without stampinclude.drv:
49 % latex stampinclude.dtx; ...
50 % The class ltxdoc loads the configuration file ltxdoc.cfg
51 % if available. Here you can specify further options, e.g.
52 % use A4 as paper format:
53 % \PassOptionsToClass{a4paper}{article}
54 %
55 % Program calls to get the documentation (example):
56 % pdflatex stampinclude.dtx
57 % makeindex -s gind.ist stampinclude.idx
58 % pdflatex stampinclude.dtx
59 % makeindex -s gind.ist stampinclude.idx
60 % pdflatex stampinclude.dtx
61 %
62 % Installation:
63 % TDS:tex/latex/oberdiek/stampinclude.sty
64 % TDS:doc/latex/oberdiek/stampinclude.pdf
65 % TDS:source/latex/oberdiek/stampinclude.dtx
66 %
67 %<*ignore>
68 \begingroup
69 \catcode123=1 %
70 \catcode125=2 %
71 \def\x{LaTeX2e}%
72 \expandafter\endgroup
73 \ifcase 0\ifx\install y1\fi\expandafter
74 \ifx\csname processbatchFile\endcsname\relax\else1\fi
75 \ifx\fmtname\x\else 1\fi\relax
76 \else\csname fi\endcsname
77 %</ignore>
78 %<*install>
79 \input docstrip.tex
80 \Msg{************************************************************************}
81 \Msg{* Installation}
82 \Msg{* Package: stampinclude 2016/05/16 v1.1 Include files based on time stamps (HO)}
83 \Msg{************************************************************************}
84
85 \keepsilent
86 \askforoverwritefalse
87
88 \let\MetaPrefix\relax
89 \preamble
90
91 This is a generated file.
92
93 Project: stampinclude
94 Version: 2016/05/16 v1.1
95
96 Copyright (C)
97 2008 Heiko Oberdiek
98 2016-2019 Oberdiek Package Support Group
99
100 This work may be distributed and/or modified under the
101 conditions of the LaTeX Project Public License, either
102 version 1.3c of this license or (at your option) any later
103 version. This version of this license is in
104 https://www.latex-project.org/lppl/lppl-1-3c.txt
105 and the latest version of this license is in
106 https://www.latex-project.org/lppl.txt
107 and version 1.3 or later is part of all distributions of
108 LaTeX version 2005/12/01 or later.
109
110 This work has the LPPL maintenance status "maintained".
111
112 The Current Maintainers of this work are
113 Heiko Oberdiek and the Oberdiek Package Support Group
114 https://github.com/ho-tex/oberdiek/issues
115
116
117 This work consists of the main source file stampinclude.dtx
118 and the derived files
119 stampinclude.sty, stampinclude.pdf, stampinclude.ins, stampinclude.drv.
120
121 \endpreamble
122 \let\MetaPrefix\DoubleperCent
123
124 \generate{%
125 \file{stampinclude.ins}{\from{stampinclude.dtx}{install}}%
126 \file{stampinclude.drv}{\from{stampinclude.dtx}{driver}}%
127 \usedir{tex/latex/oberdiek}%
128 \file{stampinclude.sty}{\from{stampinclude.dtx}{package}}%
129 }
130
131 \catcode32=13\relax% active space
132 \let =\space%
133 \Msg{************************************************************************}
134 \Msg{*}
135 \Msg{* To finish the installation you have to move the following}
136 \Msg{* file into a directory searched by TeX:}
137 \Msg{*}
138 \Msg{* stampinclude.sty}
139 \Msg{*}
140 \Msg{* To produce the documentation run the file `stampinclude.drv'}
141 \Msg{* through LaTeX.}
142 \Msg{*}
143 \Msg{* Happy TeXing!}
144 \Msg{*}
145 \Msg{************************************************************************}
146
147 \endbatchfile
148 %</install>
149 %<*ignore>
150 \fi
151 %</ignore>
152 %<*driver>
153 \NeedsTeXFormat{LaTeX2e}
154 \ProvidesFile{stampinclude.drv}%
155 [2016/05/16 v1.1 Include files based on time stamps (HO)]%
156 \documentclass{ltxdoc}
157 \usepackage{holtxdoc}[2011/11/22]
158 \begin{document}
159 \DocInput{stampinclude.dtx}%
160 \end{document}
161 %</driver>
162 % \fi
163 %
164 %
165 %
166 % \GetFileInfo{stampinclude.drv}
167 %
168 % \title{The \xpackage{stampinclude} package}
169 % \date{2016/05/16 v1.1}
170 % \author{Heiko Oberdiek\thanks
171 % {Please report any issues at \url{https://github.com/ho-tex/oberdiek/issues}}}
172 %
173 % \maketitle
174 %
175 % \begin{abstract}
176 % The package replaces \cs{includeonly} and selects the files for
177 % \cs{include} by inspecting the time stamp of the \xext{aux} file.
178 % The file is selected for inclusion if the \xext{aux} file does
179 % not yet exist or is older than the corresponding \xext{tex} file.
180 % \end{abstract}
181 %
182 % \tableofcontents
183 %
184 % \section{Documentation}
185 %
186 % \subsection{Introduction}
187 % \label{sec:intro}
188 %
189 % \LaTeX\ provides two commands \cs{include} and \cs{includeonly}
190 % that helps in organizing large projects.
191 % Example for a master file:
192 %\begin{quote}
193 %\begin{verbatim}
194 %\documentclass{book}
195 % % \includeonly{}
196 %\begin{document}
197 % \include{fileA}
198 % \include{fileB}
199 % \include{fileC}
200 %\end{document}
201 %\end{verbatim}
202 %\end{quote}
203 % All files are read and compiled if \cs{includeonly} is not
204 % executed. Otherwise you can give \cs{includeonly} a list
205 % of files in the preamble, e.g.:
206 % \begin{quote}
207 % |\includeonly{fileA,fileC}|
208 % \end{quote}
209 % Now only files \xfile{fileA.tex} and \xfile{fileC.tex} are read
210 % and compiled.
211 %
212 % If you change file \xfile{fileB.tex} and want to see only this
213 % file, then you must change the line with \cs{includeonly} to
214 % \begin{quote}
215 % |\includeonly{fileB}|
216 % \end{quote}
217 % It is tedious to do this again and again, if different files
218 % are changed.
219 %
220 % Package \xpackage{askinclude} \cite{askinclude}
221 % offers a solution for this problem. It interactively asks
222 % for the files to be included and saves the user from
223 % editing the master file.
224 %
225 % This package \xpackage{stampinclude} goes another way.
226 % \LaTeX\ reads and writes a separate \xext{aux} file for each
227 % file that is included by \cs{include}. There \LaTeX\ remembers
228 % counter values. Changed \xext{tex}
229 % files can therefore be detected by comparing the file date stamp of
230 % the \xext{tex} file with the date stamp of its \xext{aux} file.
231 % Since version 1.30.0 \pdfTeX\ provides \cs{pdffilemoddate}
232 % that reads the file date stamp. Thus this package uses this
233 % command and redefines
234 % \cs{include} to include the files that do not have \xext{aux}
235 % files yet or that are newer than its \xext{aux} file.
236 % \cs{includeonly} is ignored.
237 %
238 % \subsection{Usage}
239 %
240 % The package is loaded as normal \LaTeX\ package without options:
241 % \begin{quote}
242 % |\usepackage{stampinclude}|
243 % \end{quote}
244 % Alternatively the package may be loaded on the command line
245 % (Example for shell `bash'):
246 % \begin{center}
247 % |latex '\AtBeginDocument{\usepackage{stampinclude}}\input{master}'|
248 % \end{center}
249 % Without \cs{AtBeginDocument} (and \cs{RequirePackage} instead of
250 % \cs{usepackage}) \TeX\ would name the document \xfile{stampinclude.dvi}
251 % instead of \xfile{master.dvi}.
252 %
253 % \subsection{Limitations}
254 %
255 % \subsubsection{Other file dependencies}
256 %
257 % A file that is included by \cs{include} may input or reference
258 % other files:
259 % \begin{itemize}
260 % \item other \TeX\ files using \cs{input},
261 % \item graphics files (\cs{includegraphics}),
262 % \item listings of external files,
263 % \item ...
264 % \end{itemize}
265 % Updates of those files are not detected by this package.
266 % It limits the date stamp comparison of an \xext{aux} file
267 % to its \xext{tex} file.
268 %
269 % \subsubsection{\cs{include} dependencies}
270 %
271 % In the example, given in the introduction \ref{sec:intro},
272 % three files \xfile{fileA}, \xfile{fileB}, and \xfile{fileC}
273 % are included in this order. Now file \xfile{fileA} is changed by adding
274 % four pages, \xfile{fileB} remains untouched, and \xfile{fileC} is
275 % also updated. Then the package only selects \xfile{fileA} and
276 % \xfile{fileC} for inclusion. File \xfile{fileB} is not included.
277 % But \LaTeX\ has stored the counter values that are active
278 % at the end of \xfile{fileB} in \xfile{fileB.aux} in one of the
279 % previous runs when \xfile{fileB} was included.
280 % However the later addition of four pages in \xfile{fileA}
281 % was not known at that time. Therefore \xfile{fileB.aux}
282 % is out of date and the inclusion of file \xfile{fileC}
283 % starts with wrong counter values (especially the page counter).
284 %
285 % \subsubsection{Summary}
286 %
287 % This package \xpackage{stampinclude} and the \cs{include} feature
288 % helps in accelerating the \LaTeX\ compilation.
289 % But it is not intended for generating the final version.
290 % For the final version of the document it is better to include
291 % \emph{all} files to get all counter values right.
292 % Then this package and any \cs{includeonly} lines should be commented out:
293 %\begin{quote}
294 % |% \usepackage{stampinclude}|\\
295 % |% \includeonly{...}|
296 %\end{quote}
297 %
298 % \subsection{Requirements}
299 %
300 % \begin{itemize}
301 % \item \pdfTeX\ v1.30.0 (because of \cs{pdffilemoddate}
302 % and \cs{pdfstrcmp}),\\
303 % both modes for DVI and PDF are supported.
304 % \item Alternatively Lua\TeX\ may be used.
305 % It lacks \cs{pdffilemoddate} and \cs{pdfstrcmp}. But its services
306 % are provided by package \xpackage{pdftexcmds} \cite{pdftexcmds}
307 % that is automatically loaded.
308 % \end{itemize}
309 %
310 % \StopEventually{
311 % }
312 %
313 % \section{Implementation}
314 %
315 % \begin{macrocode}
316 %<*package>
317 \NeedsTeXFormat{LaTeX2e}
318 \ProvidesPackage{stampinclude}
319 [2016/05/16 v1.1 Include files based on time stamps (HO)]%
320 % \end{macrocode}
321 %
322 % \begin{macrocode}
323 \RequirePackage{pdftexcmds}[2007/12/12]%
324 % \end{macrocode}
325 %
326 % \begin{macrocode}
327 \begingroup
328 \chardef\x=1 %
329 \expandafter\ifx\csname pdf@filemoddate\endcsname\relax
330 \chardef\x=0 %
331 \fi
332 \expandafter\ifx\csname pdf@strcmp\endcsname\relax
333 \chardef\x=0 %
334 \fi
335 \expandafter\endgroup\ifcase\x
336 \PackageWarningNoLine{stampinclude}{%
337 \string\pdffilemoddate\space or %
338 \string\pdfstrcmp\space are not found,\MessageBreak
339 that are provided by pdfTeX >= 1.30.0.\MessageBreak
340 Also LuaTeX is not detected.\MessageBreak
341 Therefore package loading is aborted%
342 }%
343 \expandafter\endinput
344 \fi
345 % \end{macrocode}
346 %
347 % \begin{macro}{\SInc@org@include}
348 % \begin{macrocode}
349 \let\SInc@org@include\@include
350 % \end{macrocode}
351 % \end{macro}
352 % \begin{macro}{\@include}
353 % \begin{macrocode}
354 \def\@include#1 {%
355 \IfFileExists{#1.aux}{%
356 \ifnum\pdf@strcmp{\pdf@filemoddate{#1.aux}}%
357 {\pdf@filemoddate{#1.tex}}<0 %
358 \ifx\@partlist\@empty
359 \gdef\@partlist{{#1}}%
360 \else
361 \g@addto@macro\@partlist{,{#1}}%
362 \fi
363 \fi
364 }{%
365 \ifx\@partlist\@empty
366 \gdef\@partlist{{#1}}%
367 \else
368 \g@addto@macro\@partlist{,{#1}}%
369 \fi
370 }%
371 \SInc@org@include{#1} \relax
372 }
373 % \end{macrocode}
374 % \end{macro}
375 %
376 % \begin{macro}{\includeonly}
377 % Macro \cs{includeonly} is ignored.
378 % \begin{macrocode}
379 \renewcommand*{\includeonly}[1]{%
380 \PackageInfo{stampinclude}{%
381 Ignoring \string\includeonly
382 }%
383 }
384 % \end{macrocode}
385 % \end{macro}
386 %
387 % Simulate \cs{includeonly}.
388 % \begin{macrocode}
389 \@partswtrue
390 \gdef\@partlist{}
391 % \end{macrocode}
392 %
393 % Print included files at end of document.
394 % \begin{macrocode}
395 \AtEndDocument{%
396 \begingroup
397 \expandafter\let\expandafter\@partlist\expandafter\@empty
398 \expandafter\@for\expandafter\reserved@a
399 \expandafter:\expandafter=\@partlist\do{%
400 \ifx\@partlist\@empty
401 \edef\@partlist{\reserved@a}%
402 \else
403 \edef\@partlist{\@partlist, \reserved@a}%
404 \fi
405 }%
406 \typeout{********************%
407 ********************%
408 ********************%
409 ******************%
410 }%
411 \ifx\@partlist\@empty
412 \typeout{[stampinclude] No included files.}%
413 \else
414 \typeout{[stampinclude] Included files:}%
415 \typeout{\@partlist}%
416 \fi
417 \typeout{********************%
418 ********************%
419 ********************%
420 ******************%
421 }%
422 \endgroup
423 }
424 % \end{macrocode}
425 %
426 % \begin{macrocode}
427 %</package>
428 % \end{macrocode}
429 %
430 % \section{Installation}
431 %
432 % \subsection{Download}
433 %
434 % \paragraph{Package.} This package is available on
435 % CTAN\footnote{\CTANpkg{stampinclude}}:
436 % \begin{description}
437 % \item[\CTAN{macros/latex/contrib/oberdiek/stampinclude.dtx}] The source file.
438 % \item[\CTAN{macros/latex/contrib/oberdiek/stampinclude.pdf}] Documentation.
439 % \end{description}
440 %
441 %
442 % \paragraph{Bundle.} All the packages of the bundle `oberdiek'
443 % are also available in a TDS compliant ZIP archive. There
444 % the packages are already unpacked and the documentation files
445 % are generated. The files and directories obey the TDS standard.
446 % \begin{description}
447 % \item[\CTANinstall{install/macros/latex/contrib/oberdiek.tds.zip}]
448 % \end{description}
449 % \emph{TDS} refers to the standard ``A Directory Structure
450 % for \TeX\ Files'' (\CTANpkg{tds}). Directories
451 % with \xfile{texmf} in their name are usually organized this way.
452 %
453 % \subsection{Bundle installation}
454 %
455 % \paragraph{Unpacking.} Unpack the \xfile{oberdiek.tds.zip} in the
456 % TDS tree (also known as \xfile{texmf} tree) of your choice.
457 % Example (linux):
458 % \begin{quote}
459 % |unzip oberdiek.tds.zip -d ~/texmf|
460 % \end{quote}
461 %
462 % \subsection{Package installation}
463 %
464 % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
465 % \docstrip\ archive. The files are extracted by running the
466 % \xfile{.dtx} through \plainTeX:
467 % \begin{quote}
468 % \verb|tex stampinclude.dtx|
469 % \end{quote}
470 %
471 % \paragraph{TDS.} Now the different files must be moved into
472 % the different directories in your installation TDS tree
473 % (also known as \xfile{texmf} tree):
474 % \begin{quote}
475 % \def\t{^^A
476 % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
477 % stampinclude.sty & tex/latex/oberdiek/stampinclude.sty\\
478 % stampinclude.pdf & doc/latex/oberdiek/stampinclude.pdf\\
479 % stampinclude.dtx & source/latex/oberdiek/stampinclude.dtx\\
480 % \end{tabular}^^A
481 % }^^A
482 % \sbox0{\t}^^A
483 % \ifdim\wd0>\linewidth
484 % \begingroup
485 % \advance\linewidth by\leftmargin
486 % \advance\linewidth by\rightmargin
487 % \edef\x{\endgroup
488 % \def\noexpand\lw{\the\linewidth}^^A
489 % }\x
490 % \def\lwbox{^^A
491 % \leavevmode
492 % \hbox to \linewidth{^^A
493 % \kern-\leftmargin\relax
494 % \hss
495 % \usebox0
496 % \hss
497 % \kern-\rightmargin\relax
498 % }^^A
499 % }^^A
500 % \ifdim\wd0>\lw
501 % \sbox0{\small\t}^^A
502 % \ifdim\wd0>\linewidth
503 % \ifdim\wd0>\lw
504 % \sbox0{\footnotesize\t}^^A
505 % \ifdim\wd0>\linewidth
506 % \ifdim\wd0>\lw
507 % \sbox0{\scriptsize\t}^^A
508 % \ifdim\wd0>\linewidth
509 % \ifdim\wd0>\lw
510 % \sbox0{\tiny\t}^^A
511 % \ifdim\wd0>\linewidth
512 % \lwbox
513 % \else
514 % \usebox0
515 % \fi
516 % \else
517 % \lwbox
518 % \fi
519 % \else
520 % \usebox0
521 % \fi
522 % \else
523 % \lwbox
524 % \fi
525 % \else
526 % \usebox0
527 % \fi
528 % \else
529 % \lwbox
530 % \fi
531 % \else
532 % \usebox0
533 % \fi
534 % \else
535 % \lwbox
536 % \fi
537 % \else
538 % \usebox0
539 % \fi
540 % \end{quote}
541 % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
542 % TDS installing feature, then some files can already be in the right
543 % place, see the documentation of \docstrip.
544 %
545 % \subsection{Refresh file name databases}
546 %
547 % If your \TeX~distribution
548 % (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh
549 % these. For example, \TeX\,Live\ users run \verb|texhash| or
550 % \verb|mktexlsr|.
551 %
552 % \subsection{Some details for the interested}
553 %
554 % \paragraph{Unpacking with \LaTeX.}
555 % The \xfile{.dtx} chooses its action depending on the format:
556 % \begin{description}
557 % \item[\plainTeX:] Run \docstrip\ and extract the files.
558 % \item[\LaTeX:] Generate the documentation.
559 % \end{description}
560 % If you insist on using \LaTeX\ for \docstrip\ (really,
561 % \docstrip\ does not need \LaTeX), then inform the autodetect routine
562 % about your intention:
563 % \begin{quote}
564 % \verb|latex \let\install=y\input{stampinclude.dtx}|
565 % \end{quote}
566 % Do not forget to quote the argument according to the demands
567 % of your shell.
568 %
569 % \paragraph{Generating the documentation.}
570 % You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
571 % the documentation. The process can be configured by the
572 % configuration file \xfile{ltxdoc.cfg}. For instance, put this
573 % line into this file, if you want to have A4 as paper format:
574 % \begin{quote}
575 % \verb|\PassOptionsToClass{a4paper}{article}|
576 % \end{quote}
577 % An example follows how to generate the
578 % documentation with pdf\LaTeX:
579 % \begin{quote}
580 %\begin{verbatim}
581 %pdflatex stampinclude.dtx
582 %makeindex -s gind.ist stampinclude.idx
583 %pdflatex stampinclude.dtx
584 %makeindex -s gind.ist stampinclude.idx
585 %pdflatex stampinclude.dtx
586 %\end{verbatim}
587 % \end{quote}
588 %
589 % \begin{thebibliography}{9}
590 % \bibitem{askinclude}
591 % Pablo A. Straub, Heiko Oberdiek:
592 % \textit{The \xpackage{askinclude} package};
593 % 2007/10/23 v2.0;
594 % \CTANpkg{askinclude}.
595 %
596 % \bibitem{pdftexcmds}
597 % Heiko Oberdiek:
598 % \textit{The \xpackage{pdftexcmds} package};
599 % 2007/12/12 v0.3;
600 % \CTANpkg{pdftexcmds}.
601 %
602 % \end{thebibliography}
603 %
604 % \begin{History}
605 % \begin{Version}{2008/07/14 v1.0}
606 % \item
607 % First version.
608 % \end{Version}
609 % \begin{Version}{2016/05/16 v1.1}
610 % \item
611 % Documentation updates.
612 % \end{Version}
613 % \end{History}
614 %
615 % \PrintIndex
616 %
617 % \Finale
618 \endinput