diff options
author | Karl Berry <karl@freefriends.org> | 2016-02-12 00:20:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-02-12 00:20:54 +0000 |
commit | 057df000f18ca5aa989a2a547c00fe2507f5613d (patch) | |
tree | f71059a9c8dd70b53755305d69a16dc78bfa0b2a /Master/texmf-dist | |
parent | 6bcb84eaba2cfe1aaef9252456172d47286958ed (diff) |
datetime2 (11feb16)
git-svn-id: svn://tug.org/texlive/trunk@39675 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
14 files changed, 303 insertions, 22 deletions
diff --git a/Master/texmf-dist/doc/latex/datetime2/CHANGES b/Master/texmf-dist/doc/latex/datetime2/CHANGES index 5c66deccc67..408b3ac5b5d 100644 --- a/Master/texmf-dist/doc/latex/datetime2/CHANGES +++ b/Master/texmf-dist/doc/latex/datetime2/CHANGES @@ -1,3 +1,18 @@ +1.4 (2016-02-11) : + + * datetime2-calc.sty: + + - new command \DTMcomputedayofweekindex + + * datetime2.sty: + + - new commands \DTMtoday and \DTMToday. + \today and \Today are now \let to them, respectively. + + - added check for scrlttr2. + + * Added extra sample file datetime2-sample-journal.tex + 1.3 (2016-01-22) : * datetime2.sty: diff --git a/Master/texmf-dist/doc/latex/datetime2/README b/Master/texmf-dist/doc/latex/datetime2/README index 275a604a457..eca11c74cca 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.3 +LaTeX Package : datetime2 v1.4 -Last Modified : 2016-01-22 +Last Modified : 2016-02-11 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 a665d5d24bb..ac93b840459 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 37fd783acb3..845c271bb64 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 a425777c94b..0743c36da31 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 711982016ca..4c8eab73628 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 1e4879d3163..21efd33fbe3 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-journal.pdf b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-journal.pdf Binary files differnew file mode 100644 index 00000000000..0dedb3a78e8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-journal.pdf diff --git a/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-journal.tex b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-journal.tex new file mode 100644 index 00000000000..26aa64535e7 --- /dev/null +++ b/Master/texmf-dist/doc/latex/datetime2/samples/datetime2-sample-journal.tex @@ -0,0 +1,127 @@ +% arara: pdflatex +% arara: pdflatex +\documentclass{memoir} + +\usepackage[en-GB,showdow]{datetime2} + +\usepackage{lipsum}% dummy text +\usepackage[hidelinks]{hyperref} + +\newcommand*{\numdash}{\texorpdfstring{\,--\,}{--}} + +% \DTMmonthname is robust and can't be used in the bookmarks +% or headings so use \DTMenglishmonthname since this +% document is in English. +\newcommand*{\entrymonth}[2]{\DTMenglishmonthname{#2} #1} + +% A range of dates. +% Syntax: \daterange{yyyy1}{mm1}{dd1}{yyyy2}{mm2}{dd2} +\newcommand*{\daterange}[6]{% + \ifnum#1=#4 +% Same year + \ifnum#2=#5 +% Same month + \ifnum#3=#6 +% Same day - not a range! + \DTMdisplaydate{#1}{#2}{#3}% + \else +% Range within the same month. +% This needs to be done explicitly but match the separators +% with the en-GB style. + \DTMenglishordinal{#3}\numdash\DTMenglishordinal{#6}% + \DTMenGBdaymonthsep + \DTMenglishmonthname{#2}% + \DTMenGBmonthyearsep\number#1 + \fi + \else +% Not the same month + \DTMdisplaydate{#1}{#2}{#3}{-1}\numdash\DTMdisplaydate{#4}{#5}{#6}{-1}% + \fi + \else +% Not same year + \DTMdisplaydate{#1}{#2}{#3}{-1}\numdash\DTMdisplaydate{#4}{#5}{#6}{-1}% + \fi +} + +% range of months +% Syntax: \monthspan{yyyy1}{mm1}{yyyy2}{mm2} +\newcommand*{\monthspan}[4]{% + \ifnum#1=#3 +% Same year + \DTMenglishmonthname{#2}\numdash\DTMenglishmonthname{#4}% + \DTMenGBmonthyearsep\number#1 + \else +% Not the same year + \DTMenglishmonthname{#2}% + \DTMenGBmonthyearsep\number#1 + \numdash\DTMenglishmonthname{#4}% + \DTMenGBmonthyearsep\number#3 + \fi +} + +\newcommand*{\entrydate}[3]{\DTMdisplaydate{#1}{#2}{#3}{-1}} +\newcommand*{\titleentrydate}[3]{\DTMdate{#1-#2-#3}} + +\renewcommand*{\printchaptertitle}[1]{% + {% + \let\entrydate\titleentrydate + \chaptitlefont{#1}% + }% +} + +\setsecheadstyle{\let\entrydate\titleentrydate + \Large\bfseries\memRTLraggedright} + +\begin{document} + +\frontmatter +\tableofcontents + +\mainmatter +\chapter{Introduction} + +This is a test document that illustrates the use of dates within +chapter titles. + +\section{Sample} + +An example section. + +\chapter{\entrymonth{2016}{01}} + +\lipsum + +\section{\entrydate{2016}{01}{01}} + +\lipsum[1-10] + +\section{\entrydate{2016}{01}{02}} + +\lipsum + +\section{\daterange{2016}{01}{04}{2016}{01}{12}} + +\lipsum[1-3] + +\chapter{\entrydate{2016}{02}{03}} + +\lipsum + +\chapter{\monthspan{2016}{02}{2016}{03}} + +\lipsum + +\section{\daterange{2016}{02}{04}{2016}{03}{01}} + +\lipsum + +\chapter{\monthspan{2015}{12}{2016}{01}} + +\lipsum + +\section{\daterange{2015}{12}{20}{2016}{01}{01}} + +\lipsum + + +\end{document} 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 d9e46899419..90c9464e440 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 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 diff --git a/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty b/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty index ced8e9a5a70..4beb8e0c841 100644 --- a/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty +++ b/Master/texmf-dist/tex/latex/datetime2/datetime2-calc.sty @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datetime2-calc}[2016/01/22 v1.3 (NLCT)] +\ProvidesPackage{datetime2-calc}[2016/02/11 v1.4 (NLCT)] \RequirePackage{pgfkeys} \RequirePackage{pgfcalendar} \newcount\@dtm@julianday @@ -335,6 +335,11 @@ }% }% } +\newrobustcmd*{\DTMcomputedayofweekindex}[2]{% + \pgfcalendardatetojulian{#1}{\@dtm@julianday}% + \pgfcalendarjuliantoweekday{\@dtm@julianday}{\count@}% + \edef#2{\number\count@}% +} \newrobustcmd{\DTMweekdayname}[1]{% \ifcsdef{DTM\languagename weekdayname}% {% diff --git a/Master/texmf-dist/tex/latex/datetime2/datetime2.sty b/Master/texmf-dist/tex/latex/datetime2/datetime2.sty index 4f11b935716..525675ebf6b 100644 --- a/Master/texmf-dist/tex/latex/datetime2/datetime2.sty +++ b/Master/texmf-dist/tex/latex/datetime2/datetime2.sty @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datetime2}[2016/01/22 v1.3 (NLCT) date and time formats] +\ProvidesPackage{datetime2}[2016/02/11 v1.4 (NLCT) date and time formats] \RequirePackage{tracklang} \RequirePackage{etoolbox} \RequirePackage{xkeyval}[2006/11/18] @@ -376,20 +376,23 @@ \renewcommand\@dtm@currenttimezonehour{#1}% \renewcommand\@dtm@currenttimezoneminute{#2}% } -\renewcommand*{\today}{% +\newcommand*{\DTMtoday}{% \DTMdisplaydate {\@dtm@currentyear}% {\@dtm@currentmonth}% {\@dtm@currentday}% {\@dtm@currentdow}% } -\newcommand*{\Today}{% +\let\today\DTMtoday +\@ifclassloaded{scrlttr2}{\AtBeginDocument{\let\today\DTMtoday}}{} +\newcommand*{\DTMToday}{% \DTMDisplaydate {\@dtm@currentyear}% {\@dtm@currentmonth}% {\@dtm@currentday}% {\@dtm@currentdow}% } +\let\Today\DTMToday \newcommand*\DTMdisplaydate[4]{% \number#1\dtm@yearmonthsep\DTMtwodigits{#2}\dtm@monthdaysep\DTMtwodigits{#3}% }% |