From 9ba411b76cebc96643f89f5f0e6d6298c0b4fda8 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 13 Jul 2016 22:32:41 +0000 Subject: datetime2 (13jul16) git-svn-id: svn://tug.org/texlive/trunk@41686 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/datetime2/CHANGES | 9 + Master/texmf-dist/doc/latex/datetime2/README | 4 +- .../texmf-dist/doc/latex/datetime2/datetime2.pdf | Bin 663037 -> 679641 bytes .../datetime2/samples/datetime2-sample-babel.pdf | Bin 72812 -> 72943 bytes .../datetime2/samples/datetime2-sample-calc.pdf | Bin 28801 -> 28801 bytes .../samples/datetime2-sample-filedate.pdf | Bin 16491 -> 16635 bytes .../samples/datetime2-sample-hyperref.pdf | Bin 61995 -> 62440 bytes .../datetime2/samples/datetime2-sample-journal.pdf | Bin 100517 -> 100517 bytes .../datetime2/samples/datetime2-sample-styles.pdf | Bin 27270 -> 27191 bytes .../datetime2/samples/datetime2-sample-xe.pdf | Bin 0 -> 5335 bytes .../datetime2/samples/datetime2-sample-xe.tex | 20 + .../source/latex/datetime2/datetime2.dtx | 488 +++++++++++++++++++-- .../source/latex/datetime2/datetime2.ins | 2 +- .../tex/latex/datetime2/datetime2-calc.sty | 2 +- .../texmf-dist/tex/latex/datetime2/datetime2.sty | 191 +++++++- 15 files changed, 665 insertions(+), 51 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.pdf create mode 100644 Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.tex (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/datetime2/CHANGES b/Master/texmf-dist/doc/latex/datetime2/CHANGES index e0567a81a79..a978a00e2ce 100644 --- a/Master/texmf-dist/doc/latex/datetime2/CHANGES +++ b/Master/texmf-dist/doc/latex/datetime2/CHANGES @@ -1,3 +1,12 @@ +1.5.2 (2016-07-12): + + * Added \DTMifhasstyle, \DTMifhasdatestyle, \DTMifhastimestyle, + \DTMifhaszonestyle, \DTMsetregional, \DTMtryregional + and \DTMsavefrompdfdata + + * Added check for texosquery (allows seconds and time zone + to be supported with xelatex but requires shell escape) + 1.5.1 (2016-06-05) : * Added check for \pdffeedback diff --git a/Master/texmf-dist/doc/latex/datetime2/README b/Master/texmf-dist/doc/latex/datetime2/README index 6fe011e31fc..208bce8ae08 100644 --- a/Master/texmf-dist/doc/latex/datetime2/README +++ b/Master/texmf-dist/doc/latex/datetime2/README @@ -1,6 +1,6 @@ -LaTeX Package : datetime2 v1.5.1 +LaTeX Package : datetime2 v1.5.2 -Last Modified : 2016-06-05 +Last Modified : 2016-07-12 Author : Nicola Talbot diff --git a/Master/texmf-dist/doc/latex/datetime2/datetime2.pdf b/Master/texmf-dist/doc/latex/datetime2/datetime2.pdf index 15774a44e2b..566371182a8 100644 Binary files a/Master/texmf-dist/doc/latex/datetime2/datetime2.pdf and b/Master/texmf-dist/doc/latex/datetime2/datetime2.pdf differ diff --git a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-babel.pdf b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-babel.pdf index c7d72b53b1c..475b6986b57 100644 Binary files a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-babel.pdf and b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-babel.pdf differ diff --git a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-calc.pdf b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-calc.pdf index 598da278131..e1ffdb55273 100644 Binary files a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-calc.pdf and b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-calc.pdf differ diff --git a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-filedate.pdf b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-filedate.pdf index aba9beab75c..d951ae6dc0c 100644 Binary files a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-filedate.pdf and b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-filedate.pdf differ diff --git a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-hyperref.pdf b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-hyperref.pdf index 8952e1cfff8..de54cef3b2f 100644 Binary files a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-hyperref.pdf and b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-hyperref.pdf differ diff --git a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-journal.pdf b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-journal.pdf index 25ce35778c9..240315500da 100644 Binary files a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-journal.pdf and b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-journal.pdf differ diff --git a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-styles.pdf b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-styles.pdf index c67aff4c1e7..31fa4321a35 100644 Binary files a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-styles.pdf and b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-styles.pdf differ diff --git a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.pdf b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.pdf new file mode 100644 index 00000000000..2345f4b2feb Binary files /dev/null and b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.pdf differ diff --git a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.tex b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.tex new file mode 100644 index 00000000000..09c2a332985 --- /dev/null +++ b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-xe.tex @@ -0,0 +1,20 @@ +% arara: xelatex: {shell: on} +\documentclass{article} + +\usepackage{texosquery} +% Disable texosquery: +%\TeXOSQueryDryRuntrue +\usepackage{datetime2} + +% If you get an error that looks like: +% ! I can't find file `"|texosquery -n"'. +% Then the shell escape has been restricted and texosquery +% wasn't allowed to run. + +\begin{document} +\DTMnow. + +\DTMsavefilemoddate{moddate}{\jobname.tex} +File \texttt{\jobname.tex} last modified: \DTMuse{moddate}. + +\end{document} diff --git a/Master/texmf-dist/source/latex/datetime2/datetime2.dtx b/Master/texmf-dist/source/latex/datetime2/datetime2.dtx index 1382798c026..569cd0b0ef7 100644 --- a/Master/texmf-dist/source/latex/datetime2/datetime2.dtx +++ b/Master/texmf-dist/source/latex/datetime2/datetime2.dtx @@ -1,13 +1,13 @@ %\iffalse % datetime2.dtx generated using makedtx version 1.1 (c) Nicola Talbot % Command line args: -% -doc "datetime2-manual.tex" -% -section "chapter" % -author "Nicola Talbot" % -src "datetime2.sty\Z=>datetime2.sty" % -src "datetime2-calc.sty\Z=>datetime2-calc.sty" +% -section "chapter" +% -doc "datetime2-manual.tex" % datetime2 -% Created on 2016/6/5 13:21 +% Created on 2016/7/12 13:25 %\fi %\iffalse %<*package> @@ -47,7 +47,7 @@ pdfauthor={Nicola L.C. Talbot}, pdftitle={datetime2: date and time formats}]{hyperref} -\CheckSum{2374} +\CheckSum{2558} \RecordChanges \DisableCrossrefs @@ -91,11 +91,11 @@ % %\MakeShortVerb{"} % -%\title{datetime2 v1.5.1: +%\title{datetime2 v1.5.2: %date and time formats} %\author{Nicola L. C. Talbot\\\url{http://www.dickimaw-books.com/}} % -%\date{2016-06-05} +%\date{2016-07-12} %\maketitle % %\begin{abstract} @@ -183,7 +183,10 @@ %\DTMsetstyle{default}\DTMuse{bst} %\end{display} %\emph{unless} you are using \XeLaTeX\ in which case the seconds and -%time zone are omitted. (\XeLaTeX\ doesn't provide this information.) +%time zone are omitted. (\XeLaTeX\ doesn't provide this information, +%but as from v1.5.2, you can load \sty{texosquery} before +%\sty{datetime2} and enable the shell escape to obtain this +%information.) %Alternatively you can hide the seconds and zone %using the package options \pkgopt[false]{showseconds} and %\pkgopt[false]{showzone}. If you want UTC+0 to be displayed @@ -353,8 +356,9 @@ % %Remember that you need to switch on the regional style, if required: %\begin{verbatim} -%\DTMsetup{useregional} +%\DTMsetregional %\end{verbatim} +%or through the \pkgopt{useregional} package option. % %\chapter{Displaying the Date and Time} %\label{sec:display} @@ -634,13 +638,21 @@ %\begin{important} %If the PDF\TeX\ primitive \ics{pdfcreationdate} is defined, the %current time information is obtained from that, which includes the -%seconds and time zone. Lua\TeX\ also defines this command but +%seconds and time zone. Lua\TeX\ also defines this command (now +%replaced with \cs{pdffeedback}\verb*| creationdate|) but %\XeTeX\ doesn't, and in that case the only way to determine the %current time is from \TeX's \ics{time} primitive which only contains %the number of minutes since midnight, which means that the seconds %and time zone are unavailable. Therefore if \XeTeX\ is used, the %\pkgopt{showseconds} and \pkgopt{showzone} options are automatically %switched off. +% +%New to v1.5.2: if \sty{texosquery} is loaded before +%\styfmt{datetime2} and the shell escape is enabled, then +%if \cs{pdfcreationdate} and \cs{pdffeedback} are undefined, +%the information will be obtained through \ics{TeXOSQueryNow}. +%See the \sty{texosquery} documentation for further information +%about this command. %\end{important} % %There is also a~non-expandable robust command to display the time: @@ -771,6 +783,23 @@ %or \texttt{-3:0}). This will override any date, time or zone data %previously saved with this \meta{name}. % +%Alternatively, if the date and time is in PDF form, that is +%\begin{display} +%\texttt{D:}\meta{YYYY}\meta{MM}\meta{DD}\meta{hh}\meta{mm}\meta{ss}\meta{zone} +%\end{display} +%where \meta{zone} is either \texttt{Z} or +%\meta{TZh}\texttt{'}\meta{TZm}\texttt{'} then you can use +%\begin{definition}[\DescribeMacro\DTMsavefrompdfdata] +%\cs{DTMsavefrompdfdata}\marg{name}\marg{PDF data} +%\end{definition} +%Note that the category code of the initial \texttt{D} is +%irrelevant (in fact, the initial \texttt{D} is actually +%ignored) but the other characters should have their usual +%category code (so take care if, say, \sty{babel} makes the colon +%an active character). The \meta{PDF data} argument is automatically +%expanded so may be a control sequence that contains the PDF data. +%(Not the case with \cs{DTMsavetimestamp}.) +% %The current date and time can be saved using: %\begin{definition}[\DescribeMacro\DTMsavenow] %\cs{DTMsavenow}\marg{name} @@ -788,7 +817,11 @@ %attempt to use \texttt{os.date} but it uses \texttt{\%z} for the %time zone, which may not work on some operating systems. If you use %\XeLaTeX\ this command will generate a warning and will assume a -%date of 0000-00-00T00:00:00Z. +%date of 0000-00-00T00:00:00Z unless (from v1.5.2) you have +%loaded \sty{texosquery} before \styfmt{datetime2} and you have the +%shell escape enabled, in which case \cs{DTMsavefilemoddate} will use +%\cs{TeXOSQueryFileDate} to obtain the information. See the +%\sty{texosquery} manual for further details about this command. % %The above commands are all localised to the current scope. If the %data is required after the end of the scope, you can make the @@ -993,6 +1026,56 @@ %The style changes are all local and so are affected by the current %scope. % +%In addition to the predefined styles, there are also styles provided +%by regional modules. These may or may not be set depending on +%the setting of \pkgopt{useregional}. Those that are provided usually +%follow the naming scheme \meta{lang-name} or \meta{lang +%code}\texttt{-}\meta{county code}, where \meta{lang name} is the +%root language name (for example, \texttt{english}), \meta{lang code} +%is the ISO language code and \meta{country code} is the ISO country +%code (for example, \texttt{en-GB}). If a numeric style is provided, +%it's usually the name of the text style with \texttt{-numeric} +%appended (for example, \texttt{en-GB-numeric}). If you're not sure +%of the exact naming scheme you can use +%\begin{definition}[\DescribeMacro\DTMtryregional] +%\cs{DTMtryregional}\oarg{lang name}\marg{lang code}\marg{country +%code} +%\end{definition} +%This takes into account the \pkgopt{useregional} option, so will do +%nothing if \pkgopt[false]{useregional}. If the optional argument is +%omitted, the root language name will be determined from the supplied ISO +%language code if it's recognised. +% +%\begin{important} +%If there's no match, no change will be made. There will be no +%warnings or error messages. +%\end{important} +% +%For example: +%\begin{verbatim} +%\DTMsetup{useregional=numeric} +%\DTMtryregional{en}{GB} +%\end{verbatim} +%This will set the style \texttt{en-GB-numeric} (assuming the +%\texttt{en-GB} module has been loaded). +% +%In this example: +%\begin{verbatim} +%\DTMsetup{useregional} +%\DTMtryregional{nl}{BE} +%\end{verbatim} +%the style is set to \texttt{dutch} (assuming the \texttt{dutch} +%module has been loaded), since there's no style called +%\texttt{nl-BE}. +% +%If the ISO codes are stored in control sequences which may or may +%not be defined, you can use the starred version which expects +%commands for the last two arguments: +%\begin{definition}[\DescribeMacro\DTMtryregional*] +%\cs{DTMtryregional*}\oarg{lang name}\marg{lang code cs}\marg{country +%code cs} +%\end{definition} +% %\section{Predefined Styles} %\label{sec:predefinedstyles} % @@ -1315,6 +1398,27 @@ %three commands for the partial elements of the full style, so it a %partial style with this name already exists, it won't be changed. % +%As from v1.5.2, you can determine if a style exists using: +% +%\begin{definition}[\DescribeMacro\DTMifhasstyle] +%\cs{DTMifhasstyle}\marg{name}\marg{true}\marg{false} +%\end{definition} +%If the (full) style given by \meta{name} exists, this +%does \meta{true} otherwise it does \meta{false}. +% +%Similarly for a partial date style +%\begin{definition}[\DescribeMacro\DTMifhasdatestyle] +%\cs{DTMifhasdatestyle}\marg{name}\marg{true}\marg{false} +%\end{definition} +%partial time style +%\begin{definition}[\DescribeMacro\DTMifhastimestyle] +%\cs{DTMifhastimestyle}\marg{name}\marg{true}\marg{false} +%\end{definition} +%and partial time zone style +%\begin{definition}[\DescribeMacro\DTMifhaszonestyle] +%\cs{DTMifhaszonestyle}\marg{name}\marg{true}\marg{false} +%\end{definition} +% %There are some helper commands provided that you might want to use %in the style definitions. % @@ -1492,7 +1596,9 @@ %\styfmt{datetime2} language modules. These modules are automatically %loaded, if required, by \styfmt{datetime2} but only if they are %already installed. Remember that if you use \XeLaTeX\ you won't have -%the seconds or time zone available for the current date and time. +%the seconds or time zone available for the current date and time +%(unless you first load \sty{texosquery} and have the shell escape +%enabled). % %\begin{important} %If the required language modules aren't installed or @@ -1616,7 +1722,18 @@ %\styfmt{datetime2}'s package options or using \ics{DTMsetup} however %it will only have an effect during the module loading (when the %value is changed via the package option) and when -%\cs{date}\meta{language} is used. +%\cs{date}\meta{language} is used. An alternative is to use +%\cs{DTMsetregional} which will also do \cs{date}\meta{language} if +%it is available +%(where \meta{language} is the current value of \cs{languagename}) +%otherwise it will iterate through the list of known +%dialects and try to set each one in turn. +% +%\begin{important} +%This means that using \cs{DTMsetregional} may cause +%the style to change to a different region if you have multiple +%regions defined. +%\end{important} % %For example, in the document below, the date is displayed using the %\style{default} numeric format because \pkgopt{useregional} has been @@ -2119,19 +2236,21 @@ %\item[\pkgopt{showseconds}] Boolean key to determine whether or not %to show the seconds when the time is displayed. The \style{iso} %style honours this setting but the \style{pdf} style ignores it. -%Default: \texttt{true} unless \XeTeX\ is used. +%Default: \texttt{true} unless \XeTeX\ is used (and \sty{texosquery} +%hasn't first been loaded with shell escape enabled). % %\item[\pkgopt{showdate}] Boolean key to determine whether or not to %show the date with commands that use \cs{DTMdisplay} or %\cs{DTMDisplay}. (Some styles may ignore this.) The \style{iso} %style honours this setting but the \style{pdf} style ignores it. -%Default: \texttt{true} unless \XeTeX\ is used. +%Default: \texttt{true}. % %\item[\pkgopt{showzone}] Boolean key to determine whether or not to %show the time zone with commands that use %\cs{DTMdisplay} or \cs{DTMDisplay}. (Some styles may ignore this.) The \style{iso} style honours this setting but the %\style{pdf} style ignores it. -%Default: \texttt{true} unless \XeTeX\ is used. +%Default: \texttt{true} unless \XeTeX\ is used (and \sty{texosquery} +%hasn't first been loaded with shell escape enabled). % %\item[\pkgopt{showzoneminutes}] Boolean key to determine whether or %not to show the zone offset minutes. The \style{iso} style honours @@ -2156,17 +2275,22 @@ %an abbreviation for \texttt{numeric}. If no value is supplied %\texttt{text} is assumed. % -%This key determines whether or not to \emph{use} the loaded regional +%\begin{important} +%If you haven't loaded \sty{babel} or \sty{polyglossia}, this +%key only has an effect when used as a package option. Consider +%instead using \cs{DTMsetregional}. +%\end{important} +% +%This key determines whether or not to \emph{use} the loaded regional %settings and, if the regional setting should be used, it determines %whether the text style (months as words) or numeric style should be -%used. If you haven't loaded \sty{babel} or \sty{polyglossia}, this -%key only has an effect when used as a package option. If you have -%loaded one of those packages, the change comes into effect at module -%load time and whenever \cs{date}\meta{language} is used (which -%includes at the beginning of the \env{document} environment). If you want -%to switch the style at any other time, you need to use -%\cs{DTMsetstyle} but unless \pkgopt[false]{useregional} the next -%instance of \cs{date}\meta{language} will change the style. +%used. If you have loaded one of those packages, the change comes +%into effect at module load time and whenever +%\cs{date}\meta{language} is used (which includes at the beginning of +%the \env{document} environment). If you want to switch the style at +%any other time, you need to use \cs{DTMsetstyle} but unless +%\pkgopt[false]{useregional} the next instance of +%\cs{date}\meta{language} will change the style. % %Note that setting this option to \texttt{false} doesn't prevent the modules %from being loaded. It just prevents them from automatically setting the style @@ -2177,6 +2301,20 @@ %passed to the \styfmt{datetime2} package option list. However, using \pkgopt{style} %will set \pkgopt{useregional} to \texttt{false}. % +%If you want to change this value after the language modules have +%been loaded, instead of using \cs{DTMsetup}, you can use +%\begin{definition}[\DescribeMacro\DTMsetregional] +%\cs{DTMsetregional}\oarg{value} +%\end{definition} +%This will do \texttt{\cs{DTMsetup}\{userregional=\meta{value}\}}. +%Then if \meta{value} is \texttt{false}, it will set the +%\texttt{default} style otherwise it will use \cs{date}\meta{lang} if +%it's defined (where \meta{lang} is given by \cs{languagename}). If +%\cs{date}\meta{lang} isn't defined, it will iterate over the list of +%dialects associated with the document and use \cs{DTMtryregional} +%for each dialect. If \meta{value} is omitted, \texttt{text} is +%assumed. +% %Examples: %\begin{verbatim} %\documentclass[british]{article} @@ -5548,7 +5686,7 @@ %\changes{1.0}{2015-03-24}{Initial release} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datetime2}[2016/06/05 v1.5.1 (NLCT) date and time formats] +\ProvidesPackage{datetime2}[2016/07/12 v1.5.2 (NLCT) date and time formats] % \end{macrocode} % Use \sty{tracklang} to find out what languages have been loaded. % \begin{macrocode} @@ -5586,7 +5724,32 @@ {% \edef\dtm@pdfcreationdate{\pdffeedback creationdate}% }% - {}% + {% +% \end{macrocode} +%Neither \cs{pdfcreationdate} nor \cs{pdffeedback} are defined. +%(The \TeX\ format is most probably \XeLaTeX.) If \sty{texosquery} +%has been loaded, then the current date and time can be fetched +%using \ics{TeXOSQueryNow} provided the shell escape has been +%enabled. (It might not be, so don't automatically load +%\sty{texosquery}.) Since it might have been loaded using \cs{input} +%rather than \cs{usepackage}, just test if \cs{TeXOSQueryNow} has +%been defined. +%\changes{1.5.2}{2016-07-12}{added check for \cs{TeXOSQueryNow}} +% \begin{macrocode} + \ifdef\TeXOSQueryNow + {% + \TeXOSQueryNow{\dtm@pdfcreationdate}% + \ifdefempty\dtm@pdfcreationdate + {% +% \end{macrocode} +%Failed (maybe shell escape has been disabled). +% \begin{macrocode} + \undef\dtm@pdfcreationdate + }% + {}% + }% + {}% + }% } % \end{macrocode} %\end{macro} @@ -6065,6 +6228,26 @@ % \end{macrocode} %\end{macro} % +%\begin{macro}{\DTMsavefrompdfdata} +%\changes{1.5.2}{2016-07-12}{new} +%Save a date-time stamp that's specified in PDF format. +% \begin{macrocode} +\newcommand*{\DTMsavefrompdfdata}[2]{% + \edef\@dtm@tmp{#2}% + \expandafter\@dtm@parsepdfdatetime\@dtm@tmp\@dtm@endparsepdfdatetime + \cslet{@dtm@#1@year}{\@dtm@year}% + \cslet{@dtm@#1@month}{\@dtm@month}% + \cslet{@dtm@#1@day}{\@dtm@day}% + \cslet{@dtm@#1@dow}{\@dtm@dow}% + \cslet{@dtm@#1@hour}{\@dtm@hour}% + \cslet{@dtm@#1@minute}{\@dtm@minute}% + \cslet{@dtm@#1@second}{\@dtm@second}% + \cslet{@dtm@#1@TZhour}{\@dtm@timezonehour}% + \cslet{@dtm@#1@TZminute}{\@dtm@timezoneminute}% +} +% \end{macrocode} +%\end{macro} +% % Find out the current time. If \cs{dtm@pdfcreationdate} is defined, % it can be fetched from that. % \begin{macrocode} @@ -6131,12 +6314,12 @@ } }% {% + \ifdef\directlua + { % \end{macrocode} % Lua time zone information provided by \verb|%z| is OS dependent, % so this might not work. % \begin{macrocode} - \ifdef\directlua - { \renewcommand*{\DTMsavefilemoddate}[2]{% \expandafter\@dtm@parseluadatetime \directlua{tex.print(os.date( @@ -6217,7 +6400,50 @@ \def\@@dtm@parseluatimezone#1\@dtm@endparseluatimezone{% } } - {} + {% +% \end{macrocode} +%If \ics{directlua} isn't defined but \sty{texosquery} has been +%loaded, we can use \cs{TeXOSQueryFileDate} if the shell escape is +%enabled. +% \begin{macrocode} + \ifdef\TeXOSQueryFileDate + { + \renewcommand*{\DTMsavefilemoddate}[2]{% + \TeXOSQueryFileDate{\@dtm@tmp}{#2}% + \ifdefempty\@dtm@tmp + {% +% \end{macrocode} +% OS query failed. +% \begin{macrocode} + \@dtm@warning{Your TeX engine doesn't support accessing + file modification dates and the attempt to use texosquery + failed}% + \cslet{@dtm@#1@year}{0}% + \cslet{@dtm@#1@month}{0}% + \cslet{@dtm@#1@day}{0}% + \cslet{@dtm@#1@dow}{-1}% + \cslet{@dtm@#1@hour}{0}% + \cslet{@dtm@#1@minute}{0}% + \cslet{@dtm@#1@second}{0}% + \cslet{@dtm@#1@TZhour}{0}% + \cslet{@dtm@#1@TZminute}{0}% + }% + {% + \expandafter\@dtm@parsepdfdatetime\@dtm@tmp\@dtm@endparsepdfdatetime + \cslet{@dtm@#1@year}{\@dtm@year}% + \cslet{@dtm@#1@month}{\@dtm@month}% + \cslet{@dtm@#1@day}{\@dtm@day}% + \cslet{@dtm@#1@dow}{\@dtm@dow}% + \cslet{@dtm@#1@hour}{\@dtm@hour}% + \cslet{@dtm@#1@minute}{\@dtm@minute}% + \cslet{@dtm@#1@second}{\@dtm@second}% + \cslet{@dtm@#1@TZhour}{\@dtm@timezonehour}% + \cslet{@dtm@#1@TZminute}{\@dtm@timezoneminute}% + }% + }% + } + {} + } }% }% {% @@ -6862,6 +7088,58 @@ % \end{macrocode} %\end{macro} % +%\begin{macro}{\DTMifhasstyle} +%\begin{definition} +%\cs{DTMifhasstyle}\marg{label}\marg{true}\marg{false} +%\end{definition} +%\changes{1.5.2}{2016-07-12}{new} +%Test to determine if style exists. +% \begin{macrocode} +\newcommand*{\DTMifhasstyle}[3]{% + \ifcsdef{@dtm@style@#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\DTMifhasdatestyle} +%\begin{definition} +%\cs{DTMifhasdatestyle}\marg{label}\marg{true}\marg{false} +%\end{definition} +%\changes{1.5.2}{2016-07-12}{new} +%Test to determine if partial date style exists. +% \begin{macrocode} +\newcommand*{\DTMifhasdatestyle}[3]{% + \ifcsdef{@dtm@datestyle@#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\DTMifhastimestyle} +%\begin{definition} +%\cs{DTMifhastimestyle}\marg{label}\marg{true}\marg{false} +%\end{definition} +%\changes{1.5.2}{2016-07-12}{new} +%Test to determine if time style exists. +% \begin{macrocode} +\newcommand*{\DTMifhastimestyle}[3]{% + \ifcsdef{@dtm@timestyle@#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\DTMifhaszonestyle} +%\begin{definition} +%\cs{DTMifhaszonestyle}\marg{label}\marg{true}\marg{false} +%\end{definition} +%\changes{1.5.2}{2016-07-12}{new} +%Test to determine if time zone style exists. +% \begin{macrocode} +\newcommand*{\DTMifhaszonestyle}[3]{% + \ifcsdef{@dtm@zonestyle@#1}{#2}{#3}% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\DTMnewstyle} %\begin{definition} %\cs{DTMnewstyle}\marg{label}\marg{date style definition}\marg{time @@ -6872,7 +7150,7 @@ % and \cs{DTMDisplay}. % \begin{macrocode} \newcommand*{\DTMnewstyle}[5]{% - \ifcsdef{@dtm@style@#1}% + \DTMifhasstyle{#1}% {% \PackageError{datetime2}{Style `#1' already exists}{}% }% @@ -6902,10 +7180,7 @@ %\changes{1.2}{2015-11-10}{new} % \begin{macrocode} \newcommand*{\DTMrenewstyle}[5]{% - \ifcsundef{@dtm@style@#1}% - {% - \PackageError{datetime2}{Style `#1' doesn't exist}{}% - }% + \DTMifhasstyle{#1}% {% \DTMrenewdatestyle{#1}{#2}% \DTMrenewtimestyle{#1}{#3}% @@ -6917,6 +7192,9 @@ #5% }% }% + {% + \PackageError{datetime2}{Style `#1' doesn't exist}{}% + }% } % \end{macrocode} %\end{macro} @@ -6931,7 +7209,7 @@ %\changes{1.2}{2015-11-10}{new} % \begin{macrocode} \newcommand*{\DTMprovidestyle}[5]{% - \ifcsdef{@dtm@style@#1}% + \DTMifhasstyle{#1}% {% }% {% @@ -6985,10 +7263,146 @@ % \end{macrocode} %\end{macro} % +%\begin{macro}{\DTMtryregional} +%\begin{definition} +%\cs{DTMtryregional}\oarg{lang}\marg{lang code cs}\marg{country code cs} +%\end{definition} +%Tries to see if the regional style can be set. Takes into account +%the \pkgopt{useregional} setting. The starred version expects the arguments to be +%control sequences. If both are blank or undefined nothing +%happens. The optional argument may be the root language label, +%which is used if no style exists for the ISO codes. +%\changes{1.5.2}{2016-07-12}{new} +% \begin{macrocode} +\newcommand*{\DTMtryregional}{% + \@ifstar\s@dtm@tryregional\@dtm@tryregional +} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\@dtm@tryregional} +% \begin{macrocode} +\newcommand*{\@dtm@tryregional}[3][]{% + \edef\@dtm@langcode{#2}% + \edef\@dtm@countrycode{#3}% + \s@dtm@tryregional[#1]{\@dtm@langcode}{\@dtm@countrycode}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\s@dtm@tryregional} +% \begin{macrocode} +\newcommand*{\s@dtm@tryregional}[3][]{% + \def\@dtm@thisstyle{}% + \edef\@dtm@root{#1}% + \ifdefempty{#2}{}% + {% + \let\@dtm@thisstyle#2% +% \end{macrocode} +% Determine the root language name if not already provided in the +% optional argument. +% \begin{macrocode} + \ifdefempty\@dtm@root + {% + \edef\@dtm@root{\TrackedLanguageFromIsoCode{639-1}{#2}}% + \ifdefempty\@dtm@root + {% + \edef\@dtm@root{\TrackedLanguageFromIsoCode{639-2}{#2}}% + }% + {}% + }% + {}% + }% + \ifdefempty{#3}{}% + {% + \ifdefempty\@dtm@thisstyle + {\let\@dtm@thisstyle#3}% + {\eappto\@dtm@thisstyle{-#3}}% + }% + \ifdefempty\@dtm@thisstyle + {}% + {% + \DTMifcaseregional + {}% + {% + \DTMifhasstyle{\@dtm@thisstyle}% + {% + \csuse{@dtm@style@\@dtm@thisstyle}% + }% + {% + \ifdefempty\@dtm@root + {}% + {% + \DTMifhasstyle{\@dtm@root}% + {% + \csuse{@dtm@style@\@dtm@root}% + }% + {}% + }% + }% + }% + {% + \DTMifhasstyle{\@dtm@thisstyle-numeric}% + {% + \csuse{@dtm@style@\@dtm@thisstyle-numeric}% + }% + {% + \ifdefempty\@dtm@root + {}% + {% + \DTMifhasstyle{\@dtm@root-numeric}% + {% + \csuse{@dtm@style@\@dtm@root-numeric}% + }% + {}% + }% + }% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\DTMsetregional} +%\changes{1.5.2}{2016-07-12}{new} +% \begin{macrocode} +\newcommand*{\DTMsetregional}[1][text]{% + \DTMsetup{useregional=#1}% + \ifstrequal{#1}{false}% + {% + \DTMsetstyle{default}% + }% + {% + \ifcsdef{date\languagename} + {% + \csuse{date\languagename} + }% + {% +% \end{macrocode} +% Iterate through dialect list. +% \begin{macrocode} + \ForEachTrackedDialect{\@dtm@thisdialect}% + {% + \edef\@dtm@lang{\TrackedLanguageFromDialect\@dtm@thisdialect}% + \edef\@dtm@langcode{\TrackedIsoCodeFromLanguage{639-1}{\@dtm@lang}}% + \ifdefempty\@dtm@langcode + {% + \edef\@dtm@langcode{\TrackedIsoCodeFromLanguage{639-2}{\@dtm@lang}}% + }% + {}% + \edef\@dtm@countrycode{% + \TrackedIsoCodeFromLanguage{3166-1}{\@dtm@thisdialect}}% + \s@dtm@tryregional[\@dtm@lang]{\@dtm@langcode}{\@dtm@countrycode}% + }% + }% + }% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\DTMsetstyle} % \begin{macrocode} \newrobustcmd*{\DTMsetstyle}[1]{% - \ifcsdef{@dtm@style@#1}% + \DTMifhasstyle{#1}% {\csuse{@dtm@style@#1}}% {% \let\dtm@unknownstyle\@dtm@unknownstyle @@ -8332,7 +8746,7 @@ %\section{datetime2-calc.sty code} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datetime2-calc}[2016/06/05 v1.5.1 (NLCT)] +\ProvidesPackage{datetime2-calc}[2016/07/12 v1.5.2 (NLCT)] % \end{macrocode} % Load other required packages % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/datetime2/datetime2.ins b/Master/texmf-dist/source/latex/datetime2/datetime2.ins index a6aab154480..b9087ee09f3 100644 --- a/Master/texmf-dist/source/latex/datetime2/datetime2.ins +++ b/Master/texmf-dist/source/latex/datetime2/datetime2.ins @@ -1,4 +1,4 @@ -% datetime2.ins generated using makedtx version 1.1 2016/6/5 13:21 +% datetime2.ins generated using makedtx version 1.1 2016/7/12 13:25 \input docstrip \preamble diff --git a/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty b/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty index 2973c635a22..a3cc47301d5 100644 --- a/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty +++ b/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datetime2-calc}[2016/06/05 v1.5.1 (NLCT)] +\ProvidesPackage{datetime2-calc}[2016/07/12 v1.5.2 (NLCT)] \RequirePackage{pgfkeys} \RequirePackage{pgfcalendar} \newcount\@dtm@julianday diff --git a/Master/texmf-dist/tex/latex/datetime2/datetime2.sty b/Master/texmf-dist/tex/latex/datetime2/datetime2.sty index dc0356f7fb5..8e0881bcda4 100644 --- a/Master/texmf-dist/tex/latex/datetime2/datetime2.sty +++ b/Master/texmf-dist/tex/latex/datetime2/datetime2.sty @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datetime2}[2016/06/05 v1.5.1 (NLCT) date and time formats] +\ProvidesPackage{datetime2}[2016/07/12 v1.5.2 (NLCT) date and time formats] \RequirePackage{tracklang} \RequirePackage{etoolbox} \RequirePackage{xkeyval}[2006/11/18] @@ -52,7 +52,18 @@ {% \edef\dtm@pdfcreationdate{\pdffeedback creationdate}% }% - {}% + {% + \ifdef\TeXOSQueryNow + {% + \TeXOSQueryNow{\dtm@pdfcreationdate}% + \ifdefempty\dtm@pdfcreationdate + {% + \undef\dtm@pdfcreationdate + }% + {}% + }% + {}% + }% } \newcommand*{\dtm@yearmonthsep}{-} \newcommand*{\dtm@monthdaysep}{-} @@ -232,6 +243,19 @@ \cslet{@dtm@#1@TZhour}{0}% \cslet{@dtm@#1@TZminute}{0}% } +\newcommand*{\DTMsavefrompdfdata}[2]{% + \edef\@dtm@tmp{#2}% + \expandafter\@dtm@parsepdfdatetime\@dtm@tmp\@dtm@endparsepdfdatetime + \cslet{@dtm@#1@year}{\@dtm@year}% + \cslet{@dtm@#1@month}{\@dtm@month}% + \cslet{@dtm@#1@day}{\@dtm@day}% + \cslet{@dtm@#1@dow}{\@dtm@dow}% + \cslet{@dtm@#1@hour}{\@dtm@hour}% + \cslet{@dtm@#1@minute}{\@dtm@minute}% + \cslet{@dtm@#1@second}{\@dtm@second}% + \cslet{@dtm@#1@TZhour}{\@dtm@timezonehour}% + \cslet{@dtm@#1@TZminute}{\@dtm@timezoneminute}% +} \ifdef\dtm@pdfcreationdate {% \def\@dtm@parsepdfdatetime#1:#2#3#4#5#6#7#8#9{% @@ -364,7 +388,42 @@ \def\@@dtm@parseluatimezone#1\@dtm@endparseluatimezone{% } } - {} + {% + \ifdef\TeXOSQueryFileDate + { + \renewcommand*{\DTMsavefilemoddate}[2]{% + \TeXOSQueryFileDate{\@dtm@tmp}{#2}% + \ifdefempty\@dtm@tmp + {% + \@dtm@warning{Your TeX engine doesn't support accessing + file modification dates and the attempt to use texosquery + failed}% + \cslet{@dtm@#1@year}{0}% + \cslet{@dtm@#1@month}{0}% + \cslet{@dtm@#1@day}{0}% + \cslet{@dtm@#1@dow}{-1}% + \cslet{@dtm@#1@hour}{0}% + \cslet{@dtm@#1@minute}{0}% + \cslet{@dtm@#1@second}{0}% + \cslet{@dtm@#1@TZhour}{0}% + \cslet{@dtm@#1@TZminute}{0}% + }% + {% + \expandafter\@dtm@parsepdfdatetime\@dtm@tmp\@dtm@endparsepdfdatetime + \cslet{@dtm@#1@year}{\@dtm@year}% + \cslet{@dtm@#1@month}{\@dtm@month}% + \cslet{@dtm@#1@day}{\@dtm@day}% + \cslet{@dtm@#1@dow}{\@dtm@dow}% + \cslet{@dtm@#1@hour}{\@dtm@hour}% + \cslet{@dtm@#1@minute}{\@dtm@minute}% + \cslet{@dtm@#1@second}{\@dtm@second}% + \cslet{@dtm@#1@TZhour}{\@dtm@timezonehour}% + \cslet{@dtm@#1@TZminute}{\@dtm@timezoneminute}% + }% + }% + } + {} + } }% }% {% @@ -670,8 +729,20 @@ \defzonemap{-12}{00}{Y}% Yankee time zone \defzonemap{00}{00}{Z}% Zulu time zone } +\newcommand*{\DTMifhasstyle}[3]{% + \ifcsdef{@dtm@style@#1}{#2}{#3}% +} +\newcommand*{\DTMifhasdatestyle}[3]{% + \ifcsdef{@dtm@datestyle@#1}{#2}{#3}% +} +\newcommand*{\DTMifhastimestyle}[3]{% + \ifcsdef{@dtm@timestyle@#1}{#2}{#3}% +} +\newcommand*{\DTMifhaszonestyle}[3]{% + \ifcsdef{@dtm@zonestyle@#1}{#2}{#3}% +} \newcommand*{\DTMnewstyle}[5]{% - \ifcsdef{@dtm@style@#1}% + \DTMifhasstyle{#1}% {% \PackageError{datetime2}{Style `#1' already exists}{}% }% @@ -688,10 +759,7 @@ }% } \newcommand*{\DTMrenewstyle}[5]{% - \ifcsundef{@dtm@style@#1}% - {% - \PackageError{datetime2}{Style `#1' doesn't exist}{}% - }% + \DTMifhasstyle{#1}% {% \DTMrenewdatestyle{#1}{#2}% \DTMrenewtimestyle{#1}{#3}% @@ -703,9 +771,12 @@ #5% }% }% + {% + \PackageError{datetime2}{Style `#1' doesn't exist}{}% + }% } \newcommand*{\DTMprovidestyle}[5]{% - \ifcsdef{@dtm@style@#1}% + \DTMifhasstyle{#1}% {% }% {% @@ -741,8 +812,108 @@ \PackageError{datetime2}{Zone style `#1' not defined}{}% }% } +\newcommand*{\DTMtryregional}{% + \@ifstar\s@dtm@tryregional\@dtm@tryregional +} +\newcommand*{\@dtm@tryregional}[3][]{% + \edef\@dtm@langcode{#2}% + \edef\@dtm@countrycode{#3}% + \s@dtm@tryregional[#1]{\@dtm@langcode}{\@dtm@countrycode}% +} +\newcommand*{\s@dtm@tryregional}[3][]{% + \def\@dtm@thisstyle{}% + \edef\@dtm@root{#1}% + \ifdefempty{#2}{}% + {% + \let\@dtm@thisstyle#2% + \ifdefempty\@dtm@root + {% + \edef\@dtm@root{\TrackedLanguageFromIsoCode{639-1}{#2}}% + \ifdefempty\@dtm@root + {% + \edef\@dtm@root{\TrackedLanguageFromIsoCode{639-2}{#2}}% + }% + {}% + }% + {}% + }% + \ifdefempty{#3}{}% + {% + \ifdefempty\@dtm@thisstyle + {\let\@dtm@thisstyle#3}% + {\eappto\@dtm@thisstyle{-#3}}% + }% + \ifdefempty\@dtm@thisstyle + {}% + {% + \DTMifcaseregional + {}% + {% + \DTMifhasstyle{\@dtm@thisstyle}% + {% + \csuse{@dtm@style@\@dtm@thisstyle}% + }% + {% + \ifdefempty\@dtm@root + {}% + {% + \DTMifhasstyle{\@dtm@root}% + {% + \csuse{@dtm@style@\@dtm@root}% + }% + {}% + }% + }% + }% + {% + \DTMifhasstyle{\@dtm@thisstyle-numeric}% + {% + \csuse{@dtm@style@\@dtm@thisstyle-numeric}% + }% + {% + \ifdefempty\@dtm@root + {}% + {% + \DTMifhasstyle{\@dtm@root-numeric}% + {% + \csuse{@dtm@style@\@dtm@root-numeric}% + }% + {}% + }% + }% + }% + }% +} +\newcommand*{\DTMsetregional}[1][text]{% + \DTMsetup{useregional=#1}% + \ifstrequal{#1}{false}% + {% + \DTMsetstyle{default}% + }% + {% + \ifcsdef{date\languagename} + {% + \csuse{date\languagename} + }% + {% + \ForEachTrackedDialect{\@dtm@thisdialect}% + {% + \edef\@dtm@lang{\TrackedLanguageFromDialect\@dtm@thisdialect}% + \edef\@dtm@langcode{\TrackedIsoCodeFromLanguage{639-1}{\@dtm@lang}}% + \ifdefempty\@dtm@langcode + {% + \edef\@dtm@langcode{\TrackedIsoCodeFromLanguage{639-2}{\@dtm@lang}}% + }% + {}% + \edef\@dtm@countrycode{% + \TrackedIsoCodeFromLanguage{3166-1}{\@dtm@thisdialect}}% + \s@dtm@tryregional[\@dtm@lang]{\@dtm@langcode}{\@dtm@countrycode}% + }% + }% + }% +} \newrobustcmd*{\DTMsetstyle}[1]{% - \ifcsdef{@dtm@style@#1}% + \DTMifhasstyle{#1}% {\csuse{@dtm@style@#1}}% {% \let\dtm@unknownstyle\@dtm@unknownstyle -- cgit v1.2.3