summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/datetime2
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-02-12 00:20:54 +0000
committerKarl Berry <karl@freefriends.org>2016-02-12 00:20:54 +0000
commit057df000f18ca5aa989a2a547c00fe2507f5613d (patch)
treef71059a9c8dd70b53755305d69a16dc78bfa0b2a /Master/texmf-dist/source/latex/datetime2
parent6bcb84eaba2cfe1aaef9252456172d47286958ed (diff)
datetime2 (11feb16)
git-svn-id: svn://tug.org/texlive/trunk@39675 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/datetime2')
-rw-r--r--Master/texmf-dist/source/latex/datetime2/datetime2.dtx161
-rw-r--r--Master/texmf-dist/source/latex/datetime2/datetime2.ins2
2 files changed, 147 insertions, 16 deletions
diff --git a/Master/texmf-dist/source/latex/datetime2/datetime2.dtx b/Master/texmf-dist/source/latex/datetime2/datetime2.dtx
index af2c3e8fc7d..6cb24135673 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:
-% -author "Nicola Talbot"
% -section "chapter"
+% -author "Nicola Talbot"
+% -doc "datetime2-manual.tex"
% -src "datetime2.sty\Z=>datetime2.sty"
% -src "datetime2-calc.sty\Z=>datetime2-calc.sty"
-% -doc "datetime2-manual.tex"
% datetime2
-% Created on 2016/1/22 15:29
+% Created on 2016/2/11 12:54
%\fi
%\iffalse
%<*package>
@@ -48,7 +48,7 @@
pdftitle={datetime2: date and time formats}]{hyperref}
-\CheckSum{2343}
+\CheckSum{2364}
\RecordChanges
\DisableCrossrefs
@@ -92,11 +92,11 @@
%
%\MakeShortVerb{"}
%
-%\title{datetime2 v1.3:
+%\title{datetime2 v1.4:
%date and time formats}
%\author{Nicola L. C. Talbot\\\url{http://www.dickimaw-books.com/}}
%
-%\date{2016-01-22}
+%\date{2016-02-11}
%\maketitle
%
%\begin{abstract}
@@ -302,14 +302,18 @@
%\begin{important}
%You need to check the documentation for the relevant language module
%or package to find out which styles check
-%the \pkgopt{showdow} setting as not all of them do.
+%the \pkgopt{showdow} setting as not all of them do. For example, the
+%\module[english]{datetime2-english module} documentation indicates
+%which of the English date styles support this setting.
+%(The \styfmt{datetime} package had a similar limitation with its
+%\pkgoptfmt{dayofweek} package option.)
%\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}
+%\cs{DTMusemodule}\marg{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}
@@ -384,6 +388,53 @@
%it correctly.
%\end{important}
%
+%If you want the \meta{dow} value automatically calculated from the date,
+%you can use \cs{DTMdate} (described below) instead with the
+%\pkgopt{showdow} package option. Note that \cs{DTMdate} is
+%\emph{robust}. If you require an expandable alternative, the
+%\meta{dow} value must be calculated first. The simplest way to do
+%this is to first save the date and then use it (see
+%\sectionref{sec:store}).
+%
+%Examples (with the \pkgopt{showdow} package option set):
+%\begin{itemize}
+%\item Ignore day of week:
+%\begin{verbatim}
+%\section{\DTMdisplaydate{2016}{2}{10}{-1}}
+%\end{verbatim}
+%This overrides the \pkgopt{showdow} option in this specific
+%instance.
+%
+%\item Save the date first and then use it:
+%\begin{verbatim}
+%\DTMsavedate{mydate}{2016-02-10}
+%\section{\DTMusedate{mydate}}
+%\end{verbatim}
+%(See \sectionref{sec:store}.)
+%
+%\item Another expandable alternative (but less convenient and more
+%prone to error since the date has to be repeated):
+%\begin{verbatim}
+%\DTMcomputedayofweekindex{2016-02-10}{\dowindex}
+%\section{\DTMdisplaydate{2016}{2}{10}{\dowindex}}
+%\end{verbatim}
+%(See \sectionref{sec:calc}.)
+%
+%\item Robust version won't work in PDF bookmarks or case-changing
+%contexts (such as page headers):
+%\begin{verbatim}
+%\section{\DTMdate{2016-02-10}}
+%\end{verbatim}
+%Note that if there is a table of contents, this will mean that the
+%day of week index has to be calculated \emph{twice}. Once in the
+%table of contents and once in the actual section title. If the
+%section title is also used in the page header, then the day of week
+%index will additionally be calculated on every page that has this
+%section title in the header.
+%\end{itemize}
+%(See the accompanying \texttt{datetime2-sample-journal.tex} sample
+%file for more examples of using dates in section titles.)
+%
%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
@@ -401,6 +452,10 @@
%recommend the use of the commands provided by the \sty{mfirstuc}
%package as they're not expandable.)
%
+%If you want the \meta{dow} value automatically calculated from the date,
+%you can use \cs{DTMDate} (described below) instead with the
+%\pkgopt{showdow} package option.
+%
%The current date is displayed using
%\begin{definition}[\DescribeMacro\today]
%\cs{today}
@@ -412,6 +467,29 @@
%\cs{Today}
%\end{definition}
%
+%Since there are other classes and packages that redefine \cs{today},
+%as from version 1.4, the \styfmt{datetime2} package provides
+%\begin{definition}[\DescribeMacro\DTMtoday]
+%\cs{DTMtoday}
+%\end{definition}
+%and
+%\begin{definition}[\DescribeMacro\DTMToday]
+%\cs{DTMToday}
+%\end{definition}
+%The package now assigns \cs{today} and \cs{Today} to \cs{DTMtoday}
+%and \cs{DTMToday}, respectively. If your document loads another
+%package or class that modifies \cs{today} at the beginning of the
+%document, you can switch it back to \styfmt{datetime2}'s definition
+%using
+%\begin{verbatim}
+%\let\today\DTMtoday
+%\end{verbatim}
+%after the start of the document or use the \cs{AtBeginDocument}
+%hook:
+%\begin{verbatim}
+%\AtBeginDocument{\let\today\DTMtoday}
+%\end{verbatim}
+%
%\begin{important}
%If you use \sty{babel} or \sty{polyglossia} you must make sure
%you have the relevant \styfmt{datetime2} language modules installed.
@@ -2654,7 +2732,16 @@
%\end{definition}
%
%There are also analogous commands for the weekday names, where
-%\meta{n} is an integer from 0 (Monday) to 6 (Sunday).
+%\meta{n} is an integer from 0 (Monday) to 6 (Sunday). This index can
+%be computed using:
+%\begin{definition}[\DescribeMacro\DTMcomputedayofweekindex]
+%\cs{DTMcomputedayofweekindex}\marg{date}\marg{cs}
+%\end{definition}
+%where \meta{date} is in the form \meta{YYYY}-\meta{MM}-\meta{DD} and
+%\meta{cs} is a control sequence in which to store the result.
+%Remember that date styles automatically access the day of week index
+%from the fourth argument of \cs{DTMdisplaydate}, so this command
+%shouldn't be used within a date style.
%
%\begin{definition}[\DescribeMacro\DTMweekdayname]
%\cs{DTMweekdayname}\marg{n}
@@ -5462,7 +5549,7 @@
%\changes{1.0}{2015-03-24}{Initial release}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datetime2}[2016/01/22 v1.3 (NLCT) date and time formats]
+\ProvidesPackage{datetime2}[2016/02/11 v1.4 (NLCT) date and time formats]
% \end{macrocode}
% Use \sty{tracklang} to find out what languages have been loaded.
% \begin{macrocode}
@@ -6154,9 +6241,12 @@
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\today}
+%\begin{macro}{\DTMtoday}
+%\changes{2016-02-11}{1.4}{new}
+% Provided in case of conflict to obtain \styfmt{datetime2}'s
+% version of \cs{today}.
% \begin{macrocode}
-\renewcommand*{\today}{%
+\newcommand*{\DTMtoday}{%
\DTMdisplaydate
{\@dtm@currentyear}%
{\@dtm@currentmonth}%
@@ -6166,10 +6256,28 @@
% \end{macrocode}
%\end{macro}
%
-%\begin{macro}{\Today}
+%\begin{macro}{\today}
+%\changes{2016-02-11}{1.4}{no longer using \cs{renewcommand}}
+% Version 1.4 dropped \cs{renewcommand} in case
+% \cs{today} hasn't already been defined.
+% \begin{macrocode}
+\let\today\DTMtoday
+% \end{macrocode}
+%\end{macro}
+%
+% The \cls{scrlttr2} class redefines \cs{today} at the start of the
+% document, so check for this.
+% \begin{macrocode}
+\@ifclassloaded{scrlttr2}{\AtBeginDocument{\let\today\DTMtoday}}{}
+% \end{macrocode}
+%
+%\begin{macro}{\DTMToday}
% First letter upper case version.
+%\changes{2016-02-11}{1.4}{new}
+% Added to v1.4 to provide \sty{datetime2}'s version in case of
+% conflict.
% \begin{macrocode}
-\newcommand*{\Today}{%
+\newcommand*{\DTMToday}{%
\DTMDisplaydate
{\@dtm@currentyear}%
{\@dtm@currentmonth}%
@@ -6179,6 +6287,12 @@
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\Today}
+% \begin{macrocode}
+\let\Today\DTMToday
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\DTMdisplaydate}
%\begin{definition}
%\cs{DTMdisplaydate}\marg{year}\marg{month}\marg{day}\marg{day of
@@ -8192,7 +8306,7 @@
%\section{datetime2-calc.sty code}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datetime2-calc}[2016/01/22 v1.3 (NLCT)]
+\ProvidesPackage{datetime2-calc}[2016/02/11 v1.4 (NLCT)]
% \end{macrocode}
% Load other required packages
% \begin{macrocode}
@@ -8741,6 +8855,23 @@
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\DTMcomputedayofweekindex}
+%\begin{definition}
+%\cs{DTMcomputedayofweekindex}\marg{date}\marg{cs}
+%\end{definition}
+% This is for standalone use and shouldn't be used in any date
+% styles (since the day of week index is already supplied).
+% The result is stored in the supplied control sequence.
+%\changes{2016-02-11}{1.4}{new}
+% \begin{macrocode}
+\newrobustcmd*{\DTMcomputedayofweekindex}[2]{%
+ \pgfcalendardatetojulian{#1}{\@dtm@julianday}%
+ \pgfcalendarjuliantoweekday{\@dtm@julianday}{\count@}%
+ \edef#2{\number\count@}%
+}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\DTMweekdayname}
%\changes{1.3}{2016-01-22}{new}
% \begin{macrocode}
diff --git a/Master/texmf-dist/source/latex/datetime2/datetime2.ins b/Master/texmf-dist/source/latex/datetime2/datetime2.ins
index 0336702b8f0..6173c6ca026 100644
--- a/Master/texmf-dist/source/latex/datetime2/datetime2.ins
+++ b/Master/texmf-dist/source/latex/datetime2/datetime2.ins
@@ -1,4 +1,4 @@
-% datetime2.ins generated using makedtx version 1.1 2016/1/22 15:29
+% datetime2.ins generated using makedtx version 1.1 2016/2/11 12:54
\input docstrip
\preamble