diff options
12 files changed, 4496 insertions, 93 deletions
diff --git a/Master/texmf-dist/doc/latex/datetime2/CHANGES b/Master/texmf-dist/doc/latex/datetime2/CHANGES index 1853b5be212..5c66deccc67 100644 --- a/Master/texmf-dist/doc/latex/datetime2/CHANGES +++ b/Master/texmf-dist/doc/latex/datetime2/CHANGES @@ -1,3 +1,22 @@ +1.3 (2016-01-22) : + + * datetime2.sty: + + - new styles: ddmmyy, mmddyy + + - new command: \DTMusemodule + + - added starred version of \DTMlangsetup + + * datetime2-calc.sty: + + - new standalone language-sensitive month name, weekday name + and date ordinal commands + + * datetime2 manual: + + - added chapter on migrating from datetime.sty + 1.2 (2015-11-10) : * Added \DTMrenewdatestyle, \DTMrenewtimestyle, \DTMrenewzonestyle, \DTMrenewstyle, \DTMprovidedatestyle, diff --git a/Master/texmf-dist/doc/latex/datetime2/README b/Master/texmf-dist/doc/latex/datetime2/README index 64056e2070a..275a604a457 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.2 +LaTeX Package : datetime2 v1.3 -Last Modified : 2015-11-10 +Last Modified : 2016-01-22 Author : Nicola Talbot diff --git a/Master/texmf-dist/doc/latex/datetime2/datetime2.pdf b/Master/texmf-dist/doc/latex/datetime2/datetime2.pdf Binary files differindex 128a3ca6d56..a665d5d24bb 100644 --- a/Master/texmf-dist/doc/latex/datetime2/datetime2.pdf +++ b/Master/texmf-dist/doc/latex/datetime2/datetime2.pdf 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 Binary files differindex 5e69d1e8ee9..37fd783acb3 100644 --- a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-babel.pdf +++ b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-babel.pdf 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 Binary files differindex 4015e80c54e..a425777c94b 100644 --- a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-calc.pdf +++ b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-calc.pdf 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 Binary files differindex 3d7dd896f58..711982016ca 100644 --- a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-filedate.pdf +++ b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-filedate.pdf 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 Binary files differindex 63d51a90f15..1e4879d3163 100644 --- a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-hyperref.pdf +++ b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-hyperref.pdf 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 Binary files differindex e6fd27f58b8..d9e46899419 100644 --- a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-styles.pdf +++ b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-styles.pdf diff --git a/Master/texmf-dist/source/latex/datetime2/datetime2.dtx b/Master/texmf-dist/source/latex/datetime2/datetime2.dtx index 8e1bae7503a..af2c3e8fc7d 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" % -author "Nicola Talbot" +% -section "chapter" % -src "datetime2.sty\Z=>datetime2.sty" % -src "datetime2-calc.sty\Z=>datetime2-calc.sty" -% -section "chapter" +% -doc "datetime2-manual.tex" % datetime2 -% Created on 2015/11/10 10:38 +% Created on 2016/1/22 15:29 %\fi %\iffalse %<*package> @@ -30,7 +30,7 @@ %\fi % \iffalse % Doc-Source file to use with LaTeX2e -% Copyright (C) 2015 Nicola Talbot, all rights reserved. +% Copyright (C) 2016 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> @@ -48,20 +48,42 @@ pdftitle={datetime2: date and time formats}]{hyperref} -\CheckSum{1991} +\CheckSum{2343} +\RecordChanges +\DisableCrossrefs \renewcommand*{\usage}[1]{\hyperpage{#1}} \renewcommand*{\main}[1]{\hyperpage{#1}} -\IndexPrologue{\chapter*{\indexname}\markboth{\indexname}{\indexname}} +\IndexPrologue{\chapter*{\indexname}\markboth{\indexname}{\indexname}% +\addcontentsline{toc}{chapter}{Index}} \setcounter{IndexColumns}{2} -\newcommand{\style}[1]{\texttt{#1}\index{#1=\texttt{#1} style|main}} +\newcommand{\style}[1]{\texttt{#1}% + \index{#1=\texttt{#1} style|main}% + \index{styles:>#1=\texttt{#1}|main}} + +\newcommand*{\module}[2][]{% + \ifblank{#1}% + {% + \href{http://ctan.org/pkg/datetime2-#2}{\texttt{#2}}% + }% + {% + \href{http://ctan.org/pkg/datetime2-#1}{\texttt{#2}}% + }% +} \doxitem{Option}{option}{options (definitions)} \DTMsavetimestamp{gmt}{2015-03-01T15:35:09+00:00} \DTMsavetimestamp{bst}{2015-04-01T08:55:39+01:00} +\newcommand*{\inpkg}[1]{\llap{\styfmt{#1}}} +\newcommand*{\oldcs}[1]{\cs{#1}% + \index{datetime commands:=\styfmt{datetime} package commands>#1=\cs{#1}|main}% +} + +\setlength\marginparwidth{70pt} + \begin{document} \DocInput{datetime2.dtx} \end{document} @@ -70,11 +92,11 @@ % %\MakeShortVerb{"} % -%\title{datetime2 v1.2: +%\title{datetime2 v1.3: %date and time formats} %\author{Nicola L. C. Talbot\\\url{http://www.dickimaw-books.com/}} % -%\date{2015-11-10} +%\date{2016-01-22} %\maketitle % %\begin{abstract} @@ -98,9 +120,9 @@ %been a better name, but the 8 dot 3 filename restriction was a concern back %then.} However some users found the time formats useful %and the ability to save dates for later use, so when \sty{babel} -%came along I~had a number of requests to make \sty{datetime} +%came along I~had a number of requests to make \styfmt{datetime} %compatible with \sty{babel} so that the regional date formats were -%preserved but the other \sty{datetime} functions could be used. +%preserved but the other \styfmt{datetime} functions could be used. %Then PDF\TeX\ came into existence and its \cs{pdfcreationdate} now %provided a~way of obtaining the seconds and time zone, which can't %be obtained from \TeX's \cs{time} primitive. Over time, the @@ -108,7 +130,7 @@ %original na\"ive \LaTeX\ code of my first package, as it's been %stretched well past its intended design. % -%The other problem with \sty{datetime} is that some of the commands +%The other problem with \styfmt{datetime} is that some of the commands %aren't expandable but some users want to be able to use them in %expandable contexts (such as, for example, PDF bookmarks or writing %a date stamp to an external file) or they @@ -117,7 +139,7 @@ %weekday and month names are proper nouns and so automatically start %with an upper case letter, regardless of where they appear in %a~sentence. Users who don't know the history and original purpose of -%the \sty{datetime} package are puzzled as to why the defaults are +%the \styfmt{datetime} package are puzzled as to why the defaults are %all UK English or some styles were hard-coded, and some users are %confused as to the ordering of the day, month and year parameters. %In addition, some command names were incompatible with other @@ -125,7 +147,7 @@ %compatibility with older documents. % %In order to address all these issues, a~replacement package is -%necessary. Your old documents that use \sty{datetime} should +%necessary. Your old documents that use \styfmt{datetime} should %still be able to compile, but for your new documents, you may prefer %the improved \styfmt{datetime2} package instead. % @@ -273,7 +295,7 @@ %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 %even though it's a language setting. (This is because the -%\sty{datetime2-calc} package is also needed if the day of the week +%\styfmt{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.) % @@ -283,6 +305,54 @@ %the \pkgopt{showdow} setting as not all of them do. %\end{important} % +%If for some reason you can't load \sty{babel} before \styfmt{datetime2} +%and can only load it afterwards, then you need to explicitly load +%the module for each \sty{babel} dialect with: +%\begin{definition}[\DescribeMacro\DTMusemodule] +%\cs{DTMusemodule}\meta{language}\marg{module-name} +%\end{definition} +%where \meta{language} is the language (or dialect) name used with +%\sty{babel} (for example, \texttt{british}) and \meta{module-name} +%is the name of the \styfmt{datetime2} module (for example, \texttt{en-GB}). +% +%Example: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{datetime2} +% +%\usepackage[british,irish]{babel} +% +%\DTMusemodule{british}{en-GB} +%\DTMusemodule{irish}{ga-IE} +% +%\end{verbatim} +%The \meta{language} argument should match the +%\cs{date\meta{language}} command provided by \sty{babel}. Similarly +%for \sty{polyglossia}: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{datetime2} +% +%\usepackage{polyglossia} +%\setmainlanguage[variant=uk]{english} +%\setotherlanguage{irish} +% +%\DTMusemodule{english}{en-GB} +%\DTMusemodule{irish}{ga-IE} +% +%\end{verbatim} +%This ensures that not only is the required \styfmt{datetime2} +%regional module loaded but also the date switching mechanism +%\cs{date\meta{language}} is modified to prevent \sty{babel} or +%\sty{polyglossia} from interfering with \styfmt{datetime2}. +% +%Remember that you need to switch on the regional style, if required: +%\begin{verbatim} +%\DTMsetup{useregional} +%\end{verbatim} +% %\chapter{Displaying the Date and Time} %\label{sec:display} % @@ -301,11 +371,19 @@ %(Some styles always ignore the day of week, regardless of its %value.) This command is intended for use in expandable contexts %(such as writing the date to another file or using the date in the -%bookmarks) and is used by \cs{today}. The date styles should ensure -%that any fragile content is protected. (This is why the \meta{dow} +%bookmarks) and is used by \cs{today}. The date styles must ensure +%that any fragile content is protected. (This is why \meta{dow} %isn't an optional argument otherwise the command wouldn't be %expandable.) % +%\begin{important} +%The \meta{dow} argument must always be an integer from $-1$ to $6$. +%It should not be left blank or set to any other value. In some +%cases using an incorrect value may not cause a problem, but in other +%cases it will. So it's best to get into the habit of always setting +%it correctly. +%\end{important} +% %Some styles may start the date with a word (such as the day of the %week name or the month name). In English, proper nouns are %capitalised regardless of where they appear in a~sentence but some @@ -344,21 +422,21 @@ %\end{important} % %As mentioned above, \emph{some styles} allow the day of the week to be -%displayed. This requires the \sty{datetime2-calc} package which will +%displayed. This requires the \styfmt{datetime2-calc} package which will %automatically be loaded if you set \pkgopt{showdow} in the %\styfmt{datetime2} package option list or if you set %\pkgopt{showdow} in \ics{DTMsetup} \emph{in the preamble}. The -%package option \pkgopt{calc} will also load \sty{datetime2-calc} or +%package option \pkgopt{calc} will also load \styfmt{datetime2-calc} or %you can load it explicitly using \cs{usepackage} after %\styfmt{datetime2} has been loaded. (You may use \pkgopt[true]{showdow} in %the \env{document} environment if the \styfmt{datetime2-calc} %package has been loaded in the preamble either explicitly or through %the \pkgopt{calc} option.) % -%When \sty{datetime2-calc} is loaded, it computes the current day of +%When \styfmt{datetime2-calc} is loaded, it computes the current day of %the week (using commands provided by the \sty{pgfcalendar} package) %which can then be used by \cs{today} or \cs{Today}. If -%\sty{datetime2-calc} isn't loaded then neither \cs{today} nor +%\styfmt{datetime2-calc} isn't loaded then neither \cs{today} nor %\cs{Today} will display the day of the week, regardless of the %current style. % @@ -388,13 +466,13 @@ %\cs{DTMDate}. Use \cs{DTMdisplaydate} or %\cs{DTMDisplaydate} instead. %\end{important}\footnotetext{Well, actually it can if you put it in braces -%and don't use \sty{datetime2-calc}.} +%and don't use \styfmt{datetime2-calc}.} % %These commands internally use \cs{DTMdisplaydate} and -%\cs{DTMDisplaydate}, respectively. If the \sty{datetime2-calc} +%\cs{DTMDisplaydate}, respectively. If the \styfmt{datetime2-calc} %package has been loaded, the day of the week will be computed, %otherwise the day of the week will be set to \texttt{-1}. Another -%benefit of the \sty{datetime2-calc} package is that it allows +%benefit of the \styfmt{datetime2-calc} package is that it allows %additional formats permitted by the \sty{pgfcalendar} package: %\begin{itemize} %\item \meta{YYYY}\texttt{-}\meta{MM}\texttt{-last} (the last day of @@ -426,12 +504,12 @@ %date. % %An error or unexpected results may occur if you try using one of -%these extended formats without loading the \sty{datetime2-calc} -%package. An example that only works with \sty{datetime2-calc}: +%these extended formats without loading the \styfmt{datetime2-calc} +%package. An example that only works with \styfmt{datetime2-calc}: %\begin{verbatim} %\DTMdate{2015-03-last} %\end{verbatim} -%An example that works with or without \sty{datetime2-calc}: +%An example that works with or without \styfmt{datetime2-calc}: %\begin{verbatim} %\DTMdate{2015-03-31} %\end{verbatim} @@ -501,7 +579,7 @@ % %The full date, time and zone (if available) can be displayed using %\begin{definition}[\DescribeMacro\DTMdisplay] -%\cs{DTMdisplay}\marg{year}\marg{month}\marg{day}\marg{day of week}\marg{hh}\marg{mm}\marg{ss}\marg{TZh}\marg{TZm} +%\cs{DTMdisplay}\marg{year}\marg{month}\marg{day}\marg{dow}\marg{hh}\marg{mm}\marg{ss}\marg{TZh}\marg{TZm} %\end{definition} %The arguments are all numerical. The way the information is %displayed in the document is governed by the \termdef{full style} @@ -515,7 +593,7 @@ % %There is also an analogous version if capitalisation is required: %\begin{definition}[\DescribeMacro\DTMDisplay] -%\cs{DTMDisplay}\marg{year}\marg{month}\marg{day}\marg{day of week}\marg{hh}\marg{mm}\marg{ss}\marg{TZh}\marg{TZm} +%\cs{DTMDisplay}\marg{year}\marg{month}\marg{day}\marg{dow}\marg{hh}\marg{mm}\marg{ss}\marg{TZh}\marg{TZm} %\end{definition} %Some styles may simply make this equivalent to \cs{DTMdisplay}. %Other styles may use a~similar format to \cs{DTMdisplay} but replace @@ -552,11 +630,11 @@ %\end{definition} %where \meta{date} is in the same format as for \cs{DTMdate}. %As with \cs{DTMdate} (and \cs{DTMDate}) the format can be extended -%with the \sty{datetime2-calc} package. If you want to access the day -%of week, you must make sure that \sty{datetime2-calc} has been +%with the \styfmt{datetime2-calc} package. If you want to access the day +%of week, you must make sure that \styfmt{datetime2-calc} has been %loaded \emph{before you save the date}. (Remember that the \pkgopt{calc} %and \pkgopt{showdow} package options will automatically load -%\sty{datetime2-calc}.) If \sty{datetime2-calc} has been loaded, the +%\styfmt{datetime2-calc}.) If \styfmt{datetime2-calc} has been loaded, the %day of week number will be calculated and saved. Whether or not it %is displayed in the document when the date is later used depends on %the settings when the date is displayed not when it's saved. @@ -574,7 +652,7 @@ %\end{definition} %The day of week \meta{dow} may be \texttt{-1} if unknown. This %command doesn't calculate the day of week, even if -%\sty{datetime2-calc} has been loaded. +%\styfmt{datetime2-calc} has been loaded. % %Times are saved using %\begin{definition}[\DescribeMacro\DTMsavetime] @@ -943,12 +1021,27 @@ %The options that modify the %\style{default} style similarly modify this style. % +%\item[\style{ddmmyy}] This is like the \style{default} style +%except that the date is formatted in the reverse order +%\begin{display} +%\meta{DD}\meta{MDsep}\meta{MM}\meta{YMsep}\meta{YY} +%\end{display} +%The day, month and year are displayed as two-digits and the separators are +%as for the \style{default} style. The options that modify the +%\style{default} style similarly modify this style. +% %\item[\style{mmddyyyy}] This is like the \style{ddmmyyyy} style %except the day and month numbers are reversed. The separator between %the month and day is still given by the \pkgopt{monthdaysep} or %\pkgopt{datesep} options. The separator between the day and year is given by %the \pkgopt{dayyearsep} or \pkgopt{datesep} options. % +%\item[\style{mmddyy}] This is like the \style{ddmmyy} style +%except the day and month numbers are reversed. The separator between +%the month and day is still given by the \pkgopt{monthdaysep} or +%\pkgopt{datesep} options. The separator between the day and year is given by +%the \pkgopt{dayyearsep} or \pkgopt{datesep} options. +% %\item[\style{mdyyyy}] This is like the \style{mmddyyyy} style except %that it doesn't force the day and month into a~two-digit format. % @@ -992,7 +1085,7 @@ %There's only one predefined time (partial) style provided %by the base \styfmt{datetime2} package. This style can be used to %override the time format part of full styles. For example, to use -%the \style{default} full style with the \sty{hmmss} time style: +%the \style{default} full style with the \style{hmmss} time style: %\begin{verbatim} %\DTMsetstyle{default}\DTMsettimestyle{hmmss} %\end{verbatim} @@ -1239,7 +1332,7 @@ %the zone mappings). % %The language modules may provide mappings that are enabled -%when you switch to that style. For example, the \texttt{en-GB} +%when you switch to that style. For example, the \module[english]{en-GB} %language module provides the \pkgopt{mapzone} option which, if set %to \texttt{true}, will map +00:00 to GMT and +01:00 to BST. See the %documentation for the language module for further details. @@ -1356,12 +1449,13 @@ %\begin{important} %Be careful not to mix the language\slash region options between the document %class option list and the \sty{babel}\slash\sty{polyglossia} -%interface. For example: +%interface. For example, don't do: %\begin{verbatim} %\documentclass[en-GB]{article} %\usepackage[canadien,british]{babel} %\end{verbatim} -%This will prevent the \sty{tracklang} package from picking up the +%\end{important} +%The above example will prevent the \sty{tracklang} package from picking up the %\sty{babel} setting and it will only detect the \texttt{en-GB} %option. Use only the document class options or only the \sty{babel} %package option list or duplicate \emph{all} the \sty{babel} package options with @@ -1380,7 +1474,7 @@ %\documentclass[fr-CA,en-GB]{article} %\usepackage[canadien,british]{babel} %\end{verbatim} -%\end{important} +% %Language modules may be used without \sty{babel} or \sty{polyglossia}. %For example: %\begin{verbatim} @@ -1391,7 +1485,8 @@ %\end{document} %\end{verbatim} %If you have more than one language or region you will need to switch -%styles using \cs{DTMsetstyle} etc: +%styles using \cs{DTMsetstyle} etc if you aren't using \sty{babel} or +%\sty{polyglossia}: %\begin{verbatim} %\documentclass{article} %\usepackage[en-GB,en-CA]{datetime2} @@ -1513,7 +1608,7 @@ %\end{verbatim} %In this case \sty{tracklang} is unable to pick up the variant and %can only detect the root language, so it will load the generic -%\texttt{english} module instead of the \texttt{en-GB} module. This +%\module{english} module instead of the \texttt{en-GB} module. This %means that the \style{en-GB} and \style{en-GB-numeric} styles are no longer %available. However, since \pkgopt{useregional} is \texttt{false} the %date is still displayed using the \texttt{default} numeric style @@ -1566,7 +1661,7 @@ %as \pkgopt{scottish}, provide a text style with the root language %name (\style{scottish} in this instance) and a numeric style in the %form \meta{language}\texttt{-numeric} (such as \style{scottish-numeric}). -%Note that \texttt{irish} has regionless styles \texttt{irish} and +%Note that the \module{irish} module has regionless styles \texttt{irish} and %\texttt{irish-numeric} but also has regional styles %\texttt{ga-IE} and \texttt{ga-IE-numeric} (for the Republic of %Ireland) and \texttt{ga-GB} and \texttt{ga-GB-numeric} (for Northern @@ -1577,16 +1672,36 @@ %\texttt{datetime2-irish}, \texttt{datetime2-ga-IE} and %\texttt{datetime2-ga-GB} is the time zone mappings. % -%The language modules may provide additional settings that can be +%The language or regional modules may provide additional settings that can be %applied using %\begin{definition}[\DescribeMacro\DTMlangsetup] -%\cs{DTMlangsetup}\oarg{language list}\marg{options} +%\cs{DTMlangsetup}\oarg{module-name list}\marg{options} %\end{definition} -%where \meta{language list} is a comma-separated list of language -%modules that have been loaded (such as \texttt{en-GB,en-US}) +%where \meta{module-name list} is a comma-separated list of +%modules that have previously been loaded (such as \texttt{en-GB,en-US}) %and \meta{options} is a \meta{key}=\meta{value} list of options. -%If \meta{language list} is omitted, then the list of all loaded -%language modules is assumed. The modules may also provided +% +%\begin{important} +%Note that the names in the \meta{module-name list} are +%the identifying names of the module (such as \module[english]{en-GB} or +%\module{english}) +%which aren't necessarily the same as the language name supplied +%to whatever language package you are using (such as \sty{babel} or +%\sty{polyglossia}). The code for each module should be in the file +%\texttt{datetime2-\meta{module-name}.ldf}, which should be in TeX's +%path. +%\end{important} +% +%If \meta{module-name list} is omitted, then the list of all loaded +%modules is assumed. There is also a starred version +%of this command (as from v1.3) which suppresses the warning +%if the given \meta{options} aren't available for any of +%the modules named in \meta{module-name list}. You may prefer +%to use the starred version if you omit \meta{module-name list} +%to skip the warnings from the base modules that don't support the +%given options. +% +%The modules may also provided %user commands to further customise the style. These settings should %all be described in the module's documentation, which should be %accessible via \texttt{texdoc datetime2-\meta{language}} where @@ -1619,14 +1734,58 @@ %modifications. (Don't forget to provide a README file.) % %Each language module should be in a file named -%\texttt{datetime2-\meta{lang}.ldf} where \meta{lang} is the language -%name or \meta{language ISO code}\texttt{-}\meta{country ISO code}. (See the +%\texttt{datetime2-\meta{lang}.ldf} where \meta{lang} is either the language +%name or in the form \meta{language ISO code}\texttt{-}\meta{country ISO code}. (See the %\sty{tracklang} documentation for further details of the naming %scheme.) % +%A regional module may load a base module for the same language using +%\begin{definition}[\DescribeMacro\RequireDateTimeModule] +%\cs{RequireDateTimeModule}\marg{name} +%\end{definition} +%This will input the file \texttt{datetime2-\meta{name}.ldf}. This command +%should not be used outside the \styfmt{datetime2} language module files. +%If you are creating a package that explicitly needs to load one of these files, +%then you can use: +%\begin{definition}[\DescribeMacro\DTMusemodule] +%\cs{DTMusemodule}\marg{language}\marg{name} +%\end{definition} +%where \meta{language} is the \sty{babel} or \sty{polyglossia} language or +%dialect name that identifies the relevant \cs{date\meta{language}} +%macro (for example, \texttt{english}) and \meta{name} is the same as +%above (for example, \texttt{en-GB}). +% +%Note that \cs{RequireDateTimeModule} (which is also internally used +%by \cs{DTMusemodule}) stores a mapping from the language name +%and the module name. You can determine what module was loaded +%for a given dialect name using +%\begin{definition}[\DescribeMacro\DTMdialecttomodulemap] +%\cs{DTMdialecttomodulemap}\marg{dialect} +%\end{definition} +%This expands to the required module name or \cs{relax} if the +%given dialect name wasn't used to load a module. +%For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[british]{datetime2} +% +%\begin{document} +% +%british map: \DTMdialecttomodulemap{british}. +%english map: \DTMdialecttomodulemap{english}. +% +%\end{document} +%\end{verbatim} +%This produces: +%\begin{quote} +%british map: en-GB. +%english map: . +%\end{quote} +%In the above, the second instance expands to \cs{relax}. +% %\begin{important} %If you want to provide a language module don't assume all users want -%to use the same input encoding or \sty{babel} shortcuts as you. Use \LaTeX\ +%to use the same input encoding or \sty{babel} shorthands as you. Use \LaTeX\ %commands for non-ASCII characters (and remember to use \cs{protect} %where necessary). %\end{important} @@ -1654,7 +1813,159 @@ %\end{verbatim} % %This helps provide fully expandable dates for Lua\LaTeX\ and -%\XeLaTeX\ users. (See the Scottish or Irish modules.) +%\XeLaTeX\ users. (See the Scottish or Irish modules for examples.) +% +%\chapter{Standalone Month or Weekday Names} +%\label{sec:names} +% +%\begin{important} +%If you want the month name or weekday name to appear in a section +%or chapter heading, it's best to use the expandable commands +%provided by the language modules rather than the robust commands +%provided by \styfmt{datetime2-calc}. Remember that you can't use robust +%commands in PDF bookmarks and such commands may prevent case-changing in +%headers for page styles that use \cs{MakeUppercase}. +%\end{important} +% +%The language or regional modules described in +%\sectionref{sec:lang} typically provide an expandable command +%\begin{definition} +%\cs{DTM\meta{root-language}monthname}\marg{n} +%\end{definition} +%which takes a numerical argument that indicates the month number. +%This command is used in the date style which ensures that even if +%the document language has switched but not the date style, then +%the month name will be in the correct language for that style. +%(Otherwise you could end up with a mix of style from one dialect +%using names from another language, which was one of the problems +%with the original \styfmt{datetime} package.) +% +%For example, if the \module{english} module is loaded (which is +%automatically loaded by the English dialect modules, such as +%\module[english]{en-GB}) then the command \cs{DTMenglishmonthname} is +%defined. So if you're writing in English and you want to display +%just the +%month name, then you can do: +%\begin{verbatim} +%\DTMenglishmonthname{1} +%\end{verbatim} +%Some language modules, where month names aren't automatically +%capitalised, may additionally define a version that +%has the first letter in upper case. For example, the \module{french} +%module defines \cs{DTMfrenchMonthname} in addition to +%\cs{DTMfrenchmonthname}. +% +%Some of the modules may have other alternatives. For example, +%the \module{serbian} module provides Cyrillic +%(\cs{DTMserbiancyrmonthname}) and Latin +%(\cs{DTMserbianlatinmonthname}) +%month names. It also provides \cs{DTMserbianmonthname}, which +%defaults to \cs{DTMserbiancyrmonthname} but can be redefined +%using \cs{DTMlangsetup}. +% +%To find out the available commands for the module you are using, +%see that module's documentation. +% +%If you are writing a document that uses multiple languages +%and you simply want to display the month name in the currently +%selected language, then you can use the robust command +%\begin{definition} +%\ics{DTMmonthname}\marg{n} +%\end{definition} +%provided by the \styfmt{datetime2-calc} package, +%described in \sectionref{sec:calc}. Remember that the +%\styfmt{datetime2-calc} package also loads the \sty{pgfcalendar} +%package, which provides the expandable command +%\cs{pgfcalendarmonthname}. (The \sty{pgfcalendar} package provides +%multilingual support via the \sty{translator} package.) +% +%Some of the language modules additionally provide a command +%that displays the first letter in upper case. This isn't provided +%for languages where the month name is always displayed with +%a capital first letter, such as in English. For example, +%the \module{serbian} module also defines +%\cs{DTMserbiancyrMonthname} and \cs{DTMserbianlatinMonthname}, +%with \cs{DTMserbianMonthname} initially defined to use +%the Cyrillic version. +% +%So, if you specifically want to display the Serbian Cyrillic +%month name with the first letter in upper case, you need to +%make sure the \module{serbian} module is loaded +%and then use the provided \cs{DTMserbiancyrMonthname} command. +% +%If you want the month name to vary according to the current language +%setting in the document, you can use the robust command +%\begin{definition} +%\cs{DTMMonthname}\marg{n} +%\end{definition} +%provided by \styfmt{datetime2-calc}, which will first +%attempt \cs{DTM\meta{language}Monthname} and then +%\cs{DTM\meta{language}monthname} before falling back on the +%\cs{pgfcalendarmonthname}, see \sectionref{sec:calc} for further +%details. +% +%Some, but not all, language modules provide a command (or commands) +%for month name abbreviations. It's up to the maintainer of the +%module to add these if they currently aren't provided. You will +%need to check the module documentation to find out if abbreviations +%are supported. If they are supported, they should be in +%the form +%\begin{definition} +%\cs{DTM\meta{root-language}shortmonthname}\marg{n} +%\end{definition} +%Again there may be variations, such as new and old styles or alternative +%alphabets. For example, the \module{english} module +%provides \cs{DTMenglishshortmonthname}. +% +%As with the full form, if you want to display the abbreviation +%in a specific language (or variation), then use the command +%provided by the relevant language module. If you want the +%abbreviation to pick up the current language, then you can +%use the robust command +%\begin{definition} +%\cs{DTMshortmonthname}\marg{n} +%\end{definition} +%provided by the \styfmt{datetime2-calc} package. This will fall back on +%\cs{pgfcalendarmonthshortname} if +%\cs{DTM\meta{language}shortmonthname} isn't defined. See +%\sectionref{sec:calc} for further details. +% +%Modules may additionally provide a version of the abbreviated +%form that starts with a capital letter. This should typically +%be in the form +%\begin{definition} +%\cs{DTM\meta{root-language}shortMonthname}\marg{n} +%\end{definition} +%Check the module documentation to see if this is provided. +%Again, the \styfmt{datetime2-calc} package provides a robust command +%\begin{definition} +%\cs{DTMshortMonthname}\marg{n} +%\end{definition} +%that attempts to determine the relevant +%module command from the language name. +% +%Language modules may or may not provide a command that displays +%the weekday name. As with the month name, there may or may not +%be an abbreviated version or capital first letter version +%or variations such as new\slash old styles. +%Check the module documentation for further details. If +%the module doesn't provide a weekday name macro, then the +%provided styles won't support the \pkgopt{showdow} option. +% +%\emph{If} the module provides weekday name support, then +%the name will typically be provided by a macro in the form +%\begin{definition} +%\cs{DTM\meta{root-language}weekdayname}\marg{n} +%\end{definition} +%where \meta{n} is an integer from 0 (Monday) to 6 (Sunday). +%For example, the \module{english} module provides +%\cs{DTMenglishweekdayname}. +% +%Again, the \styfmt{datetime2-calc} package provides \emph{robust} +%commands that attempt to find the relevant module-provided +%command based on the current language. If not found, +%the fallback commands are those provided by the \sty{pgfcalendar} +%package. See \sectionref{sec:calc} for further details. % %\chapter{Package Options} %\label{sec:pkgopt} @@ -1668,6 +1979,9 @@ %\item[\pkgopt{yearmonthsep}] This sets the separator between the %year and month for the big-endian and little-endian styles. %Default: \texttt{-} (hyphen). +%Note that if you want a space as a separator you need to use \cs{space}. +%If you simply use a space character (for example, \verb|yearmonthsep={ }|) +%then the separator will be discarded. The same applies for the other separators described below. % %\item[\pkgopt{monthdaysep}] This sets the separator between the %month and day. @@ -1828,18 +2142,18 @@ % %This key isn't available in \cs{DTMsetup}. Use \cs{DTMsetstyle} instead. % -%\item[\pkgopt{calc}] Load the \sty{datetime2-calc} package. This +%\item[\pkgopt{calc}] Load the \styfmt{datetime2-calc} package. This %will allow the day of week to be computed and allow you to use the %\sty{pgfcalendar} offset style date formats in commands like %\cs{DTMdate} as well as defining the commands described in %\sectionref{sec:calc}. This option doesn't take a value. It can't be switched %off. This option can't be used in \cs{DTMsetkeys}. The default is to -%not load \sty{datetime2-calc}. +%not load \styfmt{datetime2-calc}. % %\item[\pkgopt{showdow}] This is a boolean key that determines %whether or not to show the day of week in styles that support this. %Note that \pkgopt[true]{showdow} will automatically load -%\sty{datetime2-calc} so +%\styfmt{datetime2-calc} so %\begin{verbatim} %\usepackage[showdow]{datetime2} %\end{verbatim} @@ -1850,13 +2164,13 @@ % %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. +%if the \styfmt{datetime2-calc} package hasn't been loaded. %\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 +%\styfmt{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. % @@ -1886,12 +2200,12 @@ %The language modules may additionally provide options which can be %set using: %\begin{definition}[\DescribeMacro\DTMlangsetup] -%\cs{DTMlangsetup}\oarg{module list}\marg{option list} +%\cs{DTMlangsetup}\oarg{module-name list}\marg{option list} %\end{definition} % %This will set the \meta{option list} for each module listed in -%\meta{module list}. Unknown options will generate a~warning rather -%than an error message. The default value of \meta{module list} is +%\meta{module-name list}. Unknown options will generate a~warning rather +%than an error message. The default value of \meta{module-name list} is %the list of all loaded modules. % %Example: @@ -1915,6 +2229,12 @@ %\usepackage[british]{datetime2} %\DTMlangsetup[en-GB]{mapzone} %\end{verbatim} +%Alternatively you can use the starred version: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[british]{datetime2} +%\DTMlangsetup*{mapzone} +%\end{verbatim} % %Note that some modules may have options with the same name as the %above listed package options, but the keys are defined in different @@ -2013,7 +2333,7 @@ %\chapter{The \styfmt{datetime2-calc} Package} %\label{sec:calc} % -%The \sty{datetime2-calc} package can be loaded after \styfmt{datetime2} in the +%The \styfmt{datetime2-calc} package can be loaded after \styfmt{datetime2} in the %usual way: %\begin{verbatim} %\usepackage{datetime2} @@ -2030,9 +2350,9 @@ % %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 +%\styfmt{datetime2-calc} has been loaded, you can enable or disable the %weekday in dates where the style supports this, but note that \emph{not -%all styles support this}, even if the \sty{datetime2-calc} package +%all styles support this}, even if the \styfmt{datetime2-calc} package %has been loaded. % %As with the commands in \sectionref{sec:store}, the commands @@ -2045,7 +2365,7 @@ %zero, except for the day of week element, which will be set to %\texttt{-1}. % -%In addition to enabling the weekday calculations, the \sty{datetime2-calc} +%In addition to enabling the weekday calculations, the \styfmt{datetime2-calc} %package also provides the following commands: %\begin{definition}[\DescribeMacro\DTMsavejulianday] %\cs{DTMsavejulianday}\marg{name}\marg{number} @@ -2079,9 +2399,9 @@ %This is like the previous command but converts the date obtained by %incrementing the saved date with \meta{offset}. The result is stored %in \meta{register}. This is equivalent to -%\begin{display}\ttfamily +%\begin{quote}\ttfamily %\cs{pgfcalendardatetojulian}\{\meta{y}-\meta{m}-\meta{d}+\meta{offset}\}\marg{register} -%\end{display} +%\end{quote} %where \meta{y}, \meta{m} and \meta{d} are the year, month and day %fetched from the saved date. A negative \meta{offset} indicates an earlier %date. @@ -2103,7 +2423,7 @@ %\cs{pgfcalendarifdate}. Note that the %\texttt{equals}, \texttt{at least}, \texttt{at most} and %\texttt{between} keywords available in \meta{test} need to be in the -%format specified by the \sty{pgf} manual, but remember that you can +%format specified by the \styfmt{pgf} manual, but remember that you can %use commands like \cs{DTMfetchyear}. %Example: %\begin{verbatim} @@ -2147,13 +2467,7 @@ %\DTMusedate{mydate2}. %\end{verbatim} % -%The \sty{pgfcalendar} package also provides a variety of useful -%date-related commands. See the documentation (part of the \sty{pgf} -%manual) for further details. Note that the language modules don't -%use \sty{pgfcalendar} month and weekday names as the -%\sty{pgfcalendar} package isn't loaded by default. -% -%The \sty{datetime2-calc} package also provides commands that convert +%The \styfmt{datetime2-calc} package also provides commands that convert %a datetime instance into Zulu\footnote{That's Zulu as in the NATO %alphabet representation of the letter Z.}\ time (UTC+00:00). % @@ -2185,14 +2499,2957 @@ %\end{verbatim} %The above produces (using the \style{default} format): %\DTMsetstyle{default}% -% +%\begin{quote} %\DTMsavetimestamp{mydate}{2014-05-01T03:55:00 -06:00} %Original date: \DTMuse{mydate}. % %\DTMtozulu{mydate}{mydate2} %UTC+00:00: \DTMuse{mydate2}. +%\end{quote} +% +%The \sty{pgfcalendar} package also provides a variety of useful +%date-related commands. See the documentation (part of the +%\styfmt{pgf} manual) for further details. Note that the language +%modules don't use \sty{pgfcalendar} month and weekday names as the +%\sty{pgfcalendar} package isn't loaded by default and the styles +%need to match the language with the syntax. However, since the +%\styfmt{datetime2-calc} package automatically loads the +%\sty{pgfcalendar} package, as from v1.3 the \styfmt{datetime2-calc} +%provides robust month name and weekday name commands that may be +%used outside of date styles, which fallback on the commands provided +%by \sty{pgfcalendar}. +% +%\begin{important} +%The following commands, which are all robust, should not be used in date +%styles, since each language style must use the name macro for that specific +%language to match the style. Make sure you have the relevant +%language module installed and loaded to allow these commands to work +%correctly. See also \sectionref{sec:names}. Remember that instead of +%these robust commands, you can simply just use the commands provided +%by the \sty{pgfcalendar} package. (See the \styfmt{pgf} manual for +%further details.) +%\end{important} +% +%\begin{definition}[\DescribeMacro\DTMmonthname] +%\cs{DTMmonthname}\marg{n} +%\end{definition} +%This checks if \cs{DTM\meta{lang}monthname} exists where \meta{lang} +%is given by \cs{languagename}. If so, that macro is used. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[english]{babel} +%\usepackage[calc]{datetime2} +%\begin{document} +%\DTMmonthname{12} +%\end{document} +%\end{verbatim} +%Here \cs{languagename} is \texttt{english}, so this +%uses \cs{DTMenglishmonthname} which is defined by the +%\module{english} module. +% +%If the test with \cs{languagename} didn't work, \cs{DTMmonthname} +%then tries with \meta{lang} set to +%\begin{verbatim} +%\TrackedLanguageFromDialect{\languagename} +%\end{verbatim} +%(\cs{TrackedLanguageFromDialect} is provided by the \sty{tracklang} +%package.) If \cs{DTM\meta{lang}monthname} exists, then this command is used. +%For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[british]{babel} +%\usepackage[calc]{datetime2} +%\begin{document} +%\DTMmonthname{12} +%\end{document} +%\end{verbatim} +%Here \cs{languagename} is \texttt{british}, so this again uses +%\cs{DTMenglishmonthname} as the root language is obtained from the +%dialect to language mapping. % -%\StopEventually{\PrintIndex} +%\begin{important} +%Note that this won't work if you confuse \sty{tracklang} by using an +%alternative dialect name in the class option or by directly loading +%\sty{tracklang} with different dialect labels. +%\end{important} +% +%In the event that neither of those commands exist, +%\cs{DTMmonthname} will fallback on \cs{pgfcalendarmonthname} +%(provided by the \sty{pgfcalendar} package). This will also issue a +%warning. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[calc]{datetime2} +%\begin{document} +%\DTMmonthname{12} +%\end{document} +%\end{verbatim} +%This produces the warning message: +%\begin{verbatim} +%Can't find underlying language macro for +%\DTMmonthname (language: english); +%using pgfcalendar macro instead +%\end{verbatim} +%and uses \cs{pgfcalendarmonthname} instead of +%\cs{DTMenglishmonthname} (which hasn't been defined because the +%\module{english} module \emph{hasn't been loaded}). +% +%You can switch off the warning by setting the \pkgopt{warn} option +%to false or by redefining \cs{dtmnamewarning} to ignore its +%argument. +% +%\begin{definition}[\DescribeMacro\DTMMonthname] +%\cs{DTMMonthname}\marg{n} +%\end{definition} +%This checks if \cs{DTM\meta{lang}Monthname} exists. First where +%\meta{lang} is given by \cs{languagename} and then where \meta{lang} +%is given by +%\begin{verbatim} +%\TrackedLanguageFromDialect{\languagename} +%\end{verbatim} +%If neither of those values of \meta{lang} match a defined command, +%\cs{DTMMonthname} then tests for non-case-changing versions +%\cs{DTM\meta{lang}monthname}. +%This is because not all language modules provide a macro for use at the +%start of a sentence since some languages always start month names +%with a capital letter. For example, the +%\module{english} module provides \cs{DTMenglishmonthname} but +%doesn't provide an upper case alternative, since English month names +%always start with a capital. Therefore: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[english]{babel} +%\usepackage[calc]{datetime2} +%\begin{document} +%\DTMMonthname{12} +%\end{document} +%\end{verbatim} +%just uses \cs{DTMenglishmonthname}. +% +%As before, if the relevant command can't be detected for any case +%of \meta{lang} for either \cs{DTM\meta{lang}Monthname} or +%\cs{DTM\meta{lang}monthname} (for example, the required language module hasn't +%been loaded) then \cs{DTMMonthname} will use +%\cs{pgfcalendarmonthname} and attempt to convert the first letter to +%upper case. +% +%Since some \emph{but not all} language modules also provide month +%name abbreviations, the \styfmt{datetime2-calc} package also provides: +%\begin{definition}[\DescribeMacro\DTMshortmonthname] +%\cs{DTMshortmonthname}\marg{n} +%\end{definition} +%This behaves in a similar way to \cs{DTMmonthname} but tries to +%determine if \cs{DTM\meta{lang}shortmonthname} exists (where +%\meta{lang} is either \cs{languagename} or obtained from +%\cs{languagename} using \sty{tracklang}'s dialect to language +%mapping). If no command can be found, the fallback uses +%\cs{pgfcalendarmonthshortname} provided by the \sty{pgfcalendar} +%package. For example, if the language module hasn't been loaded or +%if the language module doesn't provide an abbreviated version. +% +%Similarly there is a version for the start of a sentence for +%languages that normally use lower case month names: +%\begin{definition}[\DescribeMacro\DTMshortMonthname] +%\cs{DTMshortMonthname}\marg{n} +%\end{definition} +% +%There are also analogous commands for the weekday names, where +%\meta{n} is an integer from 0 (Monday) to 6 (Sunday). +% +%\begin{definition}[\DescribeMacro\DTMweekdayname] +%\cs{DTMweekdayname}\marg{n} +%\end{definition} +%This checks if \cs{DTM\meta{lang}weekdayname} exists where +%\meta{lang} is given by \cs{languagename}. +%If it does, that macro is used. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[english]{babel} +%\usepackage[calc]{datetime2} +%\begin{document} +%\DTMweekdayname{6} +%\end{document} +%\end{verbatim} +%This uses \cs{DTMenglishweekdayname}, which is provided by the +%\module{english} module. +% +%If \cs{DTM\meta{lang}weekdayname} doesn't exist with \meta{lang} set +%to \cs{languagename}, \cs{DTMweekdayname} then tests with +%\meta{lang} set to: +%\begin{verbatim} +%\TrackedLanguageFromDialect{\languagename} +%\end{verbatim} +%If the command \cs{DTM\meta{lang}weekdayname} exists in this case, that +%command is used. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[british]{babel} +%\usepackage[calc]{datetime2} +%\begin{document} +%\DTMweekdayname{6} +%\end{document} +%\end{verbatim} +%This uses \cs{DTMenglishweekdayname} as it can determine (through +%\sty{tracklang}) that \texttt{british} has been defined as a dialect +%of \texttt{english}. +% +%If this second test fails, then \cs{DTMweekdayname} will issue a +%warning and fallback on \cs{pgfcalendarweekdayname}, provided by the +%\sty{pgfcalendar} package. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[calc]{datetime2} +%\begin{document} +%\DTMweekdayname{6} +%\end{document} +%\end{verbatim} +%This produces the warning message: +%\begin{verbatim} +%Can't find underlying language macro for +%\DTMweekdayname (language: english); +%using pgfcalendar macro instead +%\end{verbatim} +%As before, this warning is produced with \cs{dtmnamewarning}. +% +%The first letter upper case version is: +%\begin{definition}[\DescribeMacro\DTMWeekdayname] +%\cs{DTMWeekdayname}\marg{n} +%\end{definition} +%As with \cs{DTMMonthname}, if no upper case version can be found in +%the relevant language module this will use the non-case-changing +%version. The fallback \sty{pgfcalendar} macro is again +%\cs{pgfcalendarweekdayname} with an attempt to convert the first +%letter to upper case. +% +%Again, abbreviations may or may not be supported by language +%modules. If they're not supported, the fallback is +%\cs{pgfcalendarweekdayshortname}. +% +%\begin{definition}[\DescribeMacro\DTMshortweekdayname] +%\cs{DTMshortweekdayname}\marg{n} +%\end{definition} +%which will attempt to use \cs{DTM\meta{lang}shortweekdayname} and +%\begin{definition}[\DescribeMacro\DTMshortWeekdayname] +%\cs{DTMshortWeekdayname}\marg{n} +%\end{definition} +%which will attempt to use \cs{DTM\meta{lang}shortWeekdayname} or +%\cs{DTM\meta{lang}shortweekdayname}. +% +%For completeness, there's also a language-sensitive date ordinal command: +%\begin{definition}[\DescribeMacro\DTMordinal] +%\cs{DTMordinal}\marg{n} +%\end{definition} +%where \meta{n} is a number from 1 to 31. Again, this shouldn't be +%used in date styles, but only if a standalone date ordinal is required. +%For most languages, this only has a suffix for the first day of the +%month (that is where \meta{n} is 1) or the suffix may simply be a +%full stop (period). It should not be confused with \sty{fmtcount}'s +%\cs{ordinalnum} command, which is for general ordinals rather than +%date-specific ordinals. +% +%\chapter{Migrating from \styfmt{datetime}} +%\label{sec:migrate} +% +%This section is for users who want to switch over from the old +%\styfmt{datetime} package. +% +%Note that \styfmt{datetime2} is modularised for improved efficiency both in +%terms of package overheads and spreading the maintenance load. This +%means that you only need to install \styfmt{datetime2} if you only want +%the base numeric styles, but it you want multilingual or regional +%support, you need to additionally load the required language module +%or modules. +% +%For example, consider the following document that uses +%\styfmt{datetime}: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french]{babel} +%\usepackage{datetime} +%\begin{document} +%\today. +%\end{document} +%\end{verbatim} +%This just needs to have the \styfmt{datetime} package installed, which +%includes the necessary file \texttt{dt-french.def}. +% +%This example can be adjusted for \styfmt{datetime2}: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french]{babel} +%\usepackage[useregional]{datetime2} +%\begin{document} +%\today. +%\end{document} +%\end{verbatim} +%This requires both \styfmt{datetime2} and the \module{french} module, +%so you need to ensure that both have been installed. +% +%The above example also draws attention to another change from +%\styfmt{datetime} and that concerns the default package behaviour. The +%\styfmt{datetime} package defaults to a British date style, unless +%\sty{babel} has been loaded first, whereas the \styfmt{datetime2} +%package defaults to an ISO numeric style, unless language or +%regional settings are provided in the class option. As illustrated +%in the above, you need the \pkgopt{useregional} option if you want +%\cs{datefrench} (or equivalent) to switch the date style. +% +%\section{\styfmt{datetime} package options} +% +%The \styfmt{datetime} package provides the following options, which can +%be emulated with \styfmt{datetime2} or through one of its dependent +%modules or packages: +% +%\begin{description} +%\item[\pkgoptfmt{long}] This option was designed for full British +%dates, and is the default if \sty{babel} isn't loaded. Example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[long]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: +%Wednesday 20\textsuperscript{th} January, 2016. +% +%This can be achieved with \styfmt{datetime2} and the \module{english} +%module as follows: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[en-GB,showdow]{datetime2} +%\DTMlangsetup[en-GB]{ord=raise,monthyearsep={,\space}} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{short}] This option was designed for abbreviated +%British dates. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[short]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: +%Wed 20\textsuperscript{th} Jan, 2016 +% +%This can be achieved with \styfmt{datetime2} and the \module{english} +%module as follows: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[en-GB,showdow]{datetime2} +%\DTMlangsetup[en-GB]{abbr,ord=raise,monthyearsep={,\space}} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{iso}] This option was designed for +%\meta{YYYY}-\meta{MM}-\meta{DD} dates. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[iso]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: 2016-01-20. This is default for +%\styfmt{datetime2}: +%\begin{verbatim} +%\documentclass{article} +%\usepackage{datetime2} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%If you don't want the style to depend on the separator settings, you +%can use the \style{iso} style: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[style=iso]{datetime2} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{yyyymmdd}] This option was designed for +%\meta{YYYY}\slash\meta{MM}\slash\meta{DD} dates. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[yyyymmdd]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: 2016/01/20. This is very nearly +%in the same form as the default \styfmt{datetime2} style. All that +%needs changing are the separators between the year, month and day: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[datesep=/]{datetime2} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{ddmmyyyy}] This option was designed for +%\meta{DD}\slash\meta{MM}\slash\meta{YYYY} dates. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[ddmmyyyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: 20/01/2016. This can be changed +%to \styfmt{datetime2} with a couple of package options: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[datesep=/,style=ddmmyyyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{dmyyyy}] This option was designed for +%\meta{D}\slash\meta{M}\slash\meta{YYYY} dates. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[ddmmyyyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: 20/1/2016. This can be changed +%to \styfmt{datetime2} with a couple of package options: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[datesep=/,style=dmyyyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{ddmmyy}] This option was designed for +%\meta{DD}\slash\meta{MM}\slash\meta{YY} dates. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[ddmmyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: 20/01/16. This can be changed +%to \styfmt{datetime2} with a couple of package options: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[datesep=/,style=ddmmyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{dmyy}] This option was designed for +%\meta{D}\slash\meta{M}\slash\meta{YY} dates. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[dmyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: 20/1/16. This can be changed +%to \styfmt{datetime2} with a couple of package options: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[datesep=/,style=dmyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{text}] This option was designed for a full UK textual +%date. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[text]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: +%Wednesday the Twentieth of January, Two Thousand and Sixteen +% +%This document can be changed to \styfmt{datetime2} through the +%\sty{datetime2-en-fulltext} package, which needs to be installed +%separately: +%\begin{verbatim} +%\documentclass{article} +%\usepackage{datetime2-en-fulltext} +%\DTMsetdatestyle{en-FullText} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{us}] This option was designed for the standard US +%date. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[us]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: +%January 20, 2016 +% +%This can be achieved with \styfmt{datetime2} and the \module{english} +%module as follows: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[en-US]{datetime2} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{mmddyyyy}] This option was designed for +%\meta{MM}\slash\meta{DD}\slash\meta{YYYY} dates. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[mmddyyyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: 01/20/2016. This can be changed +%to \styfmt{datetime2} with a couple of package options: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[datesep=/,style=mmddyyyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{mdyyyy}] This option was designed for +%\meta{M}\slash\meta{D}\slash\meta{YYYY} dates. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[mmddyyyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: 1/20/2016. This can be changed +%to \styfmt{datetime2} with a couple of package options: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[datesep=/,style=mdyyyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{mmddyy}] This option was designed for +%\meta{MM}\slash\meta{DD}\slash\meta{YY} dates. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[mmddyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: 01/20/16. This can be changed +%to \styfmt{datetime2} with a couple of package options: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[datesep=/,style=mmddyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{mdyy}] This option was designed for +%\meta{M}\slash\meta{D}\slash\meta{YY} dates. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[mdyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: 1/20/16. This can be changed +%to \styfmt{datetime2} with a couple of package options: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[datesep=/,style=mdyy]{datetime} +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{raise}] This option was designed to make the ordinal +%st,nd,rd,th appear as a subscript. It was originally just intended for British +%dates. This is one of the default settings for \styfmt{datetime}. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[raise]{datetime} +% +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: +%Wednesday 20\textsuperscript{th} January, 2016 +% +%With \styfmt{datetime2}, this setting \emph{may} be provided by a language +%module, where appropriate. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[en-GB,showdow]{datetime2} +%\DTMlangsetup[en-GB]{ord=raise} +% +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{level}] This option was designed to make the ordinal +%st,nd,rd,th appear level with the rest of the text (to counteract +%the previous option). For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[level]{datetime} +% +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: Wednesday 20th January, 2016 +% +%With \styfmt{datetime2} this setting may be provided by a language +%module, where appropriate. This is, in fact, the default setting for +%the \style{en-GB} style: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[en-GB,showdow]{datetime2} +% +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%but can be explicitly set using: +%\begin{verbatim} +%\DTMlangsetup[en-GB]{ord=level} +%\end{verbatim} +% +%\item[\pkgoptfmt{dayofweek}] This option was designed to show the +%weekday name for those styles that supported it. This is one of the +%default \styfmt{datetime} settings. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[dayofweek]{datetime} +% +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: +%Wednesday 20\textsuperscript{th} January, 2016 +% +%With \styfmt{datetime2} this setting \emph{may} be provided by a language +%module, where supported. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[en-GB,showdow]{datetime2} +% +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%Some language modules don't support this option (just as some +%language settings with \styfmt{datetime} also don't support the +%\pkgoptfmt{dayofweek} option.) +% +%\item[\pkgoptfmt{nodayofweek}] This option was designed to hide the +%weekday name for those styles that supported it (to counteract the +%previous option). For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[nodayofweek]{datetime} +% +%\begin{document} +%\today +%\end{document} +%\end{verbatim} +%This produces the date in the form: +%20\textsuperscript{th} January, 2016 +% +%This setting is the default for \styfmt{datetime2}. +%However, if it \pkgopt{showdow} has been switched on, it can later +%be switched off using +%\begin{verbatim} +%\DTMsetup{showdow=false} +%\end{verbatim} +% +%\item[\pkgoptfmt{hhmmss}] This option was designed for time formats in +%the style \meta{HH}:\meta{MM}:\meta{SS}. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[hhmmss]{datetime} +% +%\begin{document} +%\currenttime +%\end{document} +%\end{verbatim} +%This produces the time in the form: 17:28:52. +% +%This is the default for \styfmt{datetime2}: +%\begin{verbatim} +%\documentclass{article} +%\usepackage{datetime2} +% +%\begin{document} +%\DTMcurrenttime +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{24hr}] This option was designed for 24 hour time formats in +%the style \meta{HH}:\meta{MM}. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[24hr]{datetime} +% +%\begin{document} +%\currenttime +%\end{document} +%\end{verbatim} +%This produces the time in the form: 17:28. +% +%This can be achieved using the default \styfmt{datetime2} time style +%with the seconds suppressed: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[showseconds=false]{datetime2} +% +%\begin{document} +%\DTMcurrenttime +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{12hr}] This option was designed for 12 hour time +%formats with \qt{am} or \qt{pm} suffixes. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[12hr]{datetime} +% +%\begin{document} +%\currenttime +%\end{document} +%\end{verbatim} +%This produces the time in the form: 5:28pm. +% +%This can be achieved through a \styfmt{datetime2} language module that +%supports this format. For example, the \module{english} module: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[en-GB]{datetime2} +% +%\begin{document} +%\DTMcurrenttime +%\end{document} +%\end{verbatim} +% +%\item[\pkgoptfmt{oclock}] This option was designed for a UK-style full text +%time. For example: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[oclock]{datetime} +% +%\begin{document} +%\currenttime +%\end{document} +%\end{verbatim} +%This produces the time in the form: +%Twenty minutes past Six in the afternoon +% +%This can be changed to \styfmt{datetime2} through the +%\sty{datetime2-en-fulltext} package, which needs to be installed +%separately: +%\begin{verbatim} +%\documentclass{article} +%\usepackage{datetime2-en-fulltext} +%\DTMsettimestyle{en-FullText} +%\begin{document} +%\DTMcurrenttime +%\end{document} +%\end{verbatim} +% +%\end{description} +% +%The \styfmt{datetime} package option \pkgoptfmt{nodate} was provided +%before multilingual support was added to allow \sty{babel} users to +%use the time commands without causing a conflict with the date. Once +%support for the \sty{babel} package was added, this option became +%superfluous. +% +%\section{Time and Date Commands} +% +%\begin{definition} +%\ics{today} +%\end{definition} +%This is a robust command in later versions of \styfmt{datetime}. In +%earlier versions is was fragile and had to be protected when used in +%moving arguments. With \styfmt{datetime2}, this command is designed to +%be expandable and so therefore is not robust and shouldn't need +%protecting. (The date styles should take care of any fragile +%commands, such as \cs{textsuperscript}, where necessary.) +% +%The current time is displayed with \styfmt{datetime} using +%\begin{definition}[\inpkg{datetime}] +%\oldcs{currenttime} +%\end{definition} +%The \styfmt{datetime2} equivalent is: +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMcurrenttime} +%\end{definition} +%Again, the command provided by \styfmt{datetime} is robust and the +%equivalent command provided by \styfmt{datetime2} is designed to be +%expandable. +% +%A specific date is display by \styfmt{datetime}'s +%\begin{definition}[\inpkg{datetime}] +%\oldcs{formatdate}\marg{DD}\marg{MM}\marg{YYYY} +%\end{definition} +%command. The arguments are in little-endian (UK) order with the day, +%month and year. With \styfmt{datetime2} you can use either: +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMdisplay}\marg{YYYY}\marg{MM}\marg{DD}\marg{dow} +%\end{definition} +%(expandable) or +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMdate}\{\meta{YYYY}-\meta{MM}-\meta{DD}\} +%\end{definition} +%(robust) where \meta{YYYY} is the year, \meta{MM} is the month +%number, \meta{DD} is the day of month number and \meta{dow} is the +%day of week number (starting from 0 for Monday) or \texttt{-1} to +%disregard it. +% +%A specific time is displayed by \styfmt{datetime}'s +%\begin{definition}[\inpkg{datetime}] +%\oldcs{formattime}\marg{hh}\marg{mm}\marg{ss} +%\end{definition} +%command, which has three arguments: the hour (24) the minutes past +%the hour and the seconds past the minute. With \styfmt{datetime2} you +%can use either: +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMdisplaytime}\marg{hh}\marg{mm}\marg{ss} +%\end{definition} +%(expandable) or +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMtime}\{\meta{hh}:\meta{mm}:\meta{ss}\} +%\end{definition} +%(robust) where \meta{hh} is the hour, \meta{mm} is the minutes and +%\meta{ss} is the seconds. +% +%The date separator used by the predefined \styfmt{datetime} styles is +%given by +%\begin{definition}[\inpkg{datetime}] +%\oldcs{dateseparator} +%\end{definition} +%which needs to be redefined if +%required. With \styfmt{datetime2}, the date separator for the base +%numeric styles (except the fixed \style{iso} style) can be changed +%through the \pkgopt{datesep} package option. For example: +%\begin{verbatim} +%\usepackage[datesep={.}]{datetime2} +%\end{verbatim} +%or +%\begin{verbatim} +%\DTMsetup{datesep={.}} +%\end{verbatim} +%Some of the language modules may also provide a similar option. For +%example: +%\begin{verbatim} +%\usepackage[en-GB]{datetime2} +%\DTMlangsetup[en-GB]{datesep={.}} +%\end{verbatim} +% +%The time separator for \styfmt{datetime} is given by +%\begin{definition}[\inpkg{datetime}] +%\oldcs{timeseparator} +%\end{definition} +%With \styfmt{datetime2}, the time separator for the +%basic numeric styles (not including the fixed \style{iso} style) can be +%changed through the \pkgopt{timesep} package option. For example: +%\begin{verbatim} +%\usepackage[timesep={.}]{datetime2} +%\end{verbatim} +%or +%\begin{verbatim} +%\usepackage{datetime2} +%\DTMsetup{timesep={.}} +%\end{verbatim} +%Some of the language modules may also provide a similar option. For +%example: +%\begin{verbatim} +%\usepackage[en-GB]{datetime2} +%\DTMlangsetup[en-GB]{timesep={.}} +%\end{verbatim} +% +%\begin{definition}[\inpkg{datetime}] +%\oldcs{pdfdate} +%\end{definition} +%The \cs{pdfdate} command provided by \styfmt{datetime} for use within +%\ics{pdfinfo} became redundant with the introduction of +%\ics{pdfcreationdate} to PDF\TeX\ version 1.30.0. +% +%Old style (using \styfmt{datetime}): +%\begin{verbatim} +%\pdfinfo{ +% /Author (Me) +% /Title (A Sample Document) +% /CreationDate (D:20040501215500) +% /ModDate (D:\pdfdate) +%} +%\end{verbatim} +%New style (simply using PDF\TeX): +%\begin{verbatim} +%\pdfinfo{ +% /Author (Me) +% /Title (A Sample Document) +% /CreationDate (D:20040501215500) +% /ModDate (\pdfcreationdate) +%} +%\end{verbatim} +%Alternatively you can use the \style{pdf} style: +%\begin{verbatim} +%\DTMsetstyle{pdf} +%\pdfinfo{ +% /Author (Me) +% /Title (A Sample Document) +% /CreationDate (\DTMdisplay{2004}{05}{01}{-1}{21}{55}{00}{00}{00}) +% /ModDate (\DTMnow) +%} +%\end{verbatim} +% +%The \styfmt{datetime} command to display the month name is +%\begin{definition}[\inpkg{datetime}] +%\oldcs{monthname}\oarg{n} +%\end{definition} +%which can't be expanded. With +%\styfmt{datetime2}, the month name for a specific language can be +%obtained from a command provided by the relevant module. For +%example, the \module{english} module provides +%\begin{definition}[\inpkg{datetime2-english}] +%\ics{DTMenglishmonthname}\marg{n} +%\end{definition} +%which is expandable. These types of commands are designed for use +%within language-dependent date styles. This ensures that the name +%matches the style. (One of the failings of \styfmt{datetime} was that +%the original date styles provided when the package was originally +%only intended for British dates produced weird hybrid styles when +%multilingual support was later added and styles such as \pkgoptfmt{long} +%were used with another language.) These types of commands provided +%by the \styfmt{datetime2} language modules are analogous to the +%\cs{monthname\meta{language}} commands provided by \styfmt{datetime}'s +%supporting language files (for example, +%\begin{definition}[\inpkg{datetime-defaults}] +%\oldcs{monthnameenglish}\oarg{n} +%\end{definition} +%in \styfmt{datetime-defaults} or +%\begin{definition}[\inpkg{dt-french.def}] +%\oldcs{monthnamefrench}\oarg{n} +%\end{definition} +%defined in \styfmt{dt-french.def}) except that the \styfmt{datetime} commands have +%an optional argument which means they're not expandable. +% +%If you load the \styfmt{datetime2-calc} package, +%either explicitly or through the \pkgopt{calc} or \pkgopt{showdow} +%\styfmt{datetime2} package options, then \sty{pgfcalendar} will also be +%loaded. In which case you can use +%\begin{definition}[\inpkg{pgfcalendar}] +%\ics{pgfcalendarmonthname}\marg{n} +%\end{definition} +%even if none of the \styfmt{datetime2} language modules have been +%loaded. This command requires the \sty{translator} package to +%provide multilingual support. See the \styfmt{pgf} manual for further +%details. +% +%Another possibility if you want the month name alone using the +%current language is to use the robust command +%\begin{definition}[\inpkg{datetime2-calc}] +%\ics{DTMmonthname}\marg{n} +%\end{definition} +%defined by \styfmt{datetime2-calc}. This is the closest match to +%\styfmt{datetime}'s \oldcs{monthname} command but note that the argument +%isn't optional. Remember that you can use \ics{month} for the current +%month number, which is the value of \meta{n} when omitted in +%\oldcs{monthname}. +% +%Old style (\styfmt{datetime}): +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,english]{babel} +% +%\usepackage{datetime} +% +%\begin{document} +%\selectlanguage{french} +%\monthname +% +%\selectlanguage{english} +%\monthname +%\end{document} +%\end{verbatim} +%New style (\styfmt{datetime2} with the \module{french} and +%\module{english} modules): +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,english]{babel} +% +%\usepackage[calc]{datetime2} +% +%\begin{document} +%\selectlanguage{french} +%\DTMmonthname{\month} +% +%\selectlanguage{english} +%\DTMmonthname{\month} +%\end{document} +%\end{verbatim} +% +%The abbreviated month name is given by +%\begin{definition}[\inpkg{datetime}] +%\oldcs{shortmonthname}\oarg{n} +%\end{definition} +%in +%\styfmt{datetime}. Similar to above, language modules may provide an +%expandable command to produce the abbreviated name in that specific +%language. For example, the \module{english} module provides +%\begin{definition}[\inpkg{datetime2-english}] +%\ics{DTMenglishshortmonthname}\marg{n} +%\end{definition} +%As with \cs{DTMenglishmonthname}, this is designed for use in +%English date styles. +% +%Again, if \styfmt{datetime2-calc} is loaded, the \sty{pgfcalendar} +%command is also available: +%\begin{definition}[\inpkg{pgfcalendar}] +%\ics{pgfcalendarmonthshortname}\marg{n} +%\end{definition} +%Alternative you can use the robust command defined by +%\styfmt{datetime2-calc}: +%\begin{definition}[\inpkg{datetime2-calc}] +%\ics{DTMshortmonthname}\marg{n} +%\end{definition} +% +%Old style (\styfmt{datetime}): +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,english]{babel} +% +%\usepackage{datetime} +% +%\begin{document} +%\selectlanguage{french} +%\shortmonthname +% +%\selectlanguage{english} +%\shortmonthname +%\end{document} +%\end{verbatim} +%New style (\styfmt{datetime2} with the \module{french} and +%\module{english} modules): +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,english]{babel} +% +%\usepackage[calc]{datetime2} +% +%\begin{document} +%\selectlanguage{french} +%\DTMshortmonthname{\month} +% +%\selectlanguage{english} +%\DTMshortmonthname{\month} +%\end{document} +%\end{verbatim} +% +%See \sectionref{sec:calc} and \sectionref{sec:names} for further +%details. +% +%The weekday names in \styfmt{datetime} are more complicated +%and not all the \texttt{dt-\meta{lang}.def} files provide translations. The ones +%that do support the weekday provide +%\begin{definition}[\inpkg{dt-\meta{lang}.def}] +%\oldcs{dayofweeknameid\meta{lang}}\marg{n} +%\end{definition} +%which takes a single argument that's an integer from 1 (Sunday) to 7 (Saturday). +%For example, +%\begin{definition}[\inpkg{datetime-defaults}] +%\oldcs{dayofweeknameidenglish}\marg{n} +%\end{definition} +%or +%\begin{definition}[\inpkg{dt-french.def}] +%\oldcs{dayofweeknameidfrench}\marg{n} +%\end{definition} +% +%The \styfmt{datetime2} language modules that support the weekday name +%provide +%\begin{definition}[\inpkg{datetime2-\meta{lang}}] +%\cs{DTM\meta{lang}weekdayname}\marg{dow} +%\end{definition} +%which takes a single argument that's an integer from 0 (Monday) to 6 +%(Sunday). As with \styfmt{datetime}, not all of the \styfmt{datetime2} +%language modules support the weekday. +% +%Old style (\styfmt{datetime}): +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,english]{babel} +%\usepackage{datetime} +% +%\begin{document} +%\dayofweeknameidfrench{1} +% +%\dayofweeknameidenglish{1} +%\end{document} +%\end{verbatim} +%New style (\styfmt{datetime2} with the \module{english} and +%\module{french} modules): +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,english]{babel} +%\usepackage{datetime2} +% +%\begin{document} +%\DTMfrenchweekdayname{6} +% +%\DTMenglishweekdayname{6} +%\end{document} +%\end{verbatim} +% +%As with the month name, date styles should explicitly use the +%weekday macro (if provided) for the specific language to display +%the weekday name rather than using a macro that varies according to +%the current language. +% +%The \styfmt{datetime} package provides +%\begin{definition}[\inpkg{datetime}] +%\oldcs{dayofweeknameid}\marg{n} +%\end{definition} +%to provide the weekday name for the current language. If the current language +%doesn't provide a translation for the weekday names, then the +%English names are used. This command basically attempts to use +%\cs{dayofweeknameid\meta{lang}} (where \meta{lang} is given +%by \cs{languagename}) if it exists otherwise it uses +%\oldcs{dayofweeknameidenglish}. This language-sensitive macro is a fragile +%command that requires protection in moving arguments. +% +%As before, if the \styfmt{datetime2-calc} package is loaded, the +%\sty{pgfcalendar} package's commands are also available including +%\begin{definition}[\inpkg{pgfcalendar}] +%\ics{pgfcalendarweekdayname}\marg{dow} +%\end{definition} +%where the argument \meta{dow} is an integer from 0 (Monday) to 6 +%(Sunday). Multilingual support is provided through the +%\sty{translator} package. +% +%The \styfmt{datetime2-calc} package also provides a robust +%language-sensitive command: +%\begin{definition}[\inpkg{datetime2-calc}] +%\ics{DTMweekdayname}\marg{dow} +%\end{definition} +%This attempts to use \cs{DTM\meta{lang}weekdayname} if it exists, +%where \meta{lang} is either \cs{languagename} or obtained from the +%dialect-to-language mapping provided by \sty{tracklang}. If both +%attempts fail, \cs{DTMweekdayname} will fallback on +%\cs{pgfcalendarweekdayname} (with a warning through +%\ics{dtmnamewarning}). +% +%Old style (\styfmt{datetime}): +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,english]{babel} +% +%\usepackage{datetime} +% +%\begin{document} +% +%\selectlanguage{french} +%\dayofweeknameid{1} +% +%\selectlanguage{english} +%\dayofweeknameid{1} +%\end{document} +%\end{verbatim} +%New style (\styfmt{datetime2} with the \module{english} and +%\module{french} modules): +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,english]{babel} +% +%\usepackage[calc]{datetime2} +% +%\begin{document} +% +%\selectlanguage{french} +%\DTMweekdayname{6} +% +%\selectlanguage{english} +%\DTMweekdayname{6} +%\end{document} +%\end{verbatim} +% +%The \styfmt{datetime} package also provides the command +%\begin{definition}[\inpkg{datetime}] +%\oldcs{dayofweekname}\marg{DD}\marg{MM}\marg{YYYY} +%\end{definition} +%that has three arguments: the day of the month, +%the month number and the year. This calculates the day of week +%index \meta{n}, an integer from 1 (Sunday) to 7 (Saturday), and then uses the +%result in the argument of \oldcs{dayofweeknameid}\marg{n}. The +%\cs{dayofweekname} command was provided by \styfmt{datetime} as a +%convenient shortcut for use in date styles. (Similarly for +%\oldcs{shortdayofweekname}.) With the \styfmt{datetime2} date styles, the +%day-of-week index is automatically available through the fourth +%argument of \ics{DTMdisplaydate} (and \ics{DTMDisplaydate}), so there +%is little use for an equivalent command. Additionally, if a date has +%already been saved with \styfmt{datetime2}, the weekday can be +%extracted from the saved data through \ics{DTMfetchdow}, which can be +%used in the argument of commands like \ics{DTMweekdayname} or +%\ics{DTMenglishweekdayname}. +% +%However, if a calculation is required for some reason, it can be +%obtained using the \sty{pgfcalendar} commands +%\ics{pgfcalendardatetojulian} and \ics{pgfcalendarjuliantoweekday}, +%which are described in the \styfmt{pgf} manual. +% +%The \styfmt{datetime} package provides the conditional +%\begin{definition}[\inpkg{datetime}] +%\oldcs{ifshowdow} +%\end{definition} +%which can be used to determine whether or not styles should display +%the weekday name (if supported). The \styfmt{datetime2} package has the +%analogous conditional +%\begin{definition}[\inpkg{datetime2}] +%\ics{ifDTMshowdow} +%\end{definition} +% +%The \styfmt{datetime} package provides the command +%\begin{definition}[\inpkg{datetime}] +%\oldcs{ordinaldate}\marg{n} +%\end{definition} +%as a date-type ordinal where the argument should be an integer from 1 +%to 31. For English, this just uses \sty{fmtcount}'s +%non-expandable \cs{ordinalnum} command. For Breton, Welsh and French +%a suffix is only added when the argument is 1. For all other +%languages, this command just displays the number. +% +%With \styfmt{datetime2}, the language modules may or may not provide a +%command to display the ordinal but most of them do. For example, the +%\module{english} module provides +%\begin{definition}[\inpkg{datetime2-english}] +%\ics{DTMenglishordinal}\marg{n} +%\end{definition} +%This displays the suffix using +%\begin{definition}[\inpkg{datetime2-english}] +%\ics{DTMenglishfmtordsuffix}\marg{suffix} +%\end{definition} +%The definition of this command is changed by the styles provided by +%the English regional modules. For example, the \style{en-US} style +%redefines \cs{DTMenglishfmtordsuffix} to ignore its argument. +%See the documentation for the \module{english} module for further +%details. +% +%The \module{french} module provides: +%\begin{definition}[\inpkg{datetime2-french}] +%\ics{DTMfrenchordinal}\marg{n} +%\end{definition} +%This displays \meta{n} and if \meta{n} is 1, a suffix is appended. +%See the \module{french} module documentation for further details. +% +%The \module{breton} module provides: +%\begin{definition}[\inpkg{datetime2-breton}] +%\ics{DTMbretonordinal}\marg{n} +%\end{definition} +%which similarly appends a suffix if \meta{n} is 1 but not for other +%values. In this case, the suffix for the first day is formatted using +%\begin{definition}[\inpkg{datetime2-breton}] +%\ics{DTMbretonfmtordinal}\marg{suffix} +%\end{definition} +%which is redefined by the \csopt{DTMlangsetup}{ord} option. +%See the \module{breton} module documentation for further details. +% +%The \module{welsh} module similarly provides: +%\begin{definition}[\inpkg{datetime2-welsh}] +%\ics{DTMwelshordinal}\marg{n} +%\end{definition} +%and +%\begin{definition}[\inpkg{datetime2-welsh}] +%\ics{DTMwelshfmtordinal}\marg{suffix} +%\end{definition} +%See the \module{welsh} module documentation for further details. +% +%Other modules may simply define \cs{DTM\meta{lang}ordinal} to just +%display its argument. For example, the \module{german} module +%provides +%\begin{definition}[\inpkg{datetime2-german}] +%\ics{DTMgermanordinal}\marg{n} +%\end{definition} +%which just displays \meta{n} (the day of month number). +% +%Alternatively, modules may define \cs{DTM\meta{lang}ordinal} to +%display its argument followed by a full stop (period). For example, +%the \module{norsk} module provides +%\begin{definition}[\inpkg{datetime2-norsk}] +%\ics{DTMnorskordinal}\marg{n} +%\end{definition} +%which displays \meta{n} followed by a full stop. +% +%As before, the date styles should explicitly use the ordinal macro +%that matches the style. However, if you have some need to display +%the day of month independent of any of the styles, you can use +%\begin{definition}[\inpkg{datetime2-calc}] +%\ics{DTMordinal}\marg{n} +%\end{definition} +%which is provided by \styfmt{datetime2-calc}. This attempts to use +%\cs{DTM\meta{lang}ordinal} if it exists, otherwise it just displays +%\meta{n}. +% +%Old style (\styfmt{datetime}): +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,english]{babel} +% +%\usepackage{datetime} +% +%\begin{document} +% +%\selectlanguage{french} +%\ordinaldate{1} +% +%\selectlanguage{english} +%\ordinaldate{1} +%\end{document} +%\end{verbatim} +%This displays 1\textsuperscript{er} in the first case (through +%\cs{ordinaldatefrench}) and +%1\textsuperscript{st} in the second case (through \sty{fmtcount}'s +%\cs{ordinalnum}). +% +%New style (\styfmt{datetime2} with the \module{english} and +%\module{french} modules): +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,english]{babel} +% +%\usepackage[calc]{datetime2} +% +%\begin{document} +% +%\selectlanguage{french} +%\DTMordinal{1} +% +%\selectlanguage{english} +%\DTMordinal{1} +%\end{document} +%\end{verbatim} +%This displays 1\textsuperscript{er} in the first case and +%just 1 in the second case, because the regionless \module{english} +%module doesn't use a suffix. +% +%To achieve the same result as the \styfmt{datetime} example, a few +%modifications are needed: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,british]{babel} +% +%\usepackage[calc,useregional]{datetime2} +%\DTMlangsetup[en-GB]{ord=raise} +% +%\begin{document} +% +%\selectlanguage{french} +%\DTMordinal{1} +% +%\selectlanguage{british} +%\DTMordinal{1} +%\end{document} +%\end{verbatim} +% +%The \styfmt{datetime} package provides the command +%\begin{definition}[\inpkg{datetime}] +%\oldcs{twodigit}\marg{n} +%\end{definition} +%for use in date styles that require two-digit +%numbers. The \styfmt{datetime2} package provides +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMtwodigits}\marg{n} +%\end{definition} +% +%\section{Saving Dates} +% +%The \styfmt{datetime} package provides some commands for saving a date +%for later use. (There are no equivalent commands for saving a time +%in \styfmt{datetime}.) +%With \styfmt{datetime}, a date is saved using +%\begin{definition}[\inpkg{datetime}] +%\oldcs{newdate}\marg{name}\marg{DD}\marg{MM}\marg{YYYY} +%\end{definition} +%With \styfmt{datetime2}, a date can be saved using +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMsavedate}\marg{name}\marg{date} +%\end{definition} +%where \meta{date} is in the form +%\texttt{\meta{YYYY}-\meta{MM}-\meta{DD}}. +% +%A previously saved date can be displayed with \styfmt{datetime} using: +%\begin{definition}[\inpkg{datetime}] +%\oldcs{displaydate}\marg{name} +%\end{definition} +%With \styfmt{datetime2}, the saved date can be displayed using: +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMusedate}\marg{name} +%\end{definition} +% +%Old style (\styfmt{datetime}): +%\begin{verbatim} +%\documentclass{article} +%\usepackage{datetime} +% +%\begin{document} +% +%\newdate{mydate}{20}{1}{2016} +%\displaydate{mydate} +% +%\end{document} +%\end{verbatim} +%New style (\styfmt{datetime2}): +%\begin{verbatim} +%\documentclass{article} +%\usepackage[en-GB,showdow]{datetime2} +% +%\begin{document} +% +%\DTMsavedate{mydate}{2016-01-20} +%\DTMusedate{mydate} +% +%\end{document} +%\end{verbatim} +% +%Individual elements of the date can be extracted with the +%\styfmt{datetime} commands: +%\begin{definition}[\inpkg{datetime}] +%\oldcs{getdateday}\marg{name} +%\end{definition} +%for the day of the month, +%\begin{definition}[\inpkg{datetime}] +%\oldcs{getdatemonth}\marg{name} +%\end{definition} +%for the month number, and +%\begin{definition}[\inpkg{datetime}] +%\oldcs{getdateyear}\marg{name} +%\end{definition} +%for the year. +% +%These elements can be fetched in \styfmt{datetime2} using: +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMfetchday}\marg{name} +%\end{definition} +%for the day of the month, +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMfetchmonth}\marg{name} +%\end{definition} +%for the month number, and +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMfetchyear}\marg{name} +%\end{definition} +%for the year. Additionally you can fetch the day of week index if it +%has been computed: +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMfetchdow}\marg{name} +%\end{definition} +% +%Old style (\styfmt{datetime}): +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{datetime} +% +%\begin{document} +% +%\newdate{mydate}{20}{1}{2016} +% +%Year: \getdateyear{mydate}. +%Month: \getdatemonth{mydate}. +%Day: \getdateday{mydate}. +% +%\end{document} +%\end{verbatim} +%New style (\styfmt{datetime2}): +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{datetime2} +% +%\begin{document} +% +%\DTMsavedate{mydate}{2016-01-20} +% +%Year: \DTMfetchyear{mydate}. +%Month: \DTMfetchmonth{mydate}. +%Day: \DTMfetchday{mydate}. +% +%\end{document} +%\end{verbatim} +% +%With \styfmt{datetime2}, you can also save the current time (as in the +%time of the document build) with +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMsavenow}\marg{name} +%\end{definition} +%and then access each field of the date, time and zone. +% +%Old style (\styfmt{datetime}): +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{datetime} +% +%\begin{document} +% +%Year: \number\year. +%Month: \number\month. +%Day: \number\day. +%DOW: \computedayofweek{\day}{\month}{\year}\number\dayofweek. +% +%Hour: \number\currenthour. +%Minute: \number\currentminute. +%Second: \number\currentsecond. +% +%\end{document} +%\end{verbatim} +%New style (\styfmt{datetime2}): +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage[calc]{datetime2} +% +%\begin{document} +%\DTMsavenow{now} +% +%Year: \DTMfetchyear{now}. +%Month: \DTMfetchmonth{now}. +%Day: \DTMfetchday{now}. +%DOW: \DTMfetchdow{now}. +% +%Hour: \DTMfetchhour{now}. +%Minute: \DTMfetchminute{now}. +%Second: \DTMfetchsecond{now}. +% +%Time Zone Hour: \DTMfetchTZhour{now}. +%Time Zone Minute: \DTMfetchTZminute{now}. +% +%\end{document} +%\end{verbatim} +%(Note that the day of week index is different as \styfmt{datetime2} +%uses the same indexing system as \sty{pgfcalendar}.) +% +%\section{Multilingual Support} +% +%The \styfmt{datetime} package comes with the following files (in +%addition to \texttt{datetime.sty} and +%\texttt{datetime-defaults.sty}): +% +%\begin{center} +%\begin{tabular}{llll} +%\texttt{dt-american.def} & \texttt{dt-dutch.def} & \texttt{dt-lsorbian.def} & \texttt{dt-slovak.def}\\ +%\texttt{dt-australian.def} & \texttt{dt-esperanto.def} & \texttt{dt-magyar.def} & \texttt{dt-slovene.def}\\ +%\texttt{dt-austrian.def} & \texttt{dt-estonian.def} & \texttt{dt-naustrian.def} & \texttt{dt-spanish.def}\\ +%\texttt{dt-bahasa.def} & \texttt{dt-finnish.def} & \texttt{dt-newzealand.def} & \texttt{dt-swedish.def}\\ +%\texttt{dt-basque.def} & \texttt{dt-french.def} & \texttt{dt-ngerman.def} & \texttt{dt-turkish.def}\\ +%\texttt{dt-breton.def} & \texttt{dt-galician.def} & \texttt{dt-norsk.def} & \texttt{dt-UKenglish.def}\\ +%\texttt{dt-british.def} & \texttt{dt-german.def} & \texttt{dt-polish.def} & \texttt{dt-ukraineb.def}\\ +%\texttt{dt-bulgarian.def} & \texttt{dt-greek.def} & \texttt{dt-portuges.def} & \texttt{dt-USenglish.def}\\ +%\texttt{dt-canadian.def} & \texttt{dt-hebrew.def} & \texttt{dt-romanian.def} & \texttt{dt-usorbian.def}\\ +%\texttt{dt-catalan.def} & \texttt{dt-icelandic.def} & \texttt{dt-russian.def} & \texttt{dt-welsh.def}\\ +%\texttt{dt-croatian.def} & \texttt{dt-irish.def} & \texttt{dt-samin.def}\\ +%\texttt{dt-czech.def} & \texttt{dt-italian.def} & \texttt{dt-scottish.def}\\ +%\texttt{dt-danish.def} & \texttt{dt-latin.def} & \texttt{dt-serbian.def} +%\end{tabular} +%\end{center} +% +%These \texttt{dt-\meta{lang}.def} files provide the code to integrate +%\styfmt{datetime} with \sty{babel} for each language given by \meta{lang}. +%This means that if you have \styfmt{datetime} installed and there's a +%\texttt{.def} file that matches the language you are using with +%\sty{babel}, then all you need to do is load \sty{babel} before +%\styfmt{datetime}. +% +%With \styfmt{datetime2}, language support is provided in separate +%independently-maintained modules. The actual \styfmt{datetime2} package +%itself just comes with two files: \texttt{datetime2.sty} and +%\texttt{datetime2-calc.sty}. This means that if you only want to use +%the basic numeric styles and aren't using \sty{babel} or +%\sty{polyglossia}, then that's all you need. (Although you'll +%obviously need to install dependent packages, such as \styfmt{pgf} +%which provides the \sty{pgfcalendar} package used by +%\styfmt{datetime2-calc}. However \sty{fmtcount}, which is required by +%\styfmt{datetime}, isn't required by \styfmt{datetime2}.) +% +%If you want to use \styfmt{datetime2} with language support, then you +%only need to install the modules for the required language. For +%example, if you only use English, you can just install the +%\module{english} module and if you only use French, you can just +%install the \module{french} module. +% +%At the time of writing, the following modules are available on CTAN: +%\begin{center} +%\begin{tabular}{lll} +%\module[bahasai]{datetime2-bahasai} & \module[galician]{datetime2-galician} & \module[russian]{datetime2-russian} \\ +%\module[basque]{datetime2-basque} & \module[german]{datetime2-german} & \module[samin]{datetime2-samin} \\ +%\module[breton]{datetime2-breton} & \module[greek]{datetime2-greek} & \module[scottish]{datetime2-scottish} \\ +%\module[bulgarian]{datetime2-bulgarian} & \module[hebrew]{datetime2-hebrew} & \module[serbian]{datetime2-serbian} \\ +%\module[catalan]{datetime2-catalan} & \module[icelandic]{datetime2-icelandic} & \module[slovak]{datetime2-slovak} \\ +%\module[croatian]{datetime2-croatian} & \module[irish]{datetime2-irish} & \module[slovene]{datetime2-slovene} \\ +%\module[czech]{datetime2-czech} & \module[italian]{datetime2-italian} & \module[spanish]{datetime2-spanish} \\ +%\module[danish]{datetime2-danish} & \module[latin]{datetime2-latin} & \module[swedish]{datetime2-swedish} \\ +%\module[dutch]{datetime2-dutch} & \module[lsorbian]{datetime2-lsorbian} & \module[turkish]{datetime2-turkish} \\ +%\module[english]{datetime2-english} & \module[magyar]{datetime2-magyar} & \module[ukrainian]{datetime2-ukrainian} \\ +%\module[esperanto]{datetime2-esperanto} & \module[norsk]{datetime2-norsk} & \module[usorbian]{datetime2-usorbian} \\ +%\module[estonian]{datetime2-estonian} & \module[polish]{datetime2-polish} & \module[welsh]{datetime2-welsh} \\ +%\module[finnish]{datetime2-finnish} & \module[portuges]{datetime2-portuges} \\ +%\module[french]{datetime2-french} & \module[romanian]{datetime2-romanian} +%\end{tabular} +%\end{center} +%Some of these only support the root language but some, such as +%\module{english}, provide support for different regions. There is +%also a supplementary package \sty{datetime2-en-fulltext} that +%replicates \styfmt{datetime}'s \texttt{text} and \texttt{oclock} +%styles (and requires \sty{fmtcount}). +% +%Old style (\styfmt{datetime}): +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,british]{babel} +% +%\usepackage{datetime} +% +%\begin{document} +%\selectlanguage{french} +%\today +% +%\selectlanguage{british} +%\today +% +%\end{document} +%\end{verbatim} +%This produces: +%\begin{quote} +%21 janvier 2016\par +%Thursday 21\textsuperscript{st} January, 2016 +%\end{quote} +% +%New style (\styfmt{datetime2}, \sty{datetime2-english} and \sty{datetime2-french}): +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,british]{babel} +% +%\usepackage[showdow,useregional]{datetime2} +% +%\begin{document} +%\selectlanguage{french} +%\today +% +%\selectlanguage{british} +%\today +% +%\end{document} +%\end{verbatim} +%This produces: +%\begin{quote} +%21 janvier 2016\par +%Thursday 21st January 2016 +%\end{quote} +%There's a slight difference in the appearance of the British date. +%An exact reproduction of the \styfmt{datetime} format can be achieved +%by modifying the \style{en-GB} options: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,british]{babel} +% +%\usepackage[showdow,useregional]{datetime2} +%\DTMlangsetup[en-GB]{ord=raise,monthyearsep={,\space}} +% +%\begin{document} +%\selectlanguage{french} +%\today +% +%\selectlanguage{british} +%\today +% +%\end{document} +%\end{verbatim} +%Note that neither \styfmt{dt-french.def} from \styfmt{datetime} nor +%\sty{datetime2-french} support +%the show day of week option. +% +%The \styfmt{datetime} package provides: +%\begin{definition}[\inpkg{datetime}] +%\oldcs{setdefaultdate}\marg{date declaration} +%\end{definition} +%to always use the date style given by \meta{date declaration} +%instead of letting \sty{babel} switch the date format every time the +%language changes. +% +%In \styfmt{datetime2}, the default is the reverse: the style won't +%change when the language changes unless the languages (or regions) +%have been listed in the \styfmt{datetime2} package options. If the +%regional styles have been enabled, allowing \sty{babel} to change +%the date style whenever the language changes, then you can switch +%this behaviour off by setting the \pkgopt{useregional} option to +%\pkgoptfmt{false}. +% +%Old style (\styfmt{datetime}): +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,british]{babel} +% +%\usepackage{datetime} +% +%\yyyymmdddate +% +%\begin{document} +%\selectlanguage{french} +%\today +% +%\selectlanguage{british} +%\today +% +%\end{document} +%\end{verbatim} +%This produces: +%\begin{quote} +%21 janvier 2016\par +%Thursday 21\textsuperscript{st} January, 2016 +%\end{quote} +%(The numeric date style has been overridden.) +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,british]{babel} +% +%\usepackage{datetime2} +% +%\DTMsetdatestyle{iso} +% +%\begin{document} +%\selectlanguage{french} +%\today +% +%\selectlanguage{british} +%\today +% +%\end{document} +%\end{verbatim} +%This produces: +%\begin{quote} +%2016-01-21\par +%2016-01-21 +%\end{quote} +%(The ISO date style overrides the language setting.) +% +%Compare this to: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,british]{babel} +% +%\usepackage[en-GB,fr-FR]{datetime2} +% +%\DTMsetdatestyle{iso} +% +%\begin{document} +%\selectlanguage{french} +%\today +% +%\selectlanguage{british} +%\today +% +%\end{document} +%\end{verbatim} +%This produces: +%\begin{quote} +%21 janvier 2016\par +%21st January 2016 +%\end{quote} +% +%Examples that explicitly suppress the language-sensitive dates +%follow. First with \styfmt{datetime}: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,british]{babel} +% +%\usepackage{datetime} +% +%\setdefaultdate{\yyyymmdddate} +% +%\begin{document} +%\selectlanguage{french} +%\today +% +%\selectlanguage{british} +%\today +% +%\end{document} +%\end{verbatim} +%This produces: +%\begin{quote} +%2016/01/21\par +%2016/01/21 +%\end{quote} +% +%Now with \styfmt{datetime2}: +%\begin{verbatim} +%\documentclass{article} +%\usepackage[T1]{fontenc} +%\usepackage[utf8]{inputenc} +%\usepackage[french,british]{babel} +% +%\usepackage[en-GB,fr-FR,useregional=false]{datetime2} +% +%\DTMsetdatestyle{iso} +% +%\begin{document} +%\selectlanguage{french} +%\today +% +%\selectlanguage{british} +%\today +% +%\end{document} +%\end{verbatim} +%This produces: +%\begin{quote} +%2016-01-21\par +%2016-01-21 +%\end{quote} +% +%\section{Predefined Date Formats} +% +%The \styfmt{datetime} date styles were set with declarations such as +%\cs{longdate} (or package options that used the associated +%declaration, such as \pkgoptfmt{long}). +%With \styfmt{datetime2}, date styles are set using +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMsetdatestyle}\marg{style name} +%\end{definition} +%(which just changes the date style without changing the time style) or +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMsetstyle}\marg{style name} +%\end{definition} +%which sets the full date-time style. +% +%This section lists the \styfmt{datetime} declarations and how the +%same style can be set through \styfmt{datetime2}. +% +%\begin{definition}[\inpkg{datetime}] +%\oldcs{yyyymmdddate} +%\end{definition} +%By default this style produces a date in the form 2016/01/20. (The +%separator is governed by \oldcs{dateseparator}.) This is the default +%style for \styfmt{datetime2} with the exception of the separator, +%which defaults to a hyphen. To reproduce the \styfmt{datetime} +%format, you can set the date style to \style{default} (if it has +%been previous changed from the default) and change the separator +%with the \pkgopt{datesep} option: +%\begin{verbatim} +%\DTMsetdatestyle{default} +%\DTMsetup{datesep={/}} +%\end{verbatim} +% +%\begin{definition}[\inpkg{datetime}] +%\oldcs{longdate} +%\end{definition} +%This is the default date format for \styfmt{datetime} and this style produces +%the date in the form: Wednesday 8\textsuperscript{th} March, 2000. +%This is actually a regional style for some of the English dialects, +%so with \styfmt{datetime2} this additionally needs the +%\module{english} module installed. To exactly replicate this date +%format, including the day of week name, the superscript ordinal +%suffix and the comma after the month name, you need the +%\pkgopt{showdow} and \pkgopt{en-GB} package options and +%the \csopt{DTMlangsetup}{ord} and \csopt{DTMlangsetup}{monthyearsep} +%options for the \style{en-GB} style. For example: +%\begin{verbatim} +%\usepackage[showdow,en-GB]{datetime2} +%\DTMlangsetup[en-GB]{ord=raise,monthyearsep={,\space}} +%\end{verbatim} +%Another possibility is: +%\begin{verbatim} +%\usepackage[british]{babel} +%\usepackage[showdow]{datetime2} +%\DTMlangsetup[en-GB]{ord=raise,monthyearsep={,\space}} +%\DTMsetdatestyle{en-GB} +%\end{verbatim} +%There are other regional styles in the \module{english} module that +%produce the same format, such as \style{en-GG}. +% +%\begin{definition}[\inpkg{datetime}] +%\oldcs{shortdate} +%\end{definition} +%This is similar to \cs{longdate} but uses abbreviated names to +%produce a date in the form: Wed 8\textsuperscript{th} Mar, 2000. +%With \styfmt{datetime2}, this is like the above but additionally +%needs the \csopt{DTMlangsetup}{abbr} option for the \style{en-GB} +%style: +%\begin{verbatim} +%\usepackage[showdow,en-GB]{datetime2} +%\DTMlangsetup[en-GB]{ord=raise,monthyearsep={,\space},abbr} +%\end{verbatim} +%or +%\begin{verbatim} +%\usepackage[british]{babel} +%\usepackage[showdow]{datetime2} +%\DTMlangsetup[en-GB]{ord=raise,monthyearsep={,\space},abbr} +%\DTMsetdatestyle{en-GB} +%\end{verbatim} +% +%\begin{definition}[\inpkg{datetime}] +%\oldcs{ddmmyyyydate} +%\end{definition} +%This produces a date in the form 08/03/2000. This can be reproduced +%with just \styfmt{datetime2} using the \style{ddmmyyyy} style with +%the date separator set to a slash: +%\begin{verbatim} +%\DTMsetdatestyle{ddmmyyyy} +%\DTMsetup{datesep=/} +%\end{verbatim} +% +%\begin{definition}[\inpkg{datetime}] +%\oldcs{dmyyyydate} +%\end{definition} +%This produces a date in the form 8/3/2000. This can be reproduced +%with just \styfmt{datetime2} using the \style{dmyyyy} style with +%the date separator set to a slash: +%\begin{verbatim} +%\DTMsetdatestyle{dmyyyy} +%\DTMsetup{datesep=/} +%\end{verbatim} +%This format is also the style of some of the regional numeric date +%styles. For example, with the \module{english} module: +%\begin{verbatim} +%\usepackage[british]{babel} +%\usepackage{datetime2} +%\DTMsetdatestyle{en-GB-numeric} +%\end{verbatim} +% +%\begin{definition}[\inpkg{datetime}] +%\oldcs{ddmmyydate} +%\end{definition} +%This produces a date in the form 08/03/00. This can be reproduced +%with just \styfmt{datetime2} using the \style{ddmmyy} style with +%the date separator set to a slash: +%\begin{verbatim} +%\DTMsetdatestyle{ddmmyy} +%\DTMsetup{datesep=/} +%\end{verbatim} +% +%\begin{definition}[\inpkg{datetime}] +%\oldcs{dmyydate} +%\end{definition} +%This produces a date in the form 8/3/00. This can be reproduced +%with just \styfmt{datetime2} using the \style{dmyy} style with +%the date separator set to a slash: +%\begin{verbatim} +%\DTMsetdatestyle{dmyy} +%\DTMsetup{datesep=/} +%\end{verbatim} +% +%\begin{definition}[\inpkg{datetime}] +%\oldcs{textdate} +%\end{definition} +%This style is designed to produce a full text British date in the +%form: Wednesday the Eighth of March, Two Thousand. The +%\sty{datetime2-en-fulltext} package is required to reproduce this +%style: +%\begin{verbatim} +%\usepackage[showdow]{datetime2-en-fulltext} +%\DTMsetdatestyle{en-FullText} +%\end{verbatim} +%Note that with both \styfmt{datetime} and +%\styfmt{datetime2-en-fulltext} this style should not be used if the +%current language isn't English. +% +%\begin{definition}[\inpkg{datetime}] +%\oldcs{usdate} +%\end{definition} +%This style is designed to produce \TeX's default US date format in +%the form March 8, 2000. This style can be reproduced with +%\styfmt{datetime2} and the \module{english} module: +%\begin{verbatim} +%\usepackage[en-US]{datetime2} +%\end{verbatim} +%or +%\begin{verbatim} +%\usepackage[USenglish]{babel} +%\usepackage[useregional]{datetime2} +%\DTMsetdatestyle{en-US} +%\end{verbatim} +% +%\begin{definition}[\inpkg{datetime}] +%\oldcs{mmddyyyydate} +%\end{definition} +%This style produces a date in a middle-endian format in the form: +%03/08/2000. This style can be reproduced with \styfmt{datetime2} using +%the \style{mmddyyyy} style with the date separator set to a slash: +%\begin{verbatim} +%\DTMsetup{datesep=/} +%\DTMsetdatestyle{mmddyyyy} +%\end{verbatim} +% +%\begin{definition}[\inpkg{datetime}] +%\oldcs{mdyyyydate} +%\end{definition} +%This style produces a date in a middle-endian format in the form: +%3/8/2000. This style can be reproduced with \styfmt{datetime2} using +%the \style{mdyyyy} style with the date separator set to a slash: +%\begin{verbatim} +%\DTMsetup{datesep=/} +%\DTMsetdatestyle{mdyyyy} +%\end{verbatim} +%This format is also the style of some of the regional numeric date +%styles. For example, with the \module{english} module: +%\begin{verbatim} +%\usepackage[USenglish]{babel} +%\usepackage{datetime2} +%\DTMsetdatestyle{en-US-numeric} +%\end{verbatim} +% +%\begin{definition}[\inpkg{datetime}] +%\oldcs{mmddyydate} +%\end{definition} +%This style produces a date in a middle-endian format in the form: +%03/08/00. This style can be reproduced with \styfmt{datetime2} using +%the \style{mmddyy} style with the date separator set to a slash: +%\begin{verbatim} +%\DTMsetup{datesep=/} +%\DTMsetdatestyle{mmddyy} +%\end{verbatim} +% +%\begin{definition}[\inpkg{datetime}] +%\oldcs{mdyydate} +%\end{definition} +%This style produces a date in a middle-endian format in the form: +%3/8/00. This style can be reproduced with \styfmt{datetime2} using +%the \style{mdyy} style with the date separator set to a slash: +%\begin{verbatim} +%\DTMsetup{datesep=/} +%\DTMsetdatestyle{mdyy} +%\end{verbatim} +% +%\section{Predefined Time Formats} +% +%The time formats are set in \styfmt{datetime} using +%\begin{definition}[\inpkg{datetime}] +%\oldcs{settimeformat}\marg{style-name} +%\end{definition} +%With \styfmt{datetime2}, the time styles are set using +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMsettimestyle}\marg{style-name} +%\end{definition} +%(which just changes the time style without changing the date style) or +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMsetstyle}\marg{style name} +%\end{definition} +%which sets the full date-time style. +% +%The \styfmt{datetime} package provides the following time styles: +%\begin{description} +%\item[xxivtime] This style produces the time in twenty-four hour +%format in the form 09:28. (The default time style for +%\styfmt{datetime}.) Note that this style has no seconds. The format +%can be reproduced in \styfmt{datetime2} with the \style{default} +%style and the \pkgopt{showseconds} option set to \pkgoptfmt{false}: +%\begin{verbatim} +%\DTMsettimestyle{default} +%\DTMsetup{showseconds=false} +%\end{verbatim} +% +%\item[hhmmsstime] This is like the previous style but includes the +%seconds. This is the default time style for \styfmt{datetime2}: +%\begin{verbatim} +%\DTMsettimestyle{default} +%\end{verbatim} +% +%\item[ampmtime] This style produces the time in twelve hour format +%in the form 9:28am or 7:54pm. This style is available in some of the +%regional modules for \styfmt{datetime2}. For example, using the +%\style{en-GB} style in the \module{english} module: +%\begin{verbatim} +%\usepackage[en-GB]{datetime2} +%\end{verbatim} +%or +%\begin{verbatim} +%\usepackage[british]{babel} +%\usepackage{datetime2} +%\DTMsettimestyle{en-GB} +%\end{verbatim} +% +%\item[oclock] This style is designed for a full text English time +%format in the form: Twenty-Eight minutes past Ten in the afternoon. +%This style can be reproduced with the \style{en-FullText} style +%provided by the \sty{datetime2-en-fulltext} package: +%\begin{verbatim} +%\usepackage{datetime2-en-fulltext} +%\DTMsettimestyle{en-FullText} +%\end{verbatim} +% +%\end{description} +% +%\section{Defining a New Date Format} +% +%The \styfmt{datetime} package provides: +%\begin{definition}[\inpkg{datetime}] +%\oldcs{newdateformat}\marg{name}\marg{format} +%\end{definition} +%to define a new date style. Within \meta{format}, the placeholder +%commands \oldcs{THEDAY}, \oldcs{THEMONTH} and \oldcs{THEYEAR} are +%used to represent the relevant day, month and year values. There are +%also counter placeholders \texttt{DAY}, \texttt{MONTH} and +%\texttt{YEAR}, which may be used instead. +% +%A necessary consequence of allowing placeholder commands in +%\meta{format} means that these commands must be set as appropriate +%before the date can be formatted. This means that the formatted date +%can't be expanded and the date commands must be made robust to +%protect them in moving arguments. This is an inherent problem with the +%\styfmt{datetime} package that can't be fixed without breaking +%backwards compatibility and is one of the main reasons for +%introducing the replacement \styfmt{datetime2} package. +% +%The \styfmt{datetime2} package provides a better way of providing +%date styles, which are defined using: +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMnewdatestyle}\marg{name}\marg{definition} +%\end{definition} +%Instead of using placeholder commands, the date styles +%simply redefine the date formatting macros within \meta{definition}. +%There are two principle date formatting commands that the date style +%must define although styles may redefine additional helper commands +%if necessary. +% +%The two main date formatting commands are: +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMdisplaydate}\marg{YYYY}\marg{MM}\marg{DD}\marg{dow} +%\end{definition} +%for use where no case-changing is required and +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMDisplaydate}\marg{YYYY}\marg{MM}\marg{DD}\marg{dow} +%\end{definition} +%for use where the date must begin with an upper case letter, for +%example if the date occurs at the start of a sentence. For styles +%where the case-change is irrelevant (for example, numeric styles or +%styles that always start with an upper case letter), the +%\cs{DTMDisplaydate} command may simply be set to +%\cs{DTMdisplaydate}. +% +%The \styfmt{datetime} manual provides some examples of new date +%styles. The first is simply a numeric little-endian style with a hyphen +%separating each number: +%\begin{verbatim} +%\newdateformat{mydate}{\THEDAY-\THEMONTH-\THEYEAR} +%\end{verbatim} +% +%To convert this into a \styfmt{datetime2} format, the new style +%simply needs to redefine \cs{DTMdisplaydate} so that it has the +%following definition: +%\begin{verbatim} +%\renewcommand{\DTMdisplaydate}[4]{#3-#2-#1} +%\end{verbatim} +%Note that this command must always have four arguments, even if one +%or more of them are ignored. So here \cs{THEYEAR} is just the first +%argument \verb|#1|, \cs{THEMONTH} is the second argument \verb|#2| +%and \cs{THEDAY} is the third argument \verb|#3|. One other thing to note is +%that the arguments may be supplied with a leading zero. If you want +%to trim this off, you can use \TeX's \ics{number} primitive. For +%example: +%\begin{verbatim} +%\renewcommand{\DTMdisplaydate}[4]{\number#3-\number#2-\number#1 } +%\end{verbatim} +%This is the better method to allow for, say, registers used in any +%of the arguments. +% +%Therefore this new date style can be defined for \styfmt{datetime2} +%as follows: +%\begin{verbatim} +%\DTMnewdatestyle{mydate}{% +% \renewcommand{\DTMdisplaydate}[4]{\number##3-\number##2-\number##1 }% +% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% +%} +%\end{verbatim} +%(Note the need to double the \verb|#| in the parameters, as is usual +%when redefining a command within another command in this manner.) +% +%For example, using \styfmt{datetime}: +%\begin{verbatim} +%\documentclass{article} +%\usepackage{datetime} +% +%\newdateformat{mydate}{\THEDAY-\THEMONTH-\THEYEAR} +%\mydate +% +%\begin{document} +%\today. +%\end{document} +%\end{verbatim} +%Now using \styfmt{datetime2}: +%\begin{verbatim} +%\documentclass{article} +%\usepackage{datetime2} +% +%\DTMnewdatestyle{mydate}{% +% \renewcommand{\DTMdisplaydate}[4]{\number##3-\number##2-\number##1 }% +% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% +%} +%\DTMsetdatestyle{mydate} +% +%\begin{document} +%\today. +%\end{document} +%\end{verbatim} +% +%Another example provided in the \styfmt{datetime} manual ensures two +%digits for the month and day of month: +%\begin{verbatim} +%\newdateformat{dashdate}{\twodigit{\THEDAY}-\twodigit{\THEMONTH}-\THEYEAR} +%\end{verbatim} +% +%This is a minor modification to the previous example. The two digit +%number format can be obtained through \styfmt{datetime2}'s +%\ics{DTMtwodigits} command: +%\begin{verbatim} +%\DTMnewdatestyle{dashdate}{% +% \renewcommand{\DTMdisplaydate}[4]{% +% \DTMtwodigits{##3}-\DTMtwodigits{##2}-\number##1 }% +% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% +%} +%\end{verbatim} +% +%A complete example follows for \styfmt{datetime}: +%\begin{verbatim} +%\documentclass{article} +%\usepackage{datetime} +% +%\newdateformat{dashdate}{\twodigit{\THEDAY}-\twodigit{\THEMONTH}-\THEYEAR} +%\dashdate +% +%\begin{document} +%\today. +%\end{document} +%\end{verbatim} +%And for \styfmt{datetime2}: +%\begin{verbatim} +%\documentclass{article} +%\usepackage{datetime2} +% +%\DTMnewdatestyle{dashdate}{% +% \renewcommand{\DTMdisplaydate}[4]{% +% \DTMtwodigits{##3}-\DTMtwodigits{##2}-\number##1 }% +% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% +%} +%\DTMsetdatestyle{dashdate} +% +%\begin{document} +%\today. +%\end{document} +%\end{verbatim} +% +%You may have noticed that there's no equivalent of +%\styfmt{datetime}'s counter placeholders, but there's no real need +%for them and any attempt at implementing them would return to the +%original problem of preventing an expandable date format. \LaTeX\ +%counters all internally use \TeX\ count registers and counter +%formatting commands have to access those registers to determine the +%counter value. +% +%To illustrate this, the \styfmt{datetime} manual provides the +%example: +%\begin{verbatim} +%\newdateformat{usvardate}{\monthname[\THEMONTH] \ordinal{DAY}, \THEYEAR} +%\end{verbatim} +%This uses the \texttt{DAY} counter placeholder since \cs{ordinal} +%(provided by the \sty{fmtcount} package) requires a counter name as +%the argument. However, \cs{ordinal} internally uses \cs{ordinalnum} +%with the internal count register as the argument, so the format +%could just as easily be defined as: +%\begin{verbatim} +%\newdateformat{usvardate}{\monthname[\THEMONTH] \ordinalnum{\THEDAY}, \THEYEAR} +%\end{verbatim} +% +%So how can this style be reproduced with \styfmt{datetime2}? A +%na\"ive approach is: +%\begin{verbatim} +%\DTMnewdatestyle{usvardate}{% +% \renewcommand{\DTMdisplaydate}[4]{% +% \DTMmonthname{##2} \ordinalnum{##2}, \number##1 }% +% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% +%} +%\end{verbatim} +%This requires both \styfmt{datetime2-calc} (for \ics{DTMmonthname}) +%and \sty{fmtcount} (for \cs{ordinalnum}). +% +%A complete example that uses it: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{fmtcount} +%\usepackage[calc]{datetime2} +% +%\DTMnewdatestyle{usvardate}{% +% \renewcommand{\DTMdisplaydate}[4]{% +% \DTMmonthname{##2} \ordinalnum{##2}, \number##1 }% +% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% +%} +%\DTMsetdatestyle{usvardate} +% +%\begin{document} +%\today. +%\end{document} +%\end{verbatim} +%This produces a warning from \cs{DTMmonthname} because +%\cs{DTMenglishmonthname} hasn't been defined, so it uses +%\cs{pgfcalendarmonthname} instead. The document displays the text: +%\begin{quote} +%January 1\textsuperscript{st}, 2016. +%\end{quote} +%This seems to produce the correct output, but let's see what happens +%if we make a minor modification to the example: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage[english,french]{babel} +%\usepackage{fmtcount} +%\usepackage[calc]{datetime2} +% +%\DTMnewdatestyle{usvardate}{% +% \renewcommand{\DTMdisplaydate}[4]{% +% \DTMmonthname{##2} \ordinalnum{##2}, \number##1 }% +% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% +%} +%\DTMsetdatestyle{usvardate} +% +%\begin{document} +%\today. +%\end{document} +%\end{verbatim} +%This now produces: +%\begin{quote} +%janvier 1\textsuperscript{er}, 2016. +%\end{quote} +%which doesn't match the rationale of the style being a variation of +%the standard US date style nor does it match the little-endian +%syntax of French dates. +% +%Now let's make another minor change to the example: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{fmtcount} +%\usepackage[calc]{datetime2} +% +%\DTMnewdatestyle{usvardate}{% +% \renewcommand{\DTMdisplaydate}[4]{% +% \DTMmonthname{##2} \ordinalnum{##2}, \number##1 }% +% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% +%} +%\DTMsetdatestyle{usvardate} +% +%\begin{document} +%\section{\today: an example} +% +%\today. +%\end{document} +%\end{verbatim} +%This document can't compile properly and causes the error: +%\begin{verbatim} +%! Argument of \@sect has an extra }. +%<inserted text> +% \par +%\end{verbatim} +%This is because the style definition has made \cs{today} fragile +%because it uses an unprotected fragile command. This can be fixed by +%protecting \cs{ordinalnum} in the style definition. +% +%Let's make another modification: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{fmtcount} +%\usepackage[calc]{datetime2} +% +%\DTMnewdatestyle{usvardate}{% +% \renewcommand{\DTMdisplaydate}[4]{% +% \DTMmonthname{##2} \protect\ordinalnum{##2}, \number##1 }% +% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% +%} +%\DTMsetdatestyle{usvardate} +% +%\pagestyle{headings} +% +%\begin{document} +%\section{\today: an example} +% +%\today. +%\end{document} +%\end{verbatim} +%This compiles without error now that \cs{ordinalnum} has been +%protected, but the page header appears as: +%\begin{quote} +%\emph{1\quad January 1\textsuperscript{st}, 2016: AN EXAMPLE}\hfill 1 +%\end{quote} +%The date hasn't been rendered in upper case so the header doesn't +%look right. +% +%If \sty{hyperref} is added, another problem becomes evident: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{fmtcount} +%\usepackage[calc]{datetime2} +%\usepackage[colorlinks]{hyperref} +% +%\DTMnewdatestyle{usvardate}{% +% \renewcommand{\DTMdisplaydate}[4]{% +% \DTMmonthname{##2} \protect\ordinalnum{##2}, \number##1 }% +% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% +%} +%\DTMsetdatestyle{usvardate} +% +%\pagestyle{headings} +% +%\begin{document} +%\section{\today: an example} +% +%\today. +%\end{document} +%\end{verbatim} +%The PDF bookmarks for this document show the section title as: +%\begin{quote} +%01 , 2016: an example +%\end{quote} +% +%Both the header and the bookmark problem are caused by +%non-expandable elements of the date style. \emph{The same problems +%occur with \styfmt{datetime}}, and is one of the main reasons for +%developing a replacement package since these problems can't be fixed +%by \styfmt{datetime}. In fact, the \styfmt{datetime} version of this +%example looks even worse in the bookmarks: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{datetime} +%\usepackage[colorlinks]{hyperref} +% +%\newdateformat{usvardate}{\monthname[\THEMONTH] \ordinalnum{\THEDAY}, \THEYEAR} +%\usvardate +% +%\pagestyle{headings} +% +%\begin{document} +%\section{\today: an example} +% +%\today. +%\end{document} +%\end{verbatim} +%The bookmark now looks like: +%\begin{quote} +%===[0], 0: an example +%\end{quote} +%(The page header is the same as for the \styfmt{datetime2} example +%above, with the date not matching the rest of the heading case.) +% +%A more appropriate way of defining this style with +%\styfmt{datetime2} package is to use the \emph{expandable} commands +%provided by the \module{english} module: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage[calc,en-GB]{datetime2} +%\usepackage[colorlinks]{hyperref} +% +%\DTMnewdatestyle{usvardate}{% +% \renewcommand*{\DTMenglishfmtordsuffix}{\DTMenGBfmtordsuffix}% +% \renewcommand{\DTMdisplaydate}[4]{% +% \DTMenglishmonthname{##2} \DTMenglishordinal{##2}, \number##1 }% +% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% +%} +%\DTMsetdatestyle{usvardate} +% +%\pagestyle{headings} +% +%\begin{document} +%\section{\today: an example} +% +%\today. +%\end{document} +%\end{verbatim} +%This fixes both the header and the bookmarks. +% +%If you don't want to rely on remembering to use the \pkgopt{en-GB} +%option to load the \style{en-GB} style (which defines +%\cs{DTMenGBfmtordsuffix}) you can use this alternative: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage[calc]{datetime2} +%\usepackage[colorlinks]{hyperref} +% +%\DTMusemodule{english}{en-GB} +% +%\DTMnewdatestyle{usvardate}{% +% \renewcommand*{\DTMenglishfmtordsuffix}{\DTMenGBfmtordsuffix}% +% \renewcommand{\DTMdisplaydate}[4]{% +% \DTMenglishmonthname{##2} \DTMenglishordinal{##2}, \number##1 }% +% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% +%} +%\DTMsetdatestyle{usvardate} +% +%\pagestyle{headings} +% +%\begin{document} +%\section{\today: an example} +% +%\today. +%\end{document} +%\end{verbatim} +%This is a useful method to employ if you want to define the new +%style in a package without forcing the package options used to load +%\styfmt{datetime2}. +% +%Note that this new style definition is unaffected by language +%changes, so the other problem with the \styfmt{datetime} version of +%this style is also eliminated. +% +%\section{Defining a New Time Format} +% +%The \styfmt{datetime} package provides: +%\begin{definition}[\inpkg{datetime}] +%\oldcs{newtimeformat}\marg{name}\marg{format} +%\end{definition} +%to define a new time style. Within \meta{format}, the placeholder +%commands \oldcs{THEHOUR}, \oldcs{THEMINUTE}, \oldcs{THESECOND}, +%\oldcs{THEHOURXII}, \oldcs{THETOHOUR}, \oldcs{THETOMINUTE} may be +%used. There are also corresponding placeholder counters: +%\texttt{HOUR}, \texttt{MINUTE}, \texttt{SECOND}, \texttt{HOURXII}, +%\texttt{TOHOUR} and \texttt{TOMINUTE}. +% +%This placeholder style of format for the time has the same problems +%as that for the date styles described in the previous section. +% +%Time styles are defined in \styfmt{datetime2} using: +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMnewtimestyle}\marg{name}\marg{definition} +%\end{definition} +% +%As with the date styles, the \styfmt{datetime2} package provides +%styles that redefine a formatting macro. In this case, the time +%(without the zone) is simply formatted with +%\begin{definition}[\inpkg{datetime2}] +%\ics{DTMdisplaytime}\marg{hh}\marg{mm}\marg{ss} +%\end{definition} +%so the \meta{definition} part of \cs{DTMnewtimestyle} needs to +%redefine this command. +% +%The placeholder commands \cs{THEHOUR}, \cs{THEMINUTE} +%and \cs{THESECOND} from \styfmt{datetime} can now be represented by +%the first, second and third arguments of \cs{DTMdisplaytime}. The +%other placeholders are more complicated as they need to be +%calculated which may prevent the style from being an expandable +%format. +% +%The \styfmt{datetime} manual provides a simple example of defining a +%new time style: +%\begin{verbatim} +%\newtimeformat{dottime}{\twodigit{\THEHOUR}.\twodigit{\THEMINUTE}} +%\end{verbatim} +%This style is then set using: +%\begin{verbatim} +%\settimeformat{dottime} +%\end{verbatim} +% +%An equivalent time style can be defined with \styfmt{datetime2}: +%\begin{verbatim} +%\DTMnewtimestyle{dottime}{% +% \renewcommand*\DTMdisplaytime[3]{\DTMtwodigits{##1}.\DTMtwodigits{##2}}} +%\end{verbatim} +% +%A complete example using \styfmt{datetime}: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{datetime} +% +%\newtimeformat{dottime}{\twodigit{\THEHOUR}.\twodigit{\THEMINUTE}} +%\settimeformat{dottime} +% +%\begin{document} +%\currenttime. +%\end{document} +%\end{verbatim} +%A complete example using \styfmt{datetime2}: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{datetime2} +% +%\DTMnewtimestyle{dottime}{% +% \renewcommand*\DTMdisplaytime[3]{\DTMtwodigits{##1}.\DTMtwodigits{##2}}} +%\DTMsettimestyle{dottime} +% +%\begin{document} +%\DTMcurrenttime. +%\end{document} +%\end{verbatim} +% +%Note that the \styfmt{datetime} example has a problem with PDF +%bookmarks if the time is used in a sectioning command, for the same +%reasons as those discussed above in the previous section. This can +%be seen with a slight modification to the example: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{datetime} +%\usepackage[colorlinks]{hyperref} +% +%\newtimeformat{dottime}{\twodigit{\THEHOUR}.\twodigit{\THEMINUTE}} +%\settimeformat{dottime} +% +%\begin{document} +%\section{\currenttime: an example} +% +%\currenttime. +%\end{document} +%\end{verbatim} +%The bookmark appears as: +%\begin{quote} +%====by 1=by 12by 12 by -=by -60by -1=0.00: an example +%\end{quote} +% +%The \styfmt{datetime2} example works fine with a similar +%modification: +%\begin{verbatim} +%\documentclass{article} +% +%\usepackage{datetime2} +%\usepackage[colorlinks]{hyperref} +% +%\DTMnewtimestyle{dottime}{% +% \renewcommand*\DTMdisplaytime[3]{\DTMtwodigits{##1}.\DTMtwodigits{##2}}} +%\DTMsettimestyle{dottime} +% +%\begin{document} +%\section{\DTMcurrenttime: an example} +% +%\DTMcurrenttime. +%\end{document} +%\end{verbatim} +% +%There is one slight drawback with this example that's irrelevant to the choice +%of package. The bookmark (and table of contents, if present) will always show +%the time from the previous \LaTeX\ run. This is only a problem when using the +%current time, especially if seconds are required or the document build takes +%longer than a minute. If the example has a specific time instead of one that +%changes for every \LaTeX\ run, then this issue is eliminated. +% +%If you want a time style that requires the other placeholder +%commands provided by \styfmt{datetime}, then it's more complicated +%to convert to \styfmt{datetime2} as the values that +%\styfmt{datetime} conveniently computes and stores in the +%placeholder commands \oldcs{THEHOURXII}, \oldcs{THETOHOUR} and +%\oldcs{THETOMINUTE} now need to be calculated, preferably in an +%expandable way. +% +%An expandable twelve hour time format can be illustrated with the +%\style{englishampm} style provided by the \module{english} +%module:\footnote{Bug fix from \styfmt{datetime2-english} v1.03 +%included} +%\begin{verbatim} +%\DTMnewtimestyle +% {englishampm}% label +% {% +% \renewcommand*\DTMdisplaytime[3]{% +% \ifnum##2=0 +% \ifnum##1=12 +% \DTMtexorpdfstring +% {\DTMenglishampmfmt{\DTMenglishnoon}}% +% {\DTMenglishnoon}% +% \else +% \ifnum##1=0 +% \DTMtexorpdfstring +% {\DTMenglishampmfmt{\DTMenglishmidnight}}% +% {\DTMenglishmidnight}% +% \else +% \ifnum##1=24 +% \DTMtexorpdfstring +% {\DTMenglishampmfmt{\DTMenglishmidnight}}% +% {\DTMenglishmidnight}% +% \else +% \ifnum##1<12 +% \number##1 +% \DTMtexorpdfstring +% {\DTMenglishampmfmt{\DTMenglisham}}% +% {\DTMenglisham}% +% \else +% \number\numexpr##1-12\relax +% \DTMtexorpdfstring +% {\DTMenglishampmfmt{\DTMenglishpm}}% +% {\DTMenglishpm}% +% \fi +% \fi +% \fi +% \fi +% \fi +% \else +% \ifnum##1<13 +% \ifnum##1=0 +% 12% +% \else +% \number##1 +% \fi +% \DTMenglishtimesep\DTMtwodigits{##2}% +% \ifnum##1=12 +% \DTMtexorpdfstring +% {\DTMenglishampmfmt{\DTMenglishpm}}% +% {\DTMenglishpm}% +% \else +% \DTMtexorpdfstring +% {\DTMenglishampmfmt{\DTMenglisham}}% +% {\DTMenglisham}% +% \fi +% \else +% \number\numexpr##1-12\relax +% \DTMenglishtimesep\DTMtwodigits{##2}% +% \ifnum##1=24 +% \DTMtexorpdfstring +% {\DTMenglishampmfmt{\DTMenglisham}}% +% {\DTMenglisham}% +% \else +% \DTMtexorpdfstring +% {\DTMenglishampmfmt{\DTMenglishpm}}% +% {\DTMenglishpm}% +% \fi +% \fi +% \fi +% }% +% }% +%\end{verbatim} +% +%This is certainly more complicated than the +%\texttt{ampmtime} format provided by \styfmt{datetime}, which is +%defined as: +%\begin{verbatim} +%\newtimeformat{ampmtime}% +%{% +% \ifthenelse{\value{HOUR}=0}{12}{\THEHOURXII}% +% \timeseparator +% \twodigit{\THEMINUTE}% +% \ifthenelse{\value{HOUR}<12}{\amname}% +% {% +% \ifthenelse{\value{HOUR}=12}{ \noon}{\pmname}% +% }% +%} +%\end{verbatim} +%However the \styfmt{datetime2} version produces better results, +%especially where expansion is required (for example, in bookmarks or +%writing a time stamp to an external file). The \styfmt{datetime2} +%version also performs extra checks for midnight where the +%\styfmt{datetime} version produces ambiguous text. So the +%\texttt{ampmtime} definition is simple but buggy. +% +%The basic algorithm for \style{englishampm} is: +%\begin{description} +%\item If the minute value is 0 (\verb|\ifnum##2=0|): +% \begin{description} +% \item If the hour value is 12 (\verb|\ifnum##1=12|): +% \begin{description} +% \item Print \qt{noon} +% \end{description} +% +% \item Otherwise (not noon but on the hour) +% +% \begin{description} +% \item If the hour value is 0 (\verb|\ifnum##1=0|) +% \begin{description} +% \item Print \qt{midnight} +% \end{description} +% +% \item Otherwise (not 12:00 or 00:00 but on the hour) +% +% \begin{description} +% \item If the hour value is 24 (\verb|\ifnum##1=24|) +% \begin{description} +% \item Print \qt{midnight} +% \end{description} +% +% \item Otherwise (not 12:00 or 00:00 or 24:00 but on the hour) +% \begin{description} +% \item If the hour value is less than 12 (\verb|\ifnum##1<12|) +% \begin{description} +% \item Print the hour value (\verb|\number##1|) +% \item Print \qt{am} +% \end{description} +% \item Otherwise +% \begin{description} +% \item Print the hour value less 12 +% (\verb|\number\numexpr##1-12|) +% \item Print \qt{pm} +% \end{description} +% \end{description} +% \end{description} +% \end{description} +% \end{description} +% +% \item Otherwise (minute value isn't zero) +% +% \begin{description} +% \item If the hour value is less than 13 (\verb|\ifnum##1<13|) +% +% \begin{description} +% \item If the hour value is 0 (\verb|\ifnum##1=0|) +% \begin{description} +% \item Print \qt{12} +% \end{description} +% \item Otherwise +% \begin{description} +% \item Print the hour (\verb|\number##1|) +% \end{description} +% +% \item Print the separator between the hour and minute +% (\verb|\DTMenglishtimesep|) +% +% \item Print minute value (\verb|\DTMtwodigits{##2}|) +% +% \item If the hour value is 12 (\verb|\ifnum##=12|) +% \begin{description} +% \item Print \qt{pm} +% \end{description} +% \item Otherwise (hour value less than 12) +% \begin{description} +% \item Print \qt{am} +% \end{description} +% \end{description} +% +% \item Otherwise (hour value $\ge13$) +% +% \begin{description} +% \item Print the hour value less 12 +% (\verb|\number\numexpr##1-12|) +% \item Print the time separator +% +% \item Print minute value (\verb|\DTMtwodigits{##2}|) +% +% \item If the hour value is 24 (\verb|\ifnum##1=24|) +% \begin{description} +% \item Print \qt{am} +% \end{description} +% \item Otherwise +% \begin{description} +% \item Print \qt{pm} +% \end{description} +% \end{description} +% \end{description} +%\end{description} +%Most of the complication in this style isn't trying to determine the +%equivalent value of \cs{THEHOURXII} (\verb|\number\numexpr##1-12| +%if \verb|##1>12|) but in improving the algorithm to catch special +%cases that the \styfmt{datetime} style misses. Additionally, +%\ics{DTMtexorpdfstring} is used to prevent any font formatting +%commands from being added to the bookmarks. +% +%The \sty{datetime2-en-fulltext} package provides an example of a +%time style that requires calculating the minutes to the hour and the +%next hour. Note that fragile commands are protected in this style. +%Since it contains fragile commands that require protection, it can't +%be used in an expandable context. +% +%Remember that most of the styles provided by \styfmt{datetime2} and its +%associated modules and dependent packages are configurable, so if +%your preferred style is only marginally different to a predefined +%style, you may be able to tweak that style to fit your requirements. +%For example, the dot time format can be obtained using the +%\style{default} style with the seconds suppressed and the separator +%change to a dot: +%\begin{verbatim} +%\DTMsettimestyle{default} +%\DTMsetup{timesep={.},showseconds=false} +%\end{verbatim} +% +%The twelve hour format provided by the \module{english} module can also be +%adjusted. This style honours the package-wide time-related option +%\pkgopt{hourminsep} and the \qt{am}, \qt{pm}, \qt{midnight} or +%\qt{noon} part is formatted according to: +%\begin{definition}[\inpkg{datetime2-english}] +%\ics{DTMenglishampmfmt}\marg{text} +%\end{definition} +% +%So a twelve hour format that uses a dot instead of a colon and has +%the text part in small caps can be obtained using: +%\begin{verbatim} +%\usepackage[english,hourminsep={.}]{datetime2} +%\renewcommand*{\DTMenglishampmfmt}[1]{\textsc{#1}} +%\end{verbatim} +% +%\StopEventually{\PrintChanges\PrintIndex} % % %\chapter{The Code} @@ -2205,7 +5462,7 @@ %\changes{1.0}{2015-03-24}{Initial release} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datetime2}[2015/11/10 v1.2 (NLCT) date and time formats] +\ProvidesPackage{datetime2}[2016/01/22 v1.3 (NLCT) date and time formats] % \end{macrocode} % Use \sty{tracklang} to find out what languages have been loaded. % \begin{macrocode} @@ -2546,10 +5803,22 @@ % Pass any unknown options to \sty{tracklang}. % This will automatically switch the "useregional" setting to % \texttt{text}. +%\changes{1.3}{2016-01-22}{added predefined dialect test} % \begin{macrocode} \DeclareOptionX*{% - \TrackPredefinedDialect{\CurrentOption}% - \renewcommand*{\DTMifcaseregional}[3]{#2}% + \ifcsundef{@tracklang@add@\CurrentOption}% + {% + \PackageError{datetime2}{`\CurrentOption' is not a recognised dialect. + \MessageBreak Perhaps you have misspelt it or the + \MessageBreak named dialect may be unsupported or + \MessageBreak perhaps you forgot to use the `style' key}% + {Any options that aren't described in the manual are assumed + \MessageBreak to be language or dialect names.}% + }% + {% + \TrackPredefinedDialect{\CurrentOption}% + \renewcommand*{\DTMifcaseregional}[3]{#2}% + }% } % \end{macrocode} % @@ -3988,6 +7257,62 @@ } % \end{macrocode} % +% Define \style{ddmmyy} style: +%\changes{1.3}{2016-01-22}{added ddmmyy style} +% \begin{macrocode} +\DTMnewstyle + {ddmmyy}%label + {% date style + \renewcommand*\DTMdisplaydate[4]{% + \DTMtwodigits{##3}\DTMsep{monthday}% + \DTMtwodigits{##2}\DTMsep{yearmonth}% + \DTMtwodigits{##1}% + }% + \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% + }% + {% time style + \renewcommand*\DTMdisplaytime[3]{% + \DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% + \ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi + }% + }% + {% zone style + \renewcommand*{\DTMdisplayzone}[2]{% + \ifboolexpe + { bool{DTMshowisoZ} + and test{\ifnumequal{##1}{0}} + and test{\ifnumequal{##2}{0}} + }% + {% + Z% + }% + {% + \ifnum##1<0\else+\fi\DTMtwodigits{##1}% + \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi + }% + }% + }% + {% full style + \renewcommand*{\DTMdisplay}[9]{% + \ifDTMshowdate + \DTMdisplaydate{##1}{##2}{##3}{##4}% + \DTMsep{datetime}% + \fi + \DTMdisplaytime + {##5}% + {##6}% + {##7}% + \ifDTMshowzone + \DTMsep{timezone}% + \DTMdisplayzone + {##8}% + {##9}% + \fi + }% + \renewcommand*{\DTMDisplay}{\DTMdisplay}% + } +% \end{macrocode} +% % Define \style{mmddyyyy} style: % \begin{macrocode} \DTMnewstyle @@ -4157,6 +7482,62 @@ } % \end{macrocode} % +% Define \style{mmddyy} style: +%\changes{1.3}{2016-01-22}{added mmddyy style} +% \begin{macrocode} +\DTMnewstyle + {mmddyy}%label + {% date style + \renewcommand*\DTMdisplaydate[4]{% + \DTMtwodigits{##2}\DTMsep{monthday}% + \DTMtwodigits{##3}\DTMsep{dayyear}% + \DTMtwodigits{##1}% + }% + \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% + }% + {% time style + \renewcommand*\DTMdisplaytime[3]{% + \DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% + \ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi + }% + }% + {% zone style + \renewcommand*{\DTMdisplayzone}[2]{% + \ifboolexpe + { bool{DTMshowisoZ} + and test{\ifnumequal{##1}{0}} + and test{\ifnumequal{##2}{0}} + }% + {% + Z% + }% + {% + \ifnum##1<0\else+\fi\DTMtwodigits{##1}% + \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi + }% + }% + }% + {% full style + \renewcommand*{\DTMdisplay}[9]{% + \ifDTMshowdate + \DTMdisplaydate{##1}{##2}{##3}{##4}% + \DTMsep{datetime}% + \fi + \DTMdisplaytime + {##5}% + {##6}% + {##7}% + \ifDTMshowzone + \DTMsep{timezone}% + \DTMdisplayzone + {##8}% + {##9}% + \fi + }% + \renewcommand*{\DTMDisplay}{\DTMdisplay}% + } +% \end{macrocode} +% % Define \style{hmmss} time style % \begin{macrocode} \DTMnewtimestyle @@ -4596,13 +7977,63 @@ {% \edef\@dtm@loadedregions{\@dtm@loadedregions,#1}% }% +% \end{macrocode} +% In case a synonym is also used, add a mapping from the module name +% to the current tracked dialect. +%\changes{1.3}{2016-01-22}{added module to dialect map} +% \begin{macrocode} + \csedef{@dtm@moddialectmap@#1}{\CurrentTrackedDialect}% }% - {}% + {% +% \end{macrocode} +% The module has already been loaded, but the current tracked +% dialect might be a synonym for a different language label that +% might've already loaded the module. If \cs{date\meta{dialect}} +% exists, this needs to be set. +% \begin{macrocode} + \ifcsdef{date\CurrentTrackedDialect} + {% + \letcs{\@dtm@otherdialect}{@dtm@moddialectmap@#1}% + \edef\@dtm@thisdialect{\CurrentTrackedDialect}% + \ifdefequal\@dtm@thisdialect\@dtm@otherdialect + {}% + {% + \ifcsdef{date\@dtm@otherdialect}% + {% + \csletcs{date\@dtm@thisdialect}{date\@dtm@otherdialect}% + }% + {}% + }% + }% + {}% + }% +% \end{macrocode} +% In case it's needed, create a mapping between the dialect name and +% the module name. +%\changes{1.3}{2016-01-22}{added dialect to module map} +% \begin{macrocode} + \csedef{@dtm@dialectmodmap@\CurrentTrackedDialect}{#1}% }% } % \end{macrocode} %\end{macro} % +%\begin{macro}{\DTMdialecttomodulemap} +%\changes{1.3}{2016-01-22}{new} +%\begin{definition} +%\cs{DTMdialecttomodulemap}\marg{dialect} +%\end{definition} +% Expands to name of the module loaded with the given dialect name +% or \cs{relax} if no module has been loaded for the given dialect. +% \begin{macrocode} +\newcommand*{\DTMdialecttomodulemap}[1]{% + \ifcsdef{ver@datetime2-#1.ldf}% + {#1}% + {\csname @dtm@dialectmodmap@#1\endcsname}% +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\ProvidesDateTimeModule} % For use in language module to identify itself. % \begin{macrocode} @@ -4612,6 +8043,25 @@ % \end{macrocode} %\end{macro} % +%\begin{macro}{\DTMusemodule} +%\changes{1.03}{2016-01-20}{new} +% Provided for packages or documents that need to load a module. +% This shouldn't be used inside the \texttt{.ldf} files. +% \begin{macrocode} +\newcommand*{\DTMusemodule}[2]{% + \ifcsdef{@tracklang@add@#1}% + {% + \TrackPredefinedDialect{#1}% + }% + {}% + \let\@dtm@org@dialect\CurrentTrackedDialect + \def\CurrentTrackedDialect{#1}% + \RequireDateTimeModule{#2}% + \let\CurrentTrackedDialect\@dtm@org@dialect +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\DTMdefkey} %\begin{definition} %\cs{DTMdefkey}\marg{region}\marg{key}\oarg{default}\marg{func} @@ -4669,8 +8119,15 @@ % iterated over. (I'm not sure why \cs{setkeys} doesn't work % if the same key is present in multiple families, so this iterates % over the families instead.) +% The starred version doesn't warn on unknown keys. +%\changes{1.3}{2016-01-22}{added starred version} +% \begin{macrocode} +\newcommand*{\DTMlangsetup}{% + \@ifstar\s@DTMlangsetup\@DTMlangsetup} +% \end{macrocode} +% Unstarred version: % \begin{macrocode} -\newcommand*{\DTMlangsetup}[2][\@dtm@loadedregions]{% +\newcommand*{\@DTMlangsetup}[2][\@dtm@loadedregions]{% \@for\@dtm@region:=#1\do{% \setkeys*+[dtm]{\@dtm@region}{#2}% \ifdefempty\XKV@rm{}% @@ -4683,6 +8140,15 @@ }% } % \end{macrocode} +% +% Starred version: +% \begin{macrocode} +\newcommand*{\s@DTMlangsetup}[2][\@dtm@loadedregions]{% + \@for\@dtm@region:=#1\do{% + \setkeys*+[dtm]{\@dtm@region}{#2}% + }% +} +% \end{macrocode} %\end{macro} % % Now load all the required modules (if installed) using the @@ -4726,7 +8192,7 @@ %\section{datetime2-calc.sty code} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datetime2-calc}[2015/11/10 v1.2 (NLCT)] +\ProvidesPackage{datetime2-calc}[2016/01/22 v1.3 (NLCT)] % \end{macrocode} % Load other required packages % \begin{macrocode} @@ -4734,6 +8200,7 @@ \RequirePackage{pgfcalendar} % \end{macrocode} % +%\subsection{Conversions and Calculations} %\begin{macro}{\@dtm@julianday} % Register for storing Julian day number. % \begin{macrocode} @@ -5026,6 +8493,530 @@ } % \end{macrocode} %\end{macro} +% +%\subsection{Month and Weekday Names} +%These commands \emph{should not} be used in date styles. One of the +%reasons for replacing \sty{datetime} with \sty{datetime2} was +%caused by styles using language-variable names in language-specific +%syntax resulting in a mismatch with the syntax of one language (or +%region) with a translation of the month (and possibly weekday) name. +%These commands are provided for standalone use outside of styles. +%(Additionally, they're not expandable, which also makes them +%inappropriate for the styles that are expected to provide +%expandable dates.) +% +%\begin{macro}{\dtm@ifdianameexists} +%\changes{1.3}{2016-01-22}{new} +% \begin{macrocode} +\newcommand*{\dtm@ifdianameexists}[3]{% + \IfTrackedDialect{\languagename}% + {% + \ifcsdef{DTM\TrackedLanguageFromDialect{\languagename}#1}% + {#2}% + {#3}% + }% + {#3}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\DTMmonthname} +%\changes{1.3}{2016-01-22}{new} +% \begin{macrocode} +\newrobustcmd{\DTMmonthname}[1]{% +% \end{macrocode} +% First check if \cs{DTM\meta{language}monthname} exists. +% \begin{macrocode} + \ifcsdef{DTM\languagename monthname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\languagename monthname}{#1}% + }% + {% +% \end{macrocode} +% Try obtaining the language name from the dialect using +% \sty{tracklang}'s interface. +% \begin{macrocode} + \dtm@ifdianameexists{monthname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\TrackedLanguageFromDialect{\languagename}monthname}{#1}% + }% + {% +% \end{macrocode} +% Can't determine the language name macro. This may be because the +% actual name can't be determined or it could be because the +% relevant language module can't be loaded so use \sty{pgf}'s +% command instead, which also has limited language support. +% \begin{macrocode} + \dtmnamewarning{\DTMmonthname}% + \pgfcalendarmonthname{#1}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\DTMMonthname} +%\changes{1.3}{2016-01-22}{new} +% \begin{macrocode} +\newrobustcmd{\DTMMonthname}[1]{% +% \end{macrocode} +% First check if \cs{DTM\meta{language}Monthname} exists. +% \begin{macrocode} + \ifcsdef{DTM\languagename Monthname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\languagename Monthname}{#1}% + }% + {% +% \end{macrocode} +% Try obtaining the language name from the dialect using +% \sty{tracklang}'s interface. +% \begin{macrocode} + \dtm@ifdianameexists{Monthname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\TrackedLanguageFromDialect{\languagename}Monthname}{#1}% + }% + {% +% \end{macrocode} +% Can't determine the language name macro. This could be because +% there's no upper case macro as the names always start with a +% capital (like English). +% \begin{macrocode} + \ifcsdef{DTM\languagename monthname}% + {% + \csuse{DTM\languagename monthname}{#1}% + }% + {% + \dtm@ifdianameexists{monthname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}monthname}{#1}% + }% + {% +% \end{macrocode} +% Can't find no-case change version either, so use \sty{pgfcalendar} +% command instead (which will need a case-change applied). +% \begin{macrocode} + \dtmnamewarning{\DTMMonthname}% +% \end{macrocode} +% If \sty{mfirstuc} has been loaded, use it. +% \begin{macrocode} + \ifdef\emakefirstuc + {% + \emakefirstuc{\pgfcalendarmonthname{#1}}% + }% + {% +% \end{macrocode} +% Hasn't been loaded, so just expand and apply \cs{MakeUppercase}: +% \begin{macrocode} + \protected@edef\dtm@tmp@monthname{\pgfcalendarmonthname{#1}}% + \expandafter\MakeUppercase\dtm@tmp@monthname + }% + }% + }% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\DTMshortmonthname} +%\changes{1.3}{2016-01-22}{new} +% \begin{macrocode} +\newrobustcmd{\DTMshortmonthname}[1]{% +% \end{macrocode} +% First check if \cs{DTM\meta{language}shortmonthname} exists. +% \begin{macrocode} + \ifcsdef{DTM\languagename shortmonthname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\languagename shortmonthname}{#1}% + }% + {% +% \end{macrocode} +% Try obtaining the language name from the dialect using +% \sty{tracklang}'s interface. +% \begin{macrocode} + \dtm@ifdianameexists{shortmonthname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\TrackedLanguageFromDialect{\languagename}shortmonthname}{#1}% + }% + {% +% \end{macrocode} +% Can't determine the language name macro. This may be because the +% actual name can't be determined or it could be because the +% relevant language module can't be loaded so use \sty{pgf}'s +% command instead, which also has limited language support. +% \begin{macrocode} + \dtmnamewarning{\DTMshortmonthname}% + \pgfcalendarmonthshortname{#1}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\DTMshortMonthname} +%\changes{1.3}{2016-01-22}{new} +% \begin{macrocode} +\newrobustcmd{\DTMshortMonthname}[1]{% +% \end{macrocode} +% First check if \cs{DTM\meta{language}shortMonthname} exists. +% \begin{macrocode} + \ifcsdef{DTM\languagename shortMonthname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\languagename shortMonthname}{#1}% + }% + {% +% \end{macrocode} +% Try obtaining the language name from the dialect using +% \sty{tracklang}'s interface. +% \begin{macrocode} + \dtm@ifdianameexists{shortMonthname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\TrackedLanguageFromDialect{\languagename}shortMonthname}{#1}% + }% + {% +% \end{macrocode} +% Can't determine the language name macro. This could be because +% there's no upper case macro as the names always start with a +% capital (like English). +% \begin{macrocode} + \ifcsdef{DTM\languagename shortmonthname}% + {% + \csuse{DTM\languagename shortmonthname}{#1}% + }% + {% + \dtm@ifdianameexists{shortmonthname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}shortmonthname}% + {#1}% + }% + {% +% \end{macrocode} +% Can't find no-case change version either, so use \sty{pgfcalendar} +% command instead (which will need a case-change applied). +% \begin{macrocode} + \dtmnamewarning{\DTMshortMonthname}% +% \end{macrocode} +% If \sty{mfirstuc} has been loaded, use it. +% \begin{macrocode} + \ifdef\emakefirstuc + {% + \emakefirstuc{\pgfcalendarmonthshortname{#1}}% + }% + {% +% \end{macrocode} +% Hasn't been loaded, so just expand and apply \cs{MakeUppercase}: +% \begin{macrocode} + \protected@edef\dtm@tmp@monthname{\pgfcalendarmonthshortname{#1}}% + \expandafter\MakeUppercase\dtm@tmp@monthname + }% + }% + }% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\DTMweekdayname} +%\changes{1.3}{2016-01-22}{new} +% \begin{macrocode} +\newrobustcmd{\DTMweekdayname}[1]{% +% \end{macrocode} +% First check if \cs{DTM\meta{language}weekdayname} exists. +% \begin{macrocode} + \ifcsdef{DTM\languagename weekdayname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\languagename weekdayname}{#1}% + }% + {% +% \end{macrocode} +% Try obtaining the language name from the dialect using +% \sty{tracklang}'s interface. +% \begin{macrocode} + \dtm@ifdianameexists{weekdayname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\TrackedLanguageFromDialect{\languagename}weekdayname}{#1}% + }% + {% +% \end{macrocode} +% Can't determine the language name macro. This may be because the +% actual name can't be determined or it could be because the +% relevant language module can't be loaded so use \sty{pgf}'s +% command instead, which also has limited language support. +% \begin{macrocode} + \dtmnamewarning{\DTMweekdayname}% + \pgfcalendarweekdayname{#1}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\DTMWeekdayname} +%\changes{1.3}{2016-01-22}{new} +% \begin{macrocode} +\newrobustcmd{\DTMWeekdayname}[1]{% +% \end{macrocode} +% First check if \cs{DTM\meta{language}Weekdayname} exists. +% \begin{macrocode} + \ifcsdef{DTM\languagename Weekdayname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\languagename Weekdayname}{#1}% + }% + {% +% \end{macrocode} +% Try obtaining the language name from the dialect using +% \sty{tracklang}'s interface. +% \begin{macrocode} + \dtm@ifdianameexists{Weekdayname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\TrackedLanguageFromDialect{\languagename}Weekdayname}{#1}% + }% + {% +% \end{macrocode} +% Can't determine the language name macro. This could be because +% there's no upper case macro as the names always start with a +% capital (like English). +% \begin{macrocode} + \ifcsdef{DTM\languagename weekdayname}% + {% + \csuse{DTM\languagename weekdayname}{#1}% + }% + {% + \dtm@ifdianameexists{weekdayname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}weekdayname}{#1}% + }% + {% +% \end{macrocode} +% Can't find no-case change version either, so use \sty{pgfcalendar} +% command instead (which will need a case-change applied). +% \begin{macrocode} + \dtmnamewarning{\DTMWeekdayname}% +% \end{macrocode} +% If \sty{mfirstuc} has been loaded, use it. +% \begin{macrocode} + \ifdef\emakefirstuc + {% + \emakefirstuc{\pgfcalendarweekdayname{#1}}% + }% + {% +% \end{macrocode} +% Hasn't been loaded, so just expand and apply \cs{MakeUppercase}: +% \begin{macrocode} + \protected@edef\dtm@tmp@weekdayname{\pgfcalendarweekdayname{#1}}% + \expandafter\MakeUppercase\dtm@tmp@weekdayname + }% + }% + }% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\DTMshortweekdayname} +%\changes{1.3}{2016-01-22}{new} +% \begin{macrocode} +\newrobustcmd{\DTMshortweekdayname}[1]{% +% \end{macrocode} +% First check if \cs{DTM\meta{language}shortweekdayname} exists. +% \begin{macrocode} + \ifcsdef{DTM\languagename shortweekdayname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\languagename shortweekdayname}{#1}% + }% + {% +% \end{macrocode} +% Try obtaining the language name from the dialect using +% \sty{tracklang}'s interface. +% \begin{macrocode} + \dtm@ifdianameexists{shortweekdayname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\TrackedLanguageFromDialect{\languagename}shortweekdayname}{#1}% + }% + {% +% \end{macrocode} +% Can't determine the language name macro. This may be because the +% actual name can't be determined or it could be because the +% relevant language module can't be loaded so use \sty{pgf}'s +% command instead, which also has limited language support. +% \begin{macrocode} + \dtmnamewarning{\DTMshortweekdayname}% + \pgfcalendarweekdayshortname{#1}% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\DTMshortWeekdayname} +%\changes{1.3}{2016-01-22}{new} +% \begin{macrocode} +\newrobustcmd{\DTMshortWeekdayname}[1]{% +% \end{macrocode} +% First check if \cs{DTM\meta{language}shortWeekdayname} exists. +% \begin{macrocode} + \ifcsdef{DTM\languagename shortWeekdayname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\languagename shortWeekdayname}{#1}% + }% + {% +% \end{macrocode} +% Try obtaining the language name from the dialect using +% \sty{tracklang}'s interface. +% \begin{macrocode} + \dtm@ifdianameexists{shortWeekdayname}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\TrackedLanguageFromDialect{\languagename}shortWeekdayname}{#1}% + }% + {% +% \end{macrocode} +% Can't determine the language name macro. This could be because +% there's no upper case macro as the names always start with a +% capital (like English). +% \begin{macrocode} + \ifcsdef{DTM\languagename shortweekdayname}% + {% + \csuse{DTM\languagename shortweekdayname}{#1}% + }% + {% + \dtm@ifdianameexists{shortweekdayname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}shortweekdayname}% + {#1}% + }% + {% +% \end{macrocode} +% Can't find no-case change version either, so use \sty{pgfcalendar} +% command instead (which will need a case-change applied). +% \begin{macrocode} + \dtmnamewarning{\DTMshortWeekdayname}% +% \end{macrocode} +% If \sty{mfirstuc} has been loaded, use it. +% \begin{macrocode} + \ifdef\emakefirstuc + {% + \emakefirstuc{\pgfcalendarweekdayshortname{#1}}% + }% + {% +% \end{macrocode} +% Hasn't been loaded, so just expand and apply \cs{MakeUppercase}: +% \begin{macrocode} + \protected@edef\dtm@tmp@weekdayname{% + \pgfcalendarweekdayshortname{#1}}% + \expandafter\MakeUppercase\dtm@tmp@weekdayname + }% + }% + }% + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\DTMordinal} +%\changes{1.3}{2016-01-22}{new} +% \begin{macrocode} +\newrobustcmd{\DTMordinal}[1]{% +% \end{macrocode} +% First check if \cs{DTM\meta{language}ordinal} exists. +% \begin{macrocode} + \ifcsdef{DTM\languagename ordinal}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\languagename ordinal}{#1}% + }% + {% +% \end{macrocode} +% Try obtaining the language name from the dialect using +% \sty{tracklang}'s interface. +% \begin{macrocode} + \dtm@ifdianameexists{ordinal}% + {% +% \end{macrocode} +% It exists, so use it. +% \begin{macrocode} + \csuse{DTM\TrackedLanguageFromDialect{\languagename}ordinal}{#1}% + }% + {% +% \end{macrocode} +% Can't determine the language name macro. This may be because the +% actual name can't be determined or it could be because the +% relevant language module can't be loaded so just display the +% number. +% \begin{macrocode} + \number#1 + }% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\dtmnamewarning} +%\changes{1.3}{2016-01-22}{new} +% Issue warning unless warnings have been suppressed. +% \begin{macrocode} +\newcommand*{\dtmnamewarning}[1]{% + \if@dtm@warn + \PackageWarning{datetime2-calc}% + {Can't find underlying language macro for \MessageBreak + \string#1\space(language: \languagename); \MessageBreak + using pgfcalendar macro instead}% + \fi +} +% \end{macrocode} +%\end{macro} %\iffalse % \begin{macrocode} %</datetime2-calc.sty> diff --git a/Master/texmf-dist/source/latex/datetime2/datetime2.ins b/Master/texmf-dist/source/latex/datetime2/datetime2.ins index e2bc335b55a..0336702b8f0 100644 --- a/Master/texmf-dist/source/latex/datetime2/datetime2.ins +++ b/Master/texmf-dist/source/latex/datetime2/datetime2.ins @@ -1,10 +1,10 @@ -% datetime2.ins generated using makedtx version 1.1 2015/11/10 10:38 +% datetime2.ins generated using makedtx version 1.1 2016/1/22 15:29 \input docstrip \preamble datetime2.dtx - Copyright 2015 Nicola Talbot + Copyright 2016 Nicola Talbot This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 diff --git a/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty b/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty index d496ec76abd..ced8e9a5a70 100644 --- a/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty +++ b/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty @@ -7,7 +7,7 @@ %% datetime2.dtx (with options: `datetime2-calc.sty,package') %% %% datetime2.dtx -%% Copyright 2015 Nicola Talbot +%% Copyright 2016 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datetime2-calc}[2015/11/10 v1.2 (NLCT)] +\ProvidesPackage{datetime2-calc}[2016/01/22 v1.3 (NLCT)] \RequirePackage{pgfkeys} \RequirePackage{pgfcalendar} \newcount\@dtm@julianday @@ -223,6 +223,245 @@ \csdef{@dtm@#1@TZhour}{0}% \csdef{@dtm@#1@TZminute}{0}% } +\newcommand*{\dtm@ifdianameexists}[3]{% + \IfTrackedDialect{\languagename}% + {% + \ifcsdef{DTM\TrackedLanguageFromDialect{\languagename}#1}% + {#2}% + {#3}% + }% + {#3}% +} +\newrobustcmd{\DTMmonthname}[1]{% + \ifcsdef{DTM\languagename monthname}% + {% + \csuse{DTM\languagename monthname}{#1}% + }% + {% + \dtm@ifdianameexists{monthname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}monthname}{#1}% + }% + {% + \dtmnamewarning{\DTMmonthname}% + \pgfcalendarmonthname{#1}% + }% + }% +} +\newrobustcmd{\DTMMonthname}[1]{% + \ifcsdef{DTM\languagename Monthname}% + {% + \csuse{DTM\languagename Monthname}{#1}% + }% + {% + \dtm@ifdianameexists{Monthname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}Monthname}{#1}% + }% + {% + \ifcsdef{DTM\languagename monthname}% + {% + \csuse{DTM\languagename monthname}{#1}% + }% + {% + \dtm@ifdianameexists{monthname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}monthname}{#1}% + }% + {% + \dtmnamewarning{\DTMMonthname}% + \ifdef\emakefirstuc + {% + \emakefirstuc{\pgfcalendarmonthname{#1}}% + }% + {% + \protected@edef\dtm@tmp@monthname{\pgfcalendarmonthname{#1}}% + \expandafter\MakeUppercase\dtm@tmp@monthname + }% + }% + }% + }% + }% +} +\newrobustcmd{\DTMshortmonthname}[1]{% + \ifcsdef{DTM\languagename shortmonthname}% + {% + \csuse{DTM\languagename shortmonthname}{#1}% + }% + {% + \dtm@ifdianameexists{shortmonthname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}shortmonthname}{#1}% + }% + {% + \dtmnamewarning{\DTMshortmonthname}% + \pgfcalendarmonthshortname{#1}% + }% + }% +} +\newrobustcmd{\DTMshortMonthname}[1]{% + \ifcsdef{DTM\languagename shortMonthname}% + {% + \csuse{DTM\languagename shortMonthname}{#1}% + }% + {% + \dtm@ifdianameexists{shortMonthname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}shortMonthname}{#1}% + }% + {% + \ifcsdef{DTM\languagename shortmonthname}% + {% + \csuse{DTM\languagename shortmonthname}{#1}% + }% + {% + \dtm@ifdianameexists{shortmonthname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}shortmonthname}% + {#1}% + }% + {% + \dtmnamewarning{\DTMshortMonthname}% + \ifdef\emakefirstuc + {% + \emakefirstuc{\pgfcalendarmonthshortname{#1}}% + }% + {% + \protected@edef\dtm@tmp@monthname{\pgfcalendarmonthshortname{#1}}% + \expandafter\MakeUppercase\dtm@tmp@monthname + }% + }% + }% + }% + }% +} +\newrobustcmd{\DTMweekdayname}[1]{% + \ifcsdef{DTM\languagename weekdayname}% + {% + \csuse{DTM\languagename weekdayname}{#1}% + }% + {% + \dtm@ifdianameexists{weekdayname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}weekdayname}{#1}% + }% + {% + \dtmnamewarning{\DTMweekdayname}% + \pgfcalendarweekdayname{#1}% + }% + }% +} +\newrobustcmd{\DTMWeekdayname}[1]{% + \ifcsdef{DTM\languagename Weekdayname}% + {% + \csuse{DTM\languagename Weekdayname}{#1}% + }% + {% + \dtm@ifdianameexists{Weekdayname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}Weekdayname}{#1}% + }% + {% + \ifcsdef{DTM\languagename weekdayname}% + {% + \csuse{DTM\languagename weekdayname}{#1}% + }% + {% + \dtm@ifdianameexists{weekdayname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}weekdayname}{#1}% + }% + {% + \dtmnamewarning{\DTMWeekdayname}% + \ifdef\emakefirstuc + {% + \emakefirstuc{\pgfcalendarweekdayname{#1}}% + }% + {% + \protected@edef\dtm@tmp@weekdayname{\pgfcalendarweekdayname{#1}}% + \expandafter\MakeUppercase\dtm@tmp@weekdayname + }% + }% + }% + }% + }% +} +\newrobustcmd{\DTMshortweekdayname}[1]{% + \ifcsdef{DTM\languagename shortweekdayname}% + {% + \csuse{DTM\languagename shortweekdayname}{#1}% + }% + {% + \dtm@ifdianameexists{shortweekdayname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}shortweekdayname}{#1}% + }% + {% + \dtmnamewarning{\DTMshortweekdayname}% + \pgfcalendarweekdayshortname{#1}% + }% + }% +} +\newrobustcmd{\DTMshortWeekdayname}[1]{% + \ifcsdef{DTM\languagename shortWeekdayname}% + {% + \csuse{DTM\languagename shortWeekdayname}{#1}% + }% + {% + \dtm@ifdianameexists{shortWeekdayname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}shortWeekdayname}{#1}% + }% + {% + \ifcsdef{DTM\languagename shortweekdayname}% + {% + \csuse{DTM\languagename shortweekdayname}{#1}% + }% + {% + \dtm@ifdianameexists{shortweekdayname}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}shortweekdayname}% + {#1}% + }% + {% + \dtmnamewarning{\DTMshortWeekdayname}% + \ifdef\emakefirstuc + {% + \emakefirstuc{\pgfcalendarweekdayshortname{#1}}% + }% + {% + \protected@edef\dtm@tmp@weekdayname{% + \pgfcalendarweekdayshortname{#1}}% + \expandafter\MakeUppercase\dtm@tmp@weekdayname + }% + }% + }% + }% + }% +} +\newrobustcmd{\DTMordinal}[1]{% + \ifcsdef{DTM\languagename ordinal}% + {% + \csuse{DTM\languagename ordinal}{#1}% + }% + {% + \dtm@ifdianameexists{ordinal}% + {% + \csuse{DTM\TrackedLanguageFromDialect{\languagename}ordinal}{#1}% + }% + {% + \number#1 + }% + }% +} +\newcommand*{\dtmnamewarning}[1]{% + \if@dtm@warn + \PackageWarning{datetime2-calc}% + {Can't find underlying language macro for \MessageBreak + \string#1\space(language: \languagename); \MessageBreak + using pgfcalendar macro instead}% + \fi +} \endinput %% %% End of file `datetime2-calc.sty'. diff --git a/Master/texmf-dist/tex/latex/datetime2/datetime2.sty b/Master/texmf-dist/tex/latex/datetime2/datetime2.sty index 8f99dc1e594..4f11b935716 100644 --- a/Master/texmf-dist/tex/latex/datetime2/datetime2.sty +++ b/Master/texmf-dist/tex/latex/datetime2/datetime2.sty @@ -7,7 +7,7 @@ %% datetime2.dtx (with options: `datetime2.sty,package') %% %% datetime2.dtx -%% Copyright 2015 Nicola Talbot +%% Copyright 2016 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datetime2}[2015/11/10 v1.2 (NLCT) date and time formats] +\ProvidesPackage{datetime2}[2016/01/22 v1.3 (NLCT) date and time formats] \RequirePackage{tracklang} \RequirePackage{etoolbox} \RequirePackage{xkeyval}[2006/11/18] @@ -152,8 +152,19 @@ }% } \DeclareOptionX*{% - \TrackPredefinedDialect{\CurrentOption}% - \renewcommand*{\DTMifcaseregional}[3]{#2}% + \ifcsundef{@tracklang@add@\CurrentOption}% + {% + \PackageError{datetime2}{`\CurrentOption' is not a recognised dialect. + \MessageBreak Perhaps you have misspelt it or the + \MessageBreak named dialect may be unsupported or + \MessageBreak perhaps you forgot to use the `style' key}% + {Any options that aren't described in the manual are assumed + \MessageBreak to be language or dialect names.}% + }% + {% + \TrackPredefinedDialect{\CurrentOption}% + \renewcommand*{\DTMifcaseregional}[3]{#2}% + }% } \ProcessOptionsX \disable@keys{datetime2.sty}{calc} @@ -1085,6 +1096,57 @@ \renewcommand*{\DTMDisplay}{\DTMdisplay}% } \DTMnewstyle + {ddmmyy}%label + {% date style + \renewcommand*\DTMdisplaydate[4]{% + \DTMtwodigits{##3}\DTMsep{monthday}% + \DTMtwodigits{##2}\DTMsep{yearmonth}% + \DTMtwodigits{##1}% + }% + \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% + }% + {% time style + \renewcommand*\DTMdisplaytime[3]{% + \DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% + \ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi + }% + }% + {% zone style + \renewcommand*{\DTMdisplayzone}[2]{% + \ifboolexpe + { bool{DTMshowisoZ} + and test{\ifnumequal{##1}{0}} + and test{\ifnumequal{##2}{0}} + }% + {% + Z% + }% + {% + \ifnum##1<0\else+\fi\DTMtwodigits{##1}% + \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi + }% + }% + }% + {% full style + \renewcommand*{\DTMdisplay}[9]{% + \ifDTMshowdate + \DTMdisplaydate{##1}{##2}{##3}{##4}% + \DTMsep{datetime}% + \fi + \DTMdisplaytime + {##5}% + {##6}% + {##7}% + \ifDTMshowzone + \DTMsep{timezone}% + \DTMdisplayzone + {##8}% + {##9}% + \fi + }% + \renewcommand*{\DTMDisplay}{\DTMdisplay}% + } +\DTMnewstyle {mmddyyyy}%label {% date style \renewcommand*\DTMdisplaydate[4]{% @@ -1241,6 +1303,57 @@ }% \renewcommand*{\DTMDisplay}{\DTMdisplay}% } +\DTMnewstyle + {mmddyy}%label + {% date style + \renewcommand*\DTMdisplaydate[4]{% + \DTMtwodigits{##2}\DTMsep{monthday}% + \DTMtwodigits{##3}\DTMsep{dayyear}% + \DTMtwodigits{##1}% + }% + \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% + }% + {% time style + \renewcommand*\DTMdisplaytime[3]{% + \DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% + \ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi + }% + }% + {% zone style + \renewcommand*{\DTMdisplayzone}[2]{% + \ifboolexpe + { bool{DTMshowisoZ} + and test{\ifnumequal{##1}{0}} + and test{\ifnumequal{##2}{0}} + }% + {% + Z% + }% + {% + \ifnum##1<0\else+\fi\DTMtwodigits{##1}% + \ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi + }% + }% + }% + {% full style + \renewcommand*{\DTMdisplay}[9]{% + \ifDTMshowdate + \DTMdisplaydate{##1}{##2}{##3}{##4}% + \DTMsep{datetime}% + \fi + \DTMdisplaytime + {##5}% + {##6}% + {##7}% + \ifDTMshowzone + \DTMsep{timezone}% + \DTMdisplayzone + {##8}% + {##9}% + \fi + }% + \renewcommand*{\DTMDisplay}{\DTMdisplay}% + } \DTMnewtimestyle {hmmss}% label {% @@ -1474,19 +1587,55 @@ {% \edef\@dtm@loadedregions{\@dtm@loadedregions,#1}% }% + \csedef{@dtm@moddialectmap@#1}{\CurrentTrackedDialect}% }% - {}% + {% + \ifcsdef{date\CurrentTrackedDialect} + {% + \letcs{\@dtm@otherdialect}{@dtm@moddialectmap@#1}% + \edef\@dtm@thisdialect{\CurrentTrackedDialect}% + \ifdefequal\@dtm@thisdialect\@dtm@otherdialect + {}% + {% + \ifcsdef{date\@dtm@otherdialect}% + {% + \csletcs{date\@dtm@thisdialect}{date\@dtm@otherdialect}% + }% + {}% + }% + }% + {}% + }% + \csedef{@dtm@dialectmodmap@\CurrentTrackedDialect}{#1}% }% } +\newcommand*{\DTMdialecttomodulemap}[1]{% + \ifcsdef{ver@datetime2-#1.ldf}% + {#1}% + {\csname @dtm@dialectmodmap@#1\endcsname}% +} \newcommand*{\ProvidesDateTimeModule}[1]{% \ProvidesFile{datetime2-#1.ldf}% } +\newcommand*{\DTMusemodule}[2]{% + \ifcsdef{@tracklang@add@#1}% + {% + \TrackPredefinedDialect{#1}% + }% + {}% + \let\@dtm@org@dialect\CurrentTrackedDialect + \def\CurrentTrackedDialect{#1}% + \RequireDateTimeModule{#2}% + \let\CurrentTrackedDialect\@dtm@org@dialect +} \newcommand*{\DTMdefkey}[1]{\define@key[dtm]{#1}} \newcommand*{\DTMdefchoicekey}[1]{\define@choicekey[dtm]{#1}} \newcommand*{\DTMdefboolkey}[1]{\define@boolkey[dtm]{#1}} \newcommand*{\DTMifbool}[4]{\ifbool{dtm@#1@#2}{#3}{#4}} \newcommand*{\DTMsetbool}[3]{\setbool{dtm@#1@#2}{#3}} -\newcommand*{\DTMlangsetup}[2][\@dtm@loadedregions]{% +\newcommand*{\DTMlangsetup}{% + \@ifstar\s@DTMlangsetup\@DTMlangsetup} +\newcommand*{\@DTMlangsetup}[2][\@dtm@loadedregions]{% \@for\@dtm@region:=#1\do{% \setkeys*+[dtm]{\@dtm@region}{#2}% \ifdefempty\XKV@rm{}% @@ -1498,6 +1647,11 @@ }% }% } +\newcommand*{\s@DTMlangsetup}[2][\@dtm@loadedregions]{% + \@for\@dtm@region:=#1\do{% + \setkeys*+[dtm]{\@dtm@region}{#2}% + }% +} \AnyTrackedLanguages {% \ForEachTrackedDialect{\this@dialect}% |