summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/filemod
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/filemod')
-rw-r--r--Master/texmf-dist/source/latex/filemod/filemod.dtx333
-rw-r--r--Master/texmf-dist/source/latex/filemod/filemod.ins11
2 files changed, 272 insertions, 72 deletions
diff --git a/Master/texmf-dist/source/latex/filemod/filemod.dtx b/Master/texmf-dist/source/latex/filemod/filemod.dtx
index 7ec285e7c26..4f20c19ca3b 100644
--- a/Master/texmf-dist/source/latex/filemod/filemod.dtx
+++ b/Master/texmf-dist/source/latex/filemod/filemod.dtx
@@ -28,8 +28,10 @@
\keepsilent
\askforoverwritefalse
\generate{%
- \file{filemod.sty} {\nopreamble\from{filemod.dtx} {COPYRIGHT,package,parse,exp,exe,display,aux}}%
- \file{filemod-expmin.sty} {\nopreamble\from{filemod.dtx} {COPYRIGHT,expmin}}%
+ \file{filemod.sty} {\nopreamble\from{filemod.dtx} {COPYRIGHT,package,parse,exp,exe,display,aux,latex}}%
+ \file{filemod.tex} {\nopreamble\from{filemod.dtx} {COPYRIGHT,package,parse,exp,exe,display,aux,tex}}%
+ \file{filemod-expmin.sty} {\nopreamble\from{filemod.dtx} {COPYRIGHT,expmin,latex}}%
+ \file{filemod-expmin.tex} {\nopreamble\from{filemod.dtx} {COPYRIGHT,expmin,tex}}%
}
%</install>
%<install>\endbatchfile
@@ -42,21 +44,25 @@
%<*dtx>
\ProvidesFile{filemod.dtx}[%
%</dtx>
+%<*latex>
%<package>\ProvidesPackage{filemod}[%
%<expmin>\ProvidesPackage{filemod-expmin}[%
%<*dtx|package|expmin>
- 2011/03/23 v1.0
+ 2011/03/24 v1.1
%</dtx|package|expmin>
%<*dtx|package>
Get and compare file modification times]
%</dtx|package>
%<expmin> Get and compare file modification times (expandable; minimal)]
+%</latex>
%
%<*dtx>
\documentclass{ydoc}
-\usepackage{filemod}[2011/03/23]
+\usepackage{filemod}[2011/03/24]
\usepackage{multicol}
\usepackage{csquotes}
+\usepackage{tgpagella}
+\usepackage{dtklogos}
\MakeShortMacroArgs\`\relax
\EnableCrossrefs
\CodelineIndex
@@ -70,7 +76,7 @@
%</dtx>
% \fi
%
-% \CheckSum{566}
+% \CheckSum{765}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -90,6 +96,7 @@
%
%
% \changes{v1.0}{2011/03/23}{First release}
+% \changes{v1.1}{2011/03/24}{Added Lua(La)TeX and plain eTeX support.}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
@@ -99,12 +106,13 @@
% \maketitle
%
% \begin{abstract}
-% This package provides macros to read and compare the modification dates of files.
-% These files can be |.tex| files, images or other files as long as they can be found by the \LaTeX\ compiler.
-% It uses the |\pdffilemoddate| primitive of pdf\LaTeX\ to receive the file modification date as PDF
-% date string, parses it and returns the value to the user.
-% This package will also work for DVI output with recent versions of the \LaTeX\ compiler which uses pdf\LaTeX\ in DVI mode.
+% This package provides macros to read and compare the modification dates of files. These files can be |.tex| files,
+% images or other files as long as they can be found by the \LaTeX\ compiler. It uses the |\pdffilemoddate| primitive
+% of pdf\LaTeX\ to receive the file modification date as PDF date string, parses it and returns the value to the user.
% The functionality is provided by purely expandable macros or by faster but non-expandable ones.
+%
+% This package will work with \LaTeX{} and plain \eTeX{} as long pdf\LaTeXTeX{} (in PDF or DVI mode) or Lua\LaTeXTeX{}
+% is used. \XeTeX{} is not supported because it does not provide |\pdffilemoddate|.
% \end{abstract}
%
% \begin{multicols}{2}
@@ -112,26 +120,32 @@
% \end{multicols}
%
% \section{Introduction}
-% This package provides several macros to read and compare the modification dates of files.
-% The same functionality is provided by two groups of macros:
-% The macros of the first group all start with a lower case letter and are fully expandable.
-% This means they can be used in places where a string must be provided, like in `|\input` or `|\includegraphics`.
-% Because assignments are not expandable some of these macros, like the ones for comparisons, need to reread and re-parse the
-% file modification dates if they are required in more than one place inside the macro.
-%
-% The macros of the second group all start with a upper case letter and are not expandable because assignments are used internally.
-% However, this allows techniques which speed up the processing of these macros, making this macros faster than the expandable counterparts.
-% If expandability is not required these macros should be preferred.
+% This package provides several macros to read and compare the modification dates of files. The same functionality is
+% provided by two groups of macros: The macros of the first group all start with a lower case letter and are fully
+% expandable. This means they can be used in places where a string must be provided, like in `|\input`. Because
+% assignments are not expandable some of these macros, like the ones for comparisons, need to reread and re-parse the
+% file modification dates if they are required in more than one place inside the macro. The macros of the second group
+% all start with a upper case letter and are not expandable because assignments are used internally. However, this
+% allows techniques which speed up the processing of these macros, making this macros faster than the expandable
+% counterparts. If expandability is not required these macros should be preferred.
%
%
% \section{Usage}
-% The following macros are provided by this package:
+% This package can be loaded with \LaTeX{} using |\usepackage{filemod}| as usual.
+% With plain \eTeX{} it can be loaded using |\input filemod|.
+% Some required internal \LaTeX{} macros (like |\@gobble|, |\@firstofone|, etc.) are then defined.
+%
+% A minimal set of expandable macros for the comparison of file modification dates is provided by the sub-package
+% \pkg{filemod-expmin}. It is useful for other packages which need this functionality but don't like to load the whole package.
+% It can be loaded using |\usepackage{filemod-expmin}| (or |\RequirePackage|) or |\input filemod-expmin|, respectively.
+%
%
% \subsection{Print File Modification Date and Time}
-% The following macros can be used to print (i.e.\ typeset) the file modification date and time of files in the document.
-% The \Macro\formatdate and \Macro\formattime macros of the \pkg{datetime}\footnote{CTAN: \url{http://www.ctan.org/pkg/datetime}} can be used in addition to format the dates and times
-% in a language specific format.
-% See also the \pkg{getfiledate}\footnote{CTAN: \url{http://www.ctan.org/pkg/getfiledate}} package which also prints file modification dates including adding fancy frames around it.
+% The following macros can be used to print (i.e.\ typeset) the file modification date and time of files in the
+% document. The \Macro\formatdate and \Macro\formattime macros of the \pkg{datetime}\footnote{CTAN:
+% \url{http://www.ctan.org/pkg/datetime}} can be used in addition to format the dates and times in a language specific
+% format. See also the \pkg{getfiledate}\footnote{CTAN: \url{http://www.ctan.org/pkg/getfiledate}} package which also
+% prints file modification dates including adding fancy frames around it.
%
% \DescribeMacro{\filemodprint}{<\/filename>}
% Prints the file modifications date and time using `|\filemodparse` and `|\thefilemod`.
@@ -296,11 +310,14 @@
%
%
% \subsection{Parsing of the file modification date}
-% The format returned by the |\pdffilemoddate| primitive is \enquote{\texttt{D:}} followed by a number in the format \enquote{\texttt{YYYYMMDDHHmmSST}} which needs to be parsed before
-% it is useful. The letters have the following meaning: \texttt{Y} = year, \texttt{M} = month, \texttt{D} = day, \texttt{H} = hour, \texttt{mm} = minutes, \texttt{S} = seconds, \texttt{T} or \texttt{TZ} = timezone string. The number of letters indicates the length except for the timezone which is of variable length.
-% An example is \enquote{\texttt{\pdffilemoddate{\jobname.dtx}}} which is the file modification date of the source file of this manual.
-% Unfortunately this number is to large for TeX to be taken as an integer for numerical comparisons, so it is broken into two numbers (\texttt{YYYYMMDD} and \texttt{HHmmSS}) which are compared
-% in multiple steps.
+% The format returned by the |\pdffilemoddate| primitive is \enquote{\texttt{D:}} followed by a number in the format
+% \enquote{\texttt{YYYYMMDDHHmmSST}} which needs to be parsed before it is useful. The letters have the following
+% meaning: \texttt{Y} = year, \texttt{M} = month, \texttt{D} = day, \texttt{H} = hour, \texttt{mm} = minutes, \texttt{S}
+% = seconds, \texttt{T} or \texttt{TZ} = timezone string. The number of letters indicates the length except for the
+% timezone which is of variable length. An example is \enquote{\texttt{\pdffilemoddate{\jobname.dtx}}} which is the
+% file modification date of the source file of this manual. Unfortunately this number is to large for TeX to be taken
+% as an integer for numerical comparisons, so it is broken into two numbers (\texttt{YYYYMMDD} and \texttt{HHmmSS})
+% which are compared in multiple steps.
%
% \DescribeMacro{\filemodparse}{<macro>}{<\/filename>}
% Parses the file modification datetime of the given file and passes the result to the given macro.
@@ -341,6 +358,47 @@
% \section{Implementation}
%
% \iffalse
+%<*package|expmin>
+% \fi
+%
+% Ensure correct catcode for plainTeX:
+% \begin{macrocode}
+%<*tex>
+\expandafter\edef\csname filemod@cat\endcsname{\noexpand\catcode`\noexpand\@=\the\catcode`\@\relax}
+\catcode`\@=11
+%</tex>
+% \end{macrocode}
+%
+% Check if the \Macro\pdffilemoddate command is available. If not (e.g.\ with LuaLaTeX) the \pkg{pdftexcmds} is loaded
+% to provide the \Macro\pdf@filemoddate replacement. However for XeLaTeX this will fail and an error is raised.
+% \begin{macrocode}
+\ifx\filemod@directtrue\@undefined
+\csname newif\expandafter\endcsname\csname iffilemod@direct\endcsname
+\filemod@directtrue
+\ifx\pdffilemoddate\@undefined
+%<latex> \RequirePackage{pdftexcmds}
+%<tex> \input pdftexcmds.sty
+ \filemod@directfalse
+ \ifx\pdf@filemoddate\@undefined
+ \edef\filemod@help
+ {The required command \string\pdffilemoddate\space is not defined.
+ This means that the used\space\space LaTeX compiler does not support it.
+ Please make sure that pdfLaTeX 1.30.0 or\space\space\space newer or LuaLaTeX is used.
+ XeLaTeX does not support reading file modification\space\space dates.
+ }%
+%<latex> \PackageError{filemod}{Required command \string\pdffilemoddate\space is not defined!}{\filemod@help}
+%<tex> \errhelp\expandafter{\filemod@help}
+%<tex> \errmessage{filemod package: Required command \string\pdffilemoddate\space is not defined!}
+ \fi
+\fi
+\fi
+% \end{macrocode}
+%
+% \iffalse
+%</package|expmin>
+% \fi
+%
+% \iffalse
%<*parse>
% \fi
% \subsection{Parser}
@@ -349,9 +407,17 @@
%
% \begin{macro}{\filemodparse}[2]{Macro or tokens to process result}{file name}
% \begin{macrocode}
-\newcommand*\filemodparse[2]{%
+%<latex>\newcommand*\filemodparse{}
+\iffilemod@direct
+\def\filemodparse#1#2{%
\expandafter\filemod@parse\pdffilemoddate{#2}\relax{#1}%
}
+\else
+\def\filemodparse#1#2{%
+ \expandafter\expandafter
+ \expandafter\filemod@parse\pdf@filemoddate{#2}\relax{#1}%
+}
+\fi
% \end{macrocode}
% \end{macro}
%
@@ -376,9 +442,9 @@
% returned by `|\pdffilemoddate`.
% \begin{macrocode}
\begingroup
-\@makeother\D
-\@makeother\Z
-\@makeother:
+\catcode`\D=12
+\catcode`\Z=12
+\catcode`\:=12
% \end{macrocode}
%
% \begin{macro}{\filemod@parse@}[9]{Y1}{Y2}{Y3}{Y4}{M1}{M2}{D1}{D2}{Rest}
@@ -393,6 +459,7 @@
% \begin{macro}{\filemodnotexists}[1]{Macro provided to \Macro\filemodparse}
% Macro which is used for non-existing files.
% \begin{macrocode}
+%<latex>\newcommand*\filemodnotexists{}
\gdef\filemodnotexists#1{%
#1{0000}{00}{00}{00}{00}{00}{Z}%
}
@@ -429,16 +496,24 @@
% returned by `|\pdffilemoddate`.
% \begin{macrocode}
\begingroup
-\@makeother\D
-\@makeother\Z
-\@makeother:
+\catcode`\D=12
+\catcode`\Z=12
+\catcode`\:=12
% \end{macrocode}
%
% \begin{macro}{\filemodNumdate}
% \begin{macrocode}
+%<latex>\newcommand*\filemodNumdate{}
+\iffilemod@direct
\gdef\filemodNumdate#1{%
\expandafter\filemod@Numdate\pdffilemoddate{#1}D:00000000000000Z\relax
}
+\else
+\gdef\filemodNumdate#1{%
+ \expandafter\expandafter
+ \expandafter\filemod@Numdate\pdf@filemoddate{#1}D:00000000000000Z\relax
+}
+\fi
% \end{macrocode}
% \end{macro}
%
@@ -452,9 +527,17 @@
%
% \begin{macro}{\filemodNumtime}
% \begin{macrocode}
+%<latex>\newcommand*\filemodNumtime{}
+\iffilemod@direct
\gdef\filemodNumtime#1{%
\expandafter\filemod@Numtime\pdffilemoddate{#1}D:00000000000000Z\relax
}
+\else
+\gdef\filemodNumtime#1{%
+ \expandafter\expandafter
+ \expandafter\filemod@Numtime\pdf@filemoddate{#1}D:00000000000000Z\relax
+}
+\fi
% \end{macrocode}
% \end{macro}
%
@@ -480,7 +563,9 @@
%
% \begin{macro}{\filemodCmp}
% \begin{macrocode}
-\newcommand*\filemodCmp[2]{%
+%<latex>\newcommand*\filemodCmp[2]%
+%<tex>\def\filemodCmp#1#2%
+{%
\ifcase0%
\ifnum\filemodNumdate{#2}>\filemodNumdate{#1} 1\else
\ifnum\filemodNumdate{#2}=\filemodNumdate{#1} %
@@ -496,6 +581,15 @@
% \end{macrocode}
% \end{macro}
%
+%
+% Some required \LaTeX{} macros for the plain\TeX{} version:
+% \begin{macrocode}
+%<*tex>
+\long\def\@firstoftwo#1#2{#1}
+\long\def\@secondoftwo#1#2{#2}
+%</tex>
+% \end{macrocode}
+%
% \iffalse
%</expmin>
% \fi
@@ -504,7 +598,8 @@
%<*package>
% \fi
% \begin{macrocode}
-\RequirePackage{filemod-expmin}
+%<latex>\RequirePackage{filemod-expmin}
+%<tex>\input filemod-expmin
% \end{macrocode}
% \iffalse
%</package>
@@ -522,7 +617,9 @@
% \begin{macro}{\filemodnumdate}
% Simply calls the parse macro.
% \begin{macrocode}
-\newcommand*\filemodnumdate{\filemodparse\filemod@numdate}
+%<latex>\newcommand*%
+%<tex>\def
+\filemodnumdate{\filemodparse\filemod@numdate}
% \end{macrocode}
% \end{macro}
%
@@ -539,7 +636,9 @@
% \begin{macro}{\filemodnumtime}
% Simply calls the parse macro.
% \begin{macrocode}
-\newcommand*\filemodnumtime{\filemodparse\filemod@numtime}
+%<latex>\newcommand*%
+%<tex>\def
+\filemodnumtime{\filemodparse\filemod@numtime}
% \end{macrocode}
% \end{macro}
%
@@ -556,20 +655,24 @@
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{Optional argument handler}
%
-% \begin{macro}{\filemod@opt}[3]{Macro to read optional argument when present}{Next macro which receives default optional argument as first normal argument}{\texttt{[} or first mandatory argument}
-% This macro checks if an optional argument is present. Here |#1| and |#2| are handlers and |#3| is the first balanced text which followed the macro, i.e.\ either "[" or the first
-% mandatory argument.
+% \begin{macro}{\filemod@opt}[3]{Macro to read optional argument when present}{Next macro which receives default
+% optional argument as first normal argument}{\texttt{[} or first mandatory argument}
+% This macro checks if an optional argument is present. Here |#1| and |#2| are handlers and |#3| is the first balanced
+% text which followed the macro, i.e.\ either "[" or the first mandatory argument.
% The |\ifx| compares "[" and the first token of |#3|. There are three possible cases:
% \begin{enumerate}
-% \item If they do not match everything until and including |\else| is skipped.
-% Then |\remove@to@nnil@exec| is expanded which removes the following |\@nnil|. This leaves |\empty| and the rest of the \emph{false} clause.
-% The |\fi| is removed using |\expandafter| and the trailing |{#3}| is read by |#2| as normal argument.
-% \item If |#3| is exactly "[" the |\ifx[#3| part is removed by \TeX. The |\remove@to@nnil@exec| removes the |\@nnil| and the |\remove@to@nnil| because there was nothing before |\@nnil|.
-% Therefore |\expandafter#1| is executed which triggers |\else| which removes everything up to and including |\fi|.
-% Then the optional argument handler |#1| is expanded which receives the "[" as "{[}" which is then gobbled.
-% \item The |#3| starts with "[" but contains more material, i.e.\ was original a mandatory argument. Then |\ifx| expands to the \emph{true} clause and removes
-% the first token of |#3|. The |\remove@to@nnil@exec| gobbles the rest of |#3| but reads and reinserts |\remove@to@nnil| which gobbles everything to the next |\@nnil|
-% after |\else| and therefore jumps to the \emph{false} clause. This clause is executed like normal, i.e.\ |#2| is called with the default optional argument and |{#3}| as second argument.
+% \item If they do not match everything until and including |\else| is skipped. Then |\remove@to@nnil@exec| is
+% expanded which removes the following |\@nnil|. This leaves |\empty| and the rest of the \emph{false} clause. The
+% |\fi| is removed using |\expandafter| and the trailing |{#3}| is read by |#2| as normal argument.
+% \item If |#3| is exactly "[" the |\ifx[#3| part is removed by \TeX. The |\remove@to@nnil@exec| removes the |\@nnil|
+% and the |\remove@to@nnil| because there was nothing before |\@nnil|. Therefore |\expandafter#1| is executed which
+% triggers |\else| which removes everything up to and including |\fi|. Then the optional argument handler |#1| is
+% expanded which receives the "[" as "{[}" which is then gobbled.
+% \item The |#3| starts with "[" but contains more material, i.e.\ was original a mandatory argument. Then |\ifx|
+% expands to the \emph{true} clause and removes the first token of |#3|. The |\remove@to@nnil@exec| gobbles the rest
+% of |#3| but reads and reinserts |\remove@to@nnil| which gobbles everything to the next |\@nnil| after |\else| and
+% therefore jumps to the \emph{false} clause. This clause is executed like normal, i.e.\ |#2| is called with the
+% default optional argument and |{#3}| as second argument.
% \end{enumerate}
% \begin{macrocode}
\def\filemod@opt#1#2#3{%
@@ -607,7 +710,9 @@
% Compare two file mod dates.
% Calls macros to check for an optional argument in an expandable way.
% \begin{macrocode}
-\newcommand*\filemodcmp{%
+%<latex>\newcommand*%
+%<tex>\def
+\filemodcmp{%
\filemod@opt\filemod@cmp@opt\filemod@cmp
}
% \end{macrocode}
@@ -617,7 +722,9 @@
% \begin{macro}{\filemodoptdefault}
% The default optional argument which is used if none is provided.
% \begin{macrocode}
-\newcommand*\filemodoptdefault{1}
+%<latex>\newcommand*%
+%<tex>\def
+\filemodoptdefault{1}
% \end{macrocode}
% \end{macro}
%
@@ -693,6 +800,17 @@
% \end{macrocode}
% \end{macro}
%
+% Some required \LaTeX{} macros for the plain\TeX{} version:
+% \begin{macrocode}
+%<*tex>
+\long\def\@thirdofthree#1#2#3{#3}
+\long\def\@gobble#1{}
+\long\def\@gobbletwo#1#2{}
+\def\remove@to@nnil#1\@nnil{}
+%</tex>
+% \end{macrocode}
+%
+%
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
@@ -702,7 +820,9 @@
% \begin{macro}{\filemodnewest}
% First a macro is called to handle an optional argument in an expandable way.
% \begin{macrocode}
-\newcommand*\filemodnewest{%
+%<latex>\newcommand*%
+%<tex>\def
+\filemodnewest{%
\filemod@opt\filemod@newest@opt\filemod@newest
}
% \end{macrocode}
@@ -734,7 +854,9 @@
% \begin{macro}{\filemodoldest}
% First a macro is called to handle an optional argument in an expandable way.
% \begin{macrocode}
-\newcommand*\filemodoldest{%
+%<latex>\newcommand*%
+%<tex>\def
+\filemodoldest{%
\filemod@opt\filemod@oldest@opt\filemod@oldest
}
% \end{macrocode}
@@ -768,7 +890,7 @@
% \begin{macro}{\filemodNewest}[1]{Tokens between macros and opening brace}
% Checks for an optional argument and substitutes the default if it is missing.
% \begin{macrocode}
-\newcommand*\filemodNewest{}
+%<latex>\newcommand*\filemodNewest{}
\def\filemodNewest#1#{%
\expandafter\expandafter
\expandafter\@filemodNewest
@@ -794,7 +916,7 @@
% This is done for the benefit of expansion speed versus memory usage.
% Future versions might use common code instead.
% \begin{macrocode}
-\newcommand*\filemodOldest{}
+%<latex>\newcommand*\filemodOldest{}
\def\filemodOldest#1#{%
\expandafter\expandafter
\expandafter\@filemodOldest
@@ -945,7 +1067,9 @@
%
% \begin{macro}{\Filemodgetnum}
% \begin{macrocode}
-\newcommand*\Filemodgetnum{\filemodparse\Filemod@getnum}
+%<latex>\newcommand*%
+%<tex>\def
+\Filemodgetnum{\filemodparse\Filemod@getnum}
% \end{macrocode}
% \end{macro}
%
@@ -967,10 +1091,12 @@
% \begin{macro}{\Filemodcmp}[1]{Optional argument (default: "1")}
% Calls \Macro\Filemod@cmp to execute the result at the end.
% \begin{macrocode}
+%<*latex>
\newcommand\Filemodcmp[1][1]{%
\def\filemod@next{\filemodcmpresult}%
\Filemod@cmp{#1}%
}
+%</latex>
% \end{macrocode}
% \end{macro}
%
@@ -979,10 +1105,12 @@
% Calls \Macro\Filemod@cmp to not execute the result at the end.
% Instead the user must use \Macro\filemodcmpresult explicitly.
% \begin{macrocode}
+%<*latex>
\newcommand\FilemodCmp[1][1]{%
\let\filemod@next\empty
\Filemod@cmp{#1}%
}
+%</latex>
% \end{macrocode}
% \end{macro}
%
@@ -1055,10 +1183,38 @@
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \subsubsection{Compare file mod times and return file name}
%
+% Handlers for optional arguments for plain\TeX{}.
+% If none is provided the \Macro\filemodoptdefault is used.
+% \begin{macrocode}
+%<*tex>
+\def\filemod@chkopt#1{%
+ \def\filemod@optcmd{#1}%
+ \futurelet\filemod@tok\filemod@@chkopt
+}
+\def\filemod@@chkopt{%
+ \ifx[\filemod@tok
+ \expandafter\filemod@readopt
+ \else
+ \expandafter\filemod@optcmd
+ \expandafter\filemodoptdefault
+ \fi
+}
+\def\filemod@readopt[#1]{%
+ \filemod@optcmd{#1}%
+}
+%</tex>
+% \end{macrocode}
+%
% \begin{macro}{\Filemodnewest}
% Simply uses \Macro\FilemodNewest.
% \begin{macrocode}
+%<*latex>
\newcommand*\Filemodnewest[3][\filemodoptdefault]{\FilemodNewest[{#1}]{{#2}{#3}}}
+%</latex>
+%<*tex>
+\def\Filemodnewest{\filemod@chkopt\Filemod@newest}
+\def\Filemod@newest#1#2#3{\Filemod@Newest{#1}{{#2}{#3}}}
+%</tex>
% \end{macrocode}
% \end{macro}
%
@@ -1066,7 +1222,13 @@
% \begin{macro}{\Filemodoldest}
% Simply uses \Macro\FilemodOldest.
% \begin{macrocode}
+%<*latex>
\newcommand*\Filemodoldest[3][\filemodoptdefault]{\FilemodOldest[{#1}]{{#2}{#3}}}
+%</latex>
+%<*tex>
+\def\Filemodoldest{\filemod@chkopt\Filemod@oldest}
+\def\Filemod@oldest#1#2#3{\Filemod@Oldest{#1}{{#2}{#3}}}
+%</tex>
% \end{macrocode}
% \end{macro}
%
@@ -1076,7 +1238,10 @@
% Uses \Macro\Filemod@est with a different compare sign.
% Stores the optional argument for later processing. This avoids the need to pass it around as an argument.
% \begin{macrocode}
-\newcommand*\FilemodNewest[2][\filemodoptdefault]{%
+%<latex>\newcommand*\FilemodNewest[2][\filemodoptdefault]%
+%<tex>\def\FilemodNewest{\filemod@chkopt\Filemod@Newest}
+%<tex>\def\Filemod@Newest#1#2%
+{%
\def\filemode@tie{#1}%
\def\filemod@gl{>}%
\Filemod@est#2\filemod@end
@@ -1089,7 +1254,10 @@
% Uses \Macro\Filemod@est with a different compare sign.
% Stores the optional argument for later processing. This avoids the need to pass it around as an argument.
% \begin{macrocode}
-\newcommand*\FilemodOldest[2][\filemodoptdefault]{%
+%<latex>\newcommand*\FilemodOldest[2][\filemodoptdefault]%
+%<tex>\def\FilemodOldest{\filemod@chkopt\Filemod@Oldest}
+%<tex>\def\Filemod@Oldest#1#2%
+{%
\def\filemode@tie{#1}%
\def\filemod@gl{<}%
\Filemod@est#2\filemod@end
@@ -1165,28 +1333,36 @@
%
% \begin{macro}{\filemodprint}
% \begin{macrocode}
-\newcommand*\filemodprint{\filemodparse\thefilemod}
+%<latex>\newcommand*
+%<tex>\def
+\filemodprint{\filemodparse\thefilemod}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\filemodprintdate}
% \begin{macrocode}
-\newcommand*\filemodprintdate{\filemodparse\the@filemoddate}
+%<latex>\newcommand*
+%<tex>\def
+\filemodprintdate{\filemodparse\the@filemoddate}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\filemodprinttime}
% \begin{macrocode}
-\newcommand*\filemodprinttime{\filemodparse\the@filemodtime}
+%<latex>\newcommand*
+%<tex>\def
+\filemodprinttime{\filemodparse\the@filemodtime}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\thefilemod}
% \begin{macrocode}
-\newcommand*\thefilemod[7]{%
+%<latex>\newcommand*\thefilemod[7]%
+%<tex>\def\thefilemod#1#2#3#4#5#6#7%
+{%
\thefilemoddate{#1}{#2}{#3}%
\filemodsep
\thefilemodtime{#4}{#5}{#6}{#7}%
@@ -1195,21 +1371,24 @@
% \end{macro}
%
% \begin{macrocode}
-\let\filemodsep\space
+%<latex>\newcommand*\filemodsep{ }
+%<tex>\let\filemodsep\space
% \end{macrocode}
%
% \begin{macro}{\thefilemoddate}
% \begin{macrocode}
-\newcommand*\thefilemoddate[3]{%
- #1/#2/#3%
-}
+%<latex>\newcommand*\thefilemoddate[3]%
+%<tex>\def\thefilemoddate#1#2#3%
+{#1/#2/#3}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\thefilemodtime}
% \begin{macrocode}
-\newcommand*\thefilemodtime[4]{%
+%<latex>\newcommand*\thefilemodtime[4]%
+%<tex>\def\thefilemodtime#1#2#3#4%
+{%
#1:#2:#3~#4%
}
% \end{macrocode}
@@ -1246,8 +1425,10 @@
% The "Z" characters are changed to catcode 12 because this is how they appear in the string
% returned by `|\pdffilemoddate`.
% \begin{macrocode}
+%<latex>\newcommand*\filemodZ{}
+%<latex>\newcommand*\filemodz{}
\begingroup
-\@makeother\D
+\catcode`\D=12
% \end{macrocode}
%
% \begin{macro}{\filemodZ}
@@ -1273,5 +1454,13 @@
%</aux>
% \fi
%
+% Restore catcode for plainTeX:
+% \begin{macrocode}
+%<*tex>
+\filemod@cat
+\expandafter\let\csname filemod@cat\endcsname\relax
+%</tex>
+% \end{macrocode}
+%
% \Finale
% \endinput
diff --git a/Master/texmf-dist/source/latex/filemod/filemod.ins b/Master/texmf-dist/source/latex/filemod/filemod.ins
new file mode 100644
index 00000000000..10115442744
--- /dev/null
+++ b/Master/texmf-dist/source/latex/filemod/filemod.ins
@@ -0,0 +1,11 @@
+% This INS file is also part of the DTX file
+\input docstrip.tex
+\keepsilent
+\askforoverwritefalse
+\generate{%
+ \file{filemod.sty} {\nopreamble\from{filemod.dtx} {COPYRIGHT,package,parse,exp,exe,display,aux,latex}}%
+ \file{filemod.tex} {\nopreamble\from{filemod.dtx} {COPYRIGHT,package,parse,exp,exe,display,aux,tex}}%
+ \file{filemod-expmin.sty} {\nopreamble\from{filemod.dtx} {COPYRIGHT,expmin,latex}}%
+ \file{filemod-expmin.tex} {\nopreamble\from{filemod.dtx} {COPYRIGHT,expmin,tex}}%
+}
+\endbatchfile