From f68f59a8625bc76f04fe0f5e292eab41fde302b3 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Tue, 10 Nov 2015 22:19:05 +0000
Subject: datetime2 (10nov15)

git-svn-id: svn://tug.org/texlive/trunk@38814 c570f23f-e606-0410-a88d-b1316a301751
---
 .../source/latex/datetime2/datetime2.dtx           | 295 +++++++++++++++++++--
 1 file changed, 270 insertions(+), 25 deletions(-)

(limited to 'Master/texmf-dist/source/latex/datetime2/datetime2.dtx')

diff --git a/Master/texmf-dist/source/latex/datetime2/datetime2.dtx b/Master/texmf-dist/source/latex/datetime2/datetime2.dtx
index 7eb33e1e000..8e1bae7503a 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:
-%   -section "chapter"
-%   -src "datetime2.sty\Z=>datetime2.sty"
-%   -src "datetime2-calc.sty\Z=>datetime2-calc.sty"
 %   -doc "datetime2-manual.tex"
 %   -author "Nicola Talbot"
+%   -src "datetime2.sty\Z=>datetime2.sty"
+%   -src "datetime2-calc.sty\Z=>datetime2-calc.sty"
+%   -section "chapter"
 %   datetime2
-% Created on 2015/9/15 10:14
+% Created on 2015/11/10 10:38
 %\fi
 %\iffalse
 %<*package>
@@ -48,7 +48,7 @@
             pdftitle={datetime2: date and time formats}]{hyperref}
 
 
-\CheckSum{1943}
+\CheckSum{1991}
 
 \renewcommand*{\usage}[1]{\hyperpage{#1}}
 \renewcommand*{\main}[1]{\hyperpage{#1}}
@@ -70,11 +70,11 @@
 %
 %\MakeShortVerb{"}
 %
-%\title{datetime2 v1.1:
+%\title{datetime2 v1.2:
 %date and time formats}
 %\author{Nicola L. C. Talbot\\\url{http://www.dickimaw-books.com/}}
 %
-%\date{2015-09-15}
+%\date{2015-11-10}
 %\maketitle
 %
 %\begin{abstract}
@@ -271,9 +271,17 @@
 %provided by the language modules and should be described in the
 %module's documentation. Different languages may have different
 %options so \texttt{abbr} may not be available for some of them. The
-%\pkgopt{showdow} (show day of week) option is a package-wide option.
-%You need to check the documentation to find out which styles check
+%\pkgopt{showdow} (show day of week) option is a package-wide option
+%even though it's a language setting. (This is because the
+%\sty{datetime2-calc} package is also needed if the day of the week
+%should be displayed. As a package option, \pkgopt{showdow} can
+%automatically load the required package.)
+%
+%\begin{important}
+%You need to check the documentation for the relevant language module
+%or package to find out which styles check
 %the \pkgopt{showdow} setting as not all of them do.
+%\end{important}
 %
 %\chapter{Displaying the Date and Time}
 %\label{sec:display}
@@ -335,7 +343,7 @@
 %redefined so that it no longer uses \cs{DTMdisplaydate}.
 %\end{important}
 %
-%As mentioned above, some styles allow the day of the week to be
+%As mentioned above, \emph{some styles} allow the day of the week to be
 %displayed. This requires the \sty{datetime2-calc} package which will
 %automatically be loaded if you set \pkgopt{showdow} in the
 %\styfmt{datetime2} package option list or if you set
@@ -1078,16 +1086,75 @@
 %and shouldn't contain active characters.
 %\end{important}
 %
+%As from version 1.2, you can redefine existing styles with the following 
+%commands.
+%
+%\begin{definition}[\DescribeMacro\DTMrenewdatestyle]
+%\cs{DTMrenewdatestyle}\marg{name}\marg{definition}
+%\end{definition}
+%This redefines the named date style. The original may be either a
+%partial or a full style.
+%
+%\begin{definition}[\DescribeMacro\DTMrenewtimestyle]
+%\cs{DTMrenewtimestyle}\marg{name}\marg{definition}
+%\end{definition}
+%This redefines the named time style. The original may be either a
+%partial or a full style.
+%
+%\begin{definition}[\DescribeMacro\DTMrenewzonestyle]
+%\cs{DTMrenewzonestyle}\marg{name}\marg{definition}
+%\end{definition}
+%This redefines the named time zone style. The original may be either a
+%partial or a full style.
+%
+%\begin{definition}[\DescribeMacro\DTMrenewstyle]
+%\cs{DTMrenewstyle}\marg{name}\marg{definition}
+%\end{definition}
+%This redefines the named full style. The original style must also
+%be a full style.
+%
+%There are also commands analogous to \cs{providecommand} that will
+%define styles that don't already exist.
+%
+%\begin{definition}[\DescribeMacro\DTMprovidedatestyle]
+%\cs{DTMprovidedatestyle}\marg{name}\marg{definition}
+%\end{definition}
+%This defines the named date style. This won't do anything if either
+%a partial date style or a full style with the given name already
+%exists.
+%
+%\begin{definition}[\DescribeMacro\DTMprovidetimestyle]
+%\cs{DTMprovidetimestyle}\marg{name}\marg{definition}
+%\end{definition}
+%This defines the named time style. This won't do anything if either
+%a partial time style or a full style with the given name already
+%exists.
+%
+%\begin{definition}[\DescribeMacro\DTMprovidezonestyle]
+%\cs{DTMprovidezonestyle}\marg{name}\marg{definition}
+%\end{definition}
+%This defines the named zone style. This won't do anything if either
+%a partial zone style or a full style with the given name already
+%exists.
+%
+%\begin{definition}[\DescribeMacro\DTMprovidestyle]
+%\cs{DTMprovidestyle}\marg{name}\marg{definition}
+%\end{definition}
+%This defines the named full style if the named full style doesn't
+%already exist. This internally uses the previous
+%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.
+%
 %There are some helper commands provided that you might want to use
 %in the style definitions.
 %
 %\begin{definition}[\DescribeMacro\DTMtwodigits]
 %\cs{DTMtwodigits}\marg{number}
 %\end{definition}
-%This displays \meta{number} so that it has \emph{only} two digits.
+%This displays \meta{number} so that it has \emph{exactly} two digits.
 %Unlike \LaTeX's \cs{two@digits} this will check for a negative
-%number and will trim a number whose absolute value is greater
-%than 100. This command is expandable.
+%number and will trim a number whose absolute value is greater than
+%or equal to 100. This command is expandable.
 %
 %\begin{definition}[\DescribeMacro\DTMcentury]
 %\cs{DTMcentury}\marg{year}
@@ -1538,13 +1605,17 @@
 %
 %You can use the English or Irish modules as a template for a
 %language with multiple regions. Just download the English source
-%files \texttt{datetime2-english.dtx} and
-%\texttt{datetime2-english.ins} or the Irish source files
-%\texttt{datetime2-irish.dtx} and \texttt{datetime2-irish.ins} from
+%files
+%\href{http://mirror.ctan.org/macros/latex/contrib/datetime2-contrib/datetime2-english/datetime2-english.dtx}{\texttt{datetime2-english.dtx}} and
+%\href{http://mirror.ctan.org/macros/latex/contrib/datetime2-contrib/datetime2-english/datetime2-english.ins}{\texttt{datetime2-english.ins}} or the Irish source files
+%\href{http://mirror.ctan.org/macros/latex/contrib/datetime2-contrib/datetime2-irish/datetime2-irish.dtx}{\texttt{datetime2-irish.dtx}}
+%and
+%\href{http://mirror.ctan.org/macros/latex/contrib/datetime2-contrib/datetime2-irish/datetime2-irish.ins}{\texttt{datetime2-irish.ins}} from
 %CTAN and make the appropriate modifications. Alternatively you can
 %use the Scottish module as a template for a single-region language.
-%Just download the Scottish source files \texttt{datetime2-scottish.dtx} and
-%\texttt{datetime2-scottish.ins} from CTAN and make the appropriate
+%Just download the Scottish source files 
+%\href{http://mirror.ctan.org/macros/latex/contrib/datetime2-contrib/datetime2-scottish/datetime2-scottish.dtx}{\texttt{datetime2-scottish.dtx}} and
+%\href{http://mirror.ctan.org/macros/latex/contrib/datetime2-contrib/datetime2-scottish/datetime2-scottish.ins}{\texttt{datetime2-scottish.ins}} from CTAN and make the appropriate
 %modifications. (Don't forget to provide a README file.)
 %
 %Each language module should be in a file named
@@ -1780,7 +1851,19 @@
 %This option may be used in \cs{DTMsetup}, but if you attempt to
 %switch it on in the \env{document} environment you'll get an error
 %if the \sty{datetime2-calc} package hasn't been loaded.
-%Default: \texttt{false}.
+%\textbf{Not all styles support this setting.}
+%Default: \texttt{false}. 
+%
+%This option is actually a language-dependent option and isn't used
+%by the base package, but it's implemented as a package option as the
+%\sty{datetime2-calc} package is also needed if the day of the week
+%should be displayed. As a package option, \pkgopt{showdow} can
+%automatically load the required package.
+%
+%\begin{important}
+%You need to check the documentation to find out which styles check
+%the \pkgopt{showdow} setting as not all of them do.
+%\end{important}
 %
 %\item[\pkgopt{warn}] This is a boolean key. If true (default)
 %\styfmt{datetime2} warnings will be displayed. If false, the warnings
@@ -1948,8 +2031,8 @@
 %This package loads the \sty{pgfcalendar} package which provides a
 %way of computing the day of week from a given date. Once
 %\sty{datetime2-calc} has been loaded, you can enable or disable the
-%weekday in dates where the style supports this, but note that not
-%all styles support this, even if the \sty{datetime2-calc} package
+%weekday in dates where the style supports this, but note that \emph{not
+%all styles support this}, even if the \sty{datetime2-calc} package
 %has been loaded.
 %
 %As with the commands in \sectionref{sec:store}, the commands
@@ -2122,7 +2205,7 @@
 %\changes{1.0}{2015-03-24}{Initial release}
 %    \begin{macrocode}
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datetime2}[2015/09/15 v1.1 (NLCT) date and time formats]
+\ProvidesPackage{datetime2}[2015/11/10 v1.2 (NLCT) date and time formats]
 %    \end{macrocode}
 % Use \sty{tracklang} to find out what languages have been loaded.
 %    \begin{macrocode}
@@ -3062,7 +3145,7 @@
 %\end{macro}
 %
 %\begin{macro}{\DTMdivhundred}
-% Expands to the given number modulo 100.
+% Expands to the given number divided by 100.
 %    \begin{macrocode}
 \newcommand*{\DTMdivhundred}[1]{%
   \ifnum#1<0
@@ -3123,6 +3206,40 @@
 %    \end{macrocode}
 %\end{macro}
 %
+%\begin{macro}{\DTMrenewdatestyle}
+% Redefine a date style. This should only redefine
+% \cs{DTMdisplaydate} and \cs{DTMDisplaydate}, which may or may not
+% use the separators \cs{dtm@yearmonthsep} and \cs{dtm@monthdaysep}.
+% This may also be used to modify the date part of a full style.
+%\changes{1.2}{2015-11-10}{new}
+%    \begin{macrocode}
+\newcommand*{\DTMrenewdatestyle}[2]{%
+  \ifcsundef{@dtm@datestyle@#1}%
+  {%
+    \PackageError{datetime2}{Date style `#1' doesn't exist}{}%
+  }%
+  {%
+     \csdef{@dtm@datestyle@#1}{#2}%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMprovidedatestyle}
+% Define a date style if it doesn't already exist.
+%\changes{1.2}{2015-11-10}{new}
+%    \begin{macrocode}
+\newcommand*{\DTMprovidedatestyle}[2]{%
+  \ifcsdef{@dtm@datestyle@#1}%
+  {%
+  }%
+  {%
+     \csdef{@dtm@datestyle@#1}{#2}%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
 %\begin{macro}{\DTMnewtimestyle}
 % Define a new time-only style. This should only redefine
 % \cs{DTMdisplaytime}, which may or may not use the separators
@@ -3140,7 +3257,41 @@
 %    \end{macrocode}
 %\end{macro}
 %
-%\begin{macro}{\DTMnewtimezone}
+%\begin{macro}{\DTMrenewtimestyle}
+% Redefine a time style. This should only redefine
+% \cs{DTMdisplaytime}, which may or may not use the separators
+% \cs{dtm@hourminsep} and \cs{dtm@minsecsep}.
+% This may also be used to modify the time part of a full style.
+%\changes{1.2}{2015-11-10}{new}
+%    \begin{macrocode}
+\newcommand*{\DTMrenewtimestyle}[2]{%
+  \ifcsundef{@dtm@timestyle@#1}%
+  {%
+    \PackageError{datetime2}{Time style `#1' doesn't exist}{}%
+  }%
+  {%
+     \csdef{@dtm@timestyle@#1}{#2}%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMprovidetimestyle}
+% Define a time style if it doesn't already exist.
+%\changes{1.2}{2015-11-10}{new}
+%    \begin{macrocode}
+\newcommand*{\DTMprovidetimestyle}[2]{%
+  \ifcsdef{@dtm@timestyle@#1}%
+  {%
+  }%
+  {%
+     \csdef{@dtm@timestyle@#1}{#2}%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMnewzonestyle}
 % Define a new zone-only style. This should only redefine
 % \cs{DTMdisplayzone}, which may or may not use the separator
 % \cs{dtm@hourminsep}.
@@ -3157,6 +3308,40 @@
 %    \end{macrocode}
 %\end{macro}
 %
+%\begin{macro}{\DTMrenewzonestyle}
+% Redefine a new zone style. This should only redefine
+% \cs{DTMdisplayzone}, which may or may not use the separator
+% \cs{dtm@hourminsep}.
+% This may also be used to modify the zone part of a full style.
+%\changes{1.2}{2015-11-10}{new}
+%    \begin{macrocode}
+\newcommand*{\DTMrenewzonestyle}[2]{%
+  \ifcsundef{@dtm@zonestyle@#1}%
+  {%
+    \PackageError{datetime2}{Zone style `#1' doesn't exist}{}%
+  }%
+  {%
+     \csdef{@dtm@zonestyle@#1}{#2}%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMprovidezonestyle}
+% Defines a new zone style if it doesn't already exist.
+%\changes{1.2}{2015-11-10}{new}
+%    \begin{macrocode}
+\newcommand*{\DTMprovidezonestyle}[2]{%
+  \ifcsdef{@dtm@zonestyle@#1}%
+  {%
+  }%
+  {%
+     \csdef{@dtm@zonestyle@#1}{#2}%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
 % Zone styles may use mappings to use a~regional time zone (such as
 % GMT or BST). It's up to the language modules to define these
 % mappings. A~mapping for time zone \meta{TZh}:\meta{TZm} is stored in 
@@ -3297,6 +3482,64 @@
 %    \end{macrocode}
 %\end{macro}
 %
+%\begin{macro}{\DTMrenewstyle}
+%\begin{definition}
+%\cs{DTMrenewstyle}\marg{label}\marg{date style definition}\marg{time
+%style definition}\marg{zone style definition}\marg{full format
+%definition}
+%\end{definition}
+% Redefine a style. The full format redefines \cs{DTMdisplay}
+% and \cs{DTMDisplay}.
+%\changes{1.2}{2015-11-10}{new}
+%    \begin{macrocode}
+\newcommand*{\DTMrenewstyle}[5]{%
+  \ifcsundef{@dtm@style@#1}%
+  {%
+    \PackageError{datetime2}{Style `#1' doesn't exist}{}%
+  }%
+  {%
+    \DTMrenewdatestyle{#1}{#2}%
+    \DTMrenewtimestyle{#1}{#3}%
+    \DTMrenewzonestyle{#1}{#4}%
+     \csdef{@dtm@style@#1}{%
+        \csuse{@dtm@datestyle@#1}%
+        \csuse{@dtm@timestyle@#1}%
+        \csuse{@dtm@zonestyle@#1}%
+        #5%
+     }%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMprovidestyle}
+%\begin{definition}
+%\cs{DTMprovidestyle}\marg{label}\marg{date style definition}\marg{time
+%style definition}\marg{zone style definition}\marg{full format
+%definition}
+%\end{definition}
+% Defines a full style if it doesn't already exist.
+%\changes{1.2}{2015-11-10}{new}
+%    \begin{macrocode}
+\newcommand*{\DTMprovidestyle}[5]{%
+  \ifcsdef{@dtm@style@#1}%
+  {%
+  }%
+  {%
+    \DTMprovidedatestyle{#1}{#2}%
+    \DTMprovidetimestyle{#1}{#3}%
+    \DTMprovidezonestyle{#1}{#4}%
+     \csdef{@dtm@style@#1}{%
+        \csuse{@dtm@datestyle@#1}%
+        \csuse{@dtm@timestyle@#1}%
+        \csuse{@dtm@zonestyle@#1}%
+        #5%
+     }%
+  }%
+}
+%    \end{macrocode}
+%\end{macro}
+%
 %\begin{macro}{\DTMsetdatestyle}
 %    \begin{macrocode}
 \newrobustcmd*{\DTMsetdatestyle}[1]{%
@@ -4048,6 +4291,8 @@
 % Save the time (including zone) specified in the format
 %\meta{YYYY}-\meta{MM}-\meta{DD}T\meta{hh}:\meta{mm}:\meta{ss}\meta{time
 %zone}
+%
+%The first argument is the label.
 %    \begin{macrocode}
 \newrobustcmd*{\DTMsavetimestamp}[2]{%
   \expandafter\@dtm@parsetimestamp#2\@dtm@endparsetimestamp
@@ -4481,7 +4726,7 @@
 %\section{datetime2-calc.sty code}
 %    \begin{macrocode}
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datetime2-calc}[2015/09/15 v1.1 (NLCT)]
+\ProvidesPackage{datetime2-calc}[2015/11/10 v1.2 (NLCT)]
 %    \end{macrocode}
 % Load other required packages
 %    \begin{macrocode}
-- 
cgit v1.2.3

