%\iffalse %<*package> %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z %% Digits \0\1\2\3\4\5\6\7\8\9 %% Exclamation \! Double quote \" Hash (number) \# %% Dollar \$ Percent \% Ampersand \& %% Acute accent \' Left paren \( Right paren \) %% Asterisk \* Plus \+ Comma \, %% Minus \- Point \. Solidus \/ %% Colon \: Semicolon \; Less than \< %% Equals \= Greater than \> Question mark \? %% Commercial at \@ Left bracket \[ Backslash \\ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} % %\fi % \iffalse % Doc-Source file to use with LaTeX2e % Copyright (C) 2015 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> \documentclass{ltxdoc} \usepackage{alltt} \usepackage{graphicx} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{datetime2-en-fulltext} \usepackage[colorlinks, bookmarks, hyperindex=false, pdfauthor={Nicola L.C. Talbot}, pdftitle={datetime2-en-fulltext.sty: English Full Text Date and Time Styles}]{hyperref} \CheckSum{649} \renewcommand*{\usage}[1]{\hyperpage{#1}} \renewcommand*{\main}[1]{\hyperpage{#1}} \IndexPrologue{\section*{\indexname}\markboth{\indexname}{\indexname}} \setcounter{IndexColumns}{2} \newcommand*{\sty}[1]{\textsf{#1}} \newcommand*{\opt}[1]{\texttt{#1}\index{#1=\texttt{#1}|main}} \RecordChanges \PageIndex \CodelineNumbered \begin{document} \DocInput{datetime2-en-fulltext.dtx} \end{document} % %\fi % %\MakeShortVerb{"} % %\title{datetime2-en-fulltext.sty: English Full Text Date and Time %Styles} %\author{Nicola L. C. Talbot} %\date{2014-04-01 (v1.0)} %\maketitle % %\begin{abstract} %This is a supplementary package that provides English full text date and %time styles for the datetime2.sty package. These styles are %analogous to the styles provided by the old \sty{datetime}'s %\cs{textdate} and \cs{oclock}. \textbf{These styles are not %expandable styles.} This means that you can't use them in PDF %bookmarks nor can you use them in case-changing commands such as %\cs{MakeUppercase}. %\end{abstract} % %\section{Introduction} % %This package loads the \sty{datetime2} package and the %"english-base" language module, if not already loaded, and provides the %date styles: %\begin{description} %\item[en-fulltext] Produces the date in the style: %\DTMsetdatestyle{en-fulltext}\today. (Lower case ordinal and number %words.) Commands such as \cs{Today} will start with a capital. For %example: \Today. %\item[en-FullText] Produces the date in the style: %\DTMsetdatestyle{en-FullText}\today. (Title Case.) %\item[en-FULLTEXT] Produces the date in the style: %\DTMsetdatestyle{en-FULLTEXT}\today. (All caps.) %\end{description} %These styles honour the \opt{showdow} setting. Example: %\begin{verbatim} %\documentclass{article} %\usepackage[showdow]{datetime2-en-fulltext} %\begin{document} %Date: \today. %\end{document} %\end{verbatim} %The separator between the month and year is given by %\cs{DTMenfulltextmonthyearsep} which may be redefined using %\cs{renewcommand}. % %The \sty{datetime2-en-fulltext} package automatically switches on %the "en-fulltext" date style. You can switch the style using %\cs{DTMsetdatestyle}. For example: %\begin{verbatim} %\DTMsetdatestyle{en-FullText} %\end{verbatim} % %This package also provides the time styles: %\begin{description} %\item[en-fulltext] Produces the time in the style: %\DTMsettimestyle{en-fulltext}\DTMcurrenttime. (Lower case.) % %\item[en-Fulltext] Produces the time in the style: %\DTMsettimestyle{en-Fulltext}\DTMcurrenttime. (Initial capital.) % %\item[en-FullText] Produces the time in the style: %\DTMsettimestyle{en-FullText}\DTMcurrenttime. (Title Case.) % %\item[en-FULLTEXT] Produces the time in the style: %\DTMsettimestyle{en-FULLTEXT}\DTMcurrenttime. (All caps.) % %\end{description} % %The \sty{datetime2-en-fulltext} package automatically switches on %the "en-fulltext" time style. You can switch the style using %\cs{DTMsettimestyle}. For example: %\begin{verbatim} %\DTMsettimestyle{en-FullText} %\end{verbatim} % %Note that if you use \sty{polyglossia} or \sty{babel} and you don't %have \sty{datetime2}'s \opt{useregional} setting set to "false", %then the regional styles will override the styles provided here. % %\StopEventually{% %\clearpage %\phantomsection %\addcontentsline{toc}{section}{Change History}% %\PrintChanges %\addcontentsline{toc}{section}{\indexname}% %\PrintIndex} %\section{The Code} % %\changes{1.0}{2015-04-01}{Initial release} %\iffalse % \begin{macrocode} %<*datetime2-en-fulltext.sty> % \end{macrocode} %\fi %Identify package % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{datetime2-en-fulltext}[2015/04/01 v1.0] % \end{macrocode} % Pass all options to \sty{datetime2}: % \begin{macrocode} \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{datetime2}} \ProcessOptions % \end{macrocode} % Requires \sty{datetime2}: % \begin{macrocode} \RequirePackage{datetime2} % \end{macrocode} % Also requries \sty{fmtcount}: % \begin{macrocode} \RequirePackage{fmtcount} % \end{macrocode} % If the "english-base" language module hasn't been loaded, load it now. % \begin{macrocode} \def\CurrentTrackedDialect{english} \RequireDateTimeModule{english-base} \undef\CurrentTrackedDialect % \end{macrocode} % Define the "en-fulltext" date style: % \begin{macrocode} \DTMnewdatestyle{en-fulltext}{% \renewcommand*\DTMdisplaydate[4]{% \ifDTMshowdow \ifnum##4>-1 \DTMenglishweekdayname{##4} the\space \fi \fi \protect\ordinalstringnum{##3} of \DTMenglishmonthname{##2}% \DTMenfulltextmonthyearsep \protect\numberstringnum{##1}% }% \renewcommand*\DTMDisplaydate[4]{% \ifDTMshowdow \ifnum##4>-1 \DTMenglishweekdayname{##4} the\space \else \protect\Ordinalstringnum{##3} \fi \else \protect\Ordinalstringnum{##3} \fi of \DTMenglishmonthname{##2}% \DTMenfulltextmonthyearsep \protect\numberstringnum{##1}% }% } % \end{macrocode} % % Define the "en-FullText" date style: % \begin{macrocode} \DTMnewdatestyle{en-FullText}{% \renewcommand*\DTMdisplaydate[4]{% \ifDTMshowdow \ifnum##4>-1 \DTMenglishweekdayname{##4} the\space \fi \fi \protect\Ordinalstringnum{##3} of \DTMenglishmonthname{##2}% \DTMenfulltextmonthyearsep \protect\Numberstringnum{##1}% }% \renewcommand*\DTMDisplaydate{\DTMdisplaydate}% } % \end{macrocode} % % Define the "en-FULLTEXT" date style: % \begin{macrocode} \DTMnewdatestyle{en-FULLTEXT}{% \renewcommand*\DTMdisplaydate[4]{% \ifDTMshowdow \ifnum##4>-1 \MakeUppercase{\DTMenglishweekdayname{##4}} THE\space \fi \fi \protect\ORDINALstringnum{##3} OF \MakeUppercase{\DTMenglishmonthname{##2}% \DTMenfulltextmonthyearsep}% \protect\NUMBERstringnum{##1}% }% \renewcommand*\DTMDisplaydate{\DTMdisplaydate}% } % \end{macrocode} % %\begin{macro}{\DTMenfulltextmonthyearsep} % Separator between month and year. % \begin{macrocode} \newcommand*\DTMenfulltextmonthyearsep{,\space} % \end{macrocode} %\end{macro} % Set the "en-fulltext" date style: % \begin{macrocode} \DTMsetdatestyle{en-fulltext} % \end{macrocode} % %Define the "en-fulltext" time style. Seconds are ignored. % \begin{macrocode} \DTMnewtimestyle{en-fulltext}{% \renewcommand*\DTMdisplaytime[3]{% \ifboolexpr { test {\ifnumequal{##2}{0}} and ( test {\ifnumequal{##1}{0}} or test {\ifnumequal{##1}{12}} or test {\ifnumequal{##1}{24}} ) }% {% % \end{macrocode} % Either midnight or midday. % \begin{macrocode} \ifnum##1=12 \DTMenglishnoon \else \DTMenglishmidnight \fi }% {% % \end{macrocode} % Neither midnight nor midday. % \begin{macrocode} \ifnum##2=0 % \end{macrocode} % On the hour. % \begin{macrocode} \protect\numberstringnum{##1} \DTMoclockstring \else % \end{macrocode} % Not on the hour. % \begin{macrocode} \ifnum##2<31 % \end{macrocode} % Past the hour. % \begin{macrocode} \ifnum##2=15 % \end{macrocode} % Quarter past the hour. % \begin{macrocode} \DTMquarterpaststring\space \else \ifnum##2=30 % \end{macrocode} % Half past the hour. % \begin{macrocode} \DTMhalfpaststring\space \else \protect\numberstringnum{##2} \ifnum##2=1 \DTMminutepaststring\else \DTMminutespaststring\fi \space \fi \fi \ifnum##1>12 \ifnum##1=24 \DTMenglishmidnight \else \protect\numberstringnum{\numexpr##1-12}% \fi \else \ifnum##1=0 \DTMenglishmidnight \else \protect\numberstringnum{##1}% \fi \fi \else % \end{macrocode} % To the hour. % \begin{macrocode} \ifnum##2=45 \DTMquartertostring\space \else \protect\numberstringnum{\numexpr60-##2} \ifnum##2=59 \DTMminutetostring\else \DTMminutestostring\fi \space \fi \ifnum##1>12 \ifnum##1=24 \protect\numberstringnum{1}% \else \ifnum##1=23 \DTMenglishmidnight \else \protect\numberstringnum{\numexpr##1-11}% \fi \fi \else \ifnum##1=12 \protect\numberstringnum{1}% \else \protect\numberstringnum{\numexpr##1+1}% \fi \fi \fi \fi \ifnum##1>11 \ifnum##1=23 \ifnum##2<31 \space\DTMafternoonstring \fi \else \ifnum##1=24 \ifnum##2>30 \space\DTMmorningstring \fi \else \space\DTMafternoonstring \fi \fi \else \ifnum##1>0 \space\DTMmorningstring \else \ifnum##2>30 \space\DTMmorningstring \fi \fi \fi }% }% } % \end{macrocode} % %Define the "en-Fulltext" time style. Seconds are ignored. % \begin{macrocode} \DTMnewtimestyle{en-Fulltext}{% \renewcommand*\DTMdisplaytime[3]{% \ifboolexpr { test {\ifnumequal{##2}{0}} and ( test {\ifnumequal{##1}{0}} or test {\ifnumequal{##1}{12}} or test {\ifnumequal{##1}{24}} ) }% {% % \end{macrocode} % Either midnight or midday. % \begin{macrocode} \ifnum##1=12 \expandafter\MakeUppercase\DTMenglishnoon \else \expandafter\MakeUppercase\DTMenglishmidnight \fi }% {% % \end{macrocode} % Neither midnight nor midday. % \begin{macrocode} \ifnum##2=0 % \end{macrocode} % On the hour. % \begin{macrocode} \protect\Numberstringnum{##1} \DTMoclockstring \else % \end{macrocode} % Not on the hour. % \begin{macrocode} \ifnum##2<31 % \end{macrocode} % Past the hour. % \begin{macrocode} \ifnum##2=15 % \end{macrocode} % Quarter past the hour. % \begin{macrocode} \expandafter\MakeUppercase\DTMquarterpaststring\space \else \ifnum##2=30 % \end{macrocode} % Half past the hour. % \begin{macrocode} \expandafter\MakeUppercase\DTMhalfpaststring\space \else \protect\Numberstringnum{##2} \ifnum##2=1 \DTMminutepaststring\else \DTMminutespaststring\fi \space \fi \fi \ifnum##1>12 \ifnum##1=24 \DTMenglishmidnight \else \protect\numberstringnum{\numexpr##1-12}% \fi \else \ifnum##1=0 \DTMenglishmidnight \else \protect\numberstringnum{##1}% \fi \fi \else % \end{macrocode} % To the hour. % \begin{macrocode} \ifnum##2=45 \expandafter\MakeUppercase\DTMquartertostring\space \else \protect\Numberstringnum{\numexpr60-##2} \ifnum##2=59 \DTMminutetostring\else \DTMminutestostring\fi \space \fi \ifnum##1>12 \ifnum##1=24 \protect\numberstringnum{1}% \else \ifnum##1=23 \DTMenglishmidnight \else \protect\numberstringnum{\numexpr##1-11}% \fi \fi \else \ifnum##1=12 \protect\numberstringnum{1}% \else \protect\numberstringnum{\numexpr##1+1}% \fi \fi \fi \fi \ifnum##1>11 \ifnum##1=23 \ifnum##2<31 \space\DTMafternoonstring \fi \else \ifnum##1=24 \ifnum##2>30 \space\DTMmorningstring \fi \else \space\DTMafternoonstring \fi \fi \else \ifnum##1>0 \space\DTMmorningstring \else \ifnum##2>30 \space\DTMmorningstring \fi \fi \fi }% }% } % \end{macrocode} % %Define the "en-FULLTEXT" time style. Seconds are ignored. % \begin{macrocode} \DTMnewtimestyle{en-FULLTEXT}{% \renewcommand*\DTMdisplaytime[3]{% \ifboolexpr { test {\ifnumequal{##2}{0}} and ( test {\ifnumequal{##1}{0}} or test {\ifnumequal{##1}{12}} or test {\ifnumequal{##1}{24}} ) }% {% % \end{macrocode} % Either midnight or midday. % \begin{macrocode} \ifnum##1=12 \MakeUppercase\DTMenglishnoon \else \MakeUppercase\DTMenglishmidnight \fi }% {% % \end{macrocode} % Neither midnight nor midday. % \begin{macrocode} \ifnum##2=0 % \end{macrocode} % On the hour. % \begin{macrocode} \protect\NUMBERstringnum{##1} \MakeUppercase\DTMoclockstring \else % \end{macrocode} % Not on the hour. % \begin{macrocode} \ifnum##2<31 % \end{macrocode} % Past the hour. % \begin{macrocode} \ifnum##2=15 % \end{macrocode} % Quarter past the hour. % \begin{macrocode} \MakeUppercase\DTMquarterpaststring\space \else \ifnum##2=30 % \end{macrocode} % Half past the hour. % \begin{macrocode} \MakeUppercase\DTMhalfpaststring\space \else \protect\NUMBERstringnum{##2} \MakeUppercase {% \ifnum##2=1 \DTMminutepaststring\else \DTMminutespaststring\fi }% \space \fi \fi \ifnum##1>12 \ifnum##1=24 \MakeUppercase\DTMenglishmidnight \else \protect\NUMBERstringnum{\numexpr##1-12}% \fi \else \ifnum##1=0 \MakeUppercase\DTMenglishmidnight \else \protect\NUMBERstringnum{##1}% \fi \fi \else % \end{macrocode} % To the hour. % \begin{macrocode} \ifnum##2=45 \MakeUppercase\DTMquartertostring\space \else \protect\NUMBERstringnum{\numexpr60-##2} \MakeUppercase {% \ifnum##2=59 \DTMminutetostring\else \DTMminutestostring\fi }% \space \fi \ifnum##1>12 \ifnum##1=24 \protect\NUMBERstringnum{1}% \else \ifnum##1=23 \MakeUppercase\DTMenglishmidnight \else \protect\NUMBERstringnum{\numexpr##1-11}% \fi \fi \else \ifnum##1=12 \protect\NUMBERstringnum{1}% \else \protect\NUMBERstringnum{\numexpr##1+1}% \fi \fi \fi \fi \ifnum##1>11 \ifnum##1=23 \ifnum##2<31 \space\MakeUppercase\DTMafternoonstring \fi \else \ifnum##1=24 \ifnum##2>30 \space\MakeUppercase\DTMmorningstring \fi \else \space\MakeUppercase\DTMafternoonstring \fi \fi \else \ifnum##1>0 \space\MakeUppercase\DTMmorningstring \else \ifnum##2>30 \space\MakeUppercase\DTMmorningstring \fi \fi \fi }% }% } % \end{macrocode} % %Define the "en-FullText" time style. Seconds are ignored. % \begin{macrocode} \DTMnewtimestyle{en-FullText}{% \renewcommand*\DTMdisplaytime[3]{% \ifboolexpr { test {\ifnumequal{##2}{0}} and ( test {\ifnumequal{##1}{0}} or test {\ifnumequal{##1}{12}} or test {\ifnumequal{##1}{24}} ) }% {% % \end{macrocode} % Either midnight or midday. % \begin{macrocode} \ifnum##1=12 \expandafter\MakeUppercase\DTMenglishnoon \else \expandafter\MakeUppercase\DTMenglishmidnight \fi }% {% % \end{macrocode} % Neither midnight nor midday. % \begin{macrocode} \ifnum##2=0 % \end{macrocode} % On the hour. % \begin{macrocode} \protect\Numberstringnum{##1} \DTMOClockstring \else % \end{macrocode} % Not on the hour. % \begin{macrocode} \ifnum##2<31 % \end{macrocode} % Past the hour. % \begin{macrocode} \ifnum##2=15 % \end{macrocode} % Quarter past the hour. % \begin{macrocode} \DTMQuarterPaststring\space \else \ifnum##2=30 % \end{macrocode} % Half past the hour. % \begin{macrocode} \DTMHalfPaststring\space \else \protect\Numberstringnum{##2} \ifnum##2=1 \DTMMinutePaststring\else \DTMMinutesPaststring\fi \space \fi \fi \ifnum##1>12 \ifnum##1=24 \expandafter\MakeUppercase\DTMenglishmidnight \else \protect\Numberstringnum{\numexpr##1-12}% \fi \else \ifnum##1=0 \expandafter\MakeUppercase\DTMenglishmidnight \else \protect\Numberstringnum{##1}% \fi \fi \else % \end{macrocode} % To the hour. % \begin{macrocode} \ifnum##2=45 \DTMQuarterTostring\space \else \protect\Numberstringnum{\numexpr60-##2} \ifnum##2=59 \DTMMinuteTostring\else \DTMMinutesTostring\fi \space \fi \ifnum##1>12 \ifnum##1=24 \protect\Numberstringnum{1}% \else \ifnum##1=23 \expandafter\MakeUppercase\DTMenglishmidnight \else \protect\Numberstringnum{\numexpr##1-11}% \fi \fi \else \ifnum##1=12 \protect\Numberstringnum{1}% \else \protect\Numberstringnum{\numexpr##1+1}% \fi \fi \fi \fi \ifnum##1>11 \ifnum##1=23 \ifnum##2<31 \space\DTMAfterNoonstring \fi \else \ifnum##1=24 \ifnum##2>30 \space\DTMMorningstring \fi \else \space\DTMAfterNoonstring \fi \fi \else \ifnum##1>0 \space\DTMMorningstring \else \ifnum##2>30 \space\DTMMorningstring \fi \fi \fi }% }% } % \end{macrocode} % %\begin{macro}{\DTMoclockstring} % \begin{macrocode} \newcommand*{\DTMoclockstring}{o'clock} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMOClockstring} % \begin{macrocode} \newcommand*{\DTMOClockstring}{O'Clock} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMquarterpaststring} % \begin{macrocode} \newcommand*{\DTMquarterpaststring}{quarter past} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMQuarterPaststring} % \begin{macrocode} \newcommand*{\DTMQuarterPaststring}{Quarter Past} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMminutepaststring} % \begin{macrocode} \newcommand*{\DTMminutepaststring}{minute past} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMminutespaststring} % \begin{macrocode} \newcommand*{\DTMminutespaststring}{minutes past} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMMinutePaststring} % \begin{macrocode} \newcommand*{\DTMMinutePaststring}{Minute Past} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMMinutesPaststring} % \begin{macrocode} \newcommand*{\DTMMinutesPaststring}{Minutes Past} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMhalfpaststring} % \begin{macrocode} \newcommand*{\DTMhalfpaststring}{half past} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMHalfPaststring} % \begin{macrocode} \newcommand*{\DTMHalfPaststring}{Half Past} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMquartertostring} % \begin{macrocode} \newcommand*{\DTMquartertostring}{quarter to} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMQuarterTostring} % \begin{macrocode} \newcommand*{\DTMQuarterTostring}{Quarter to} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMminutetostring} % \begin{macrocode} \newcommand*{\DTMminutetostring}{minute to} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMMinuteTostring} % \begin{macrocode} \newcommand*{\DTMMinuteTostring}{Minute to} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMminutestostring} % \begin{macrocode} \newcommand*{\DTMminutestostring}{minutes to} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMMinutesTostring} % \begin{macrocode} \newcommand*{\DTMMinutesTostring}{Minutes to} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMmorningstring} % \begin{macrocode} \newcommand*{\DTMmorningstring}{in the morning} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMMorningstring} % \begin{macrocode} \newcommand*{\DTMMorningstring}{in the Morning} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMafternoonstring} % \begin{macrocode} \newcommand*{\DTMafternoonstring}{in the afternoon} % \end{macrocode} %\end{macro} % %\begin{macro}{\DTMAfterNoonstring} % \begin{macrocode} \newcommand*{\DTMAfterNoonstring}{in the Afternoon} % \end{macrocode} %\end{macro} % % %Set the "en-fulltext" time style: % \begin{macrocode} \DTMsettimestyle{en-fulltext} % \end{macrocode} % %\iffalse % \begin{macrocode} % % \end{macrocode} %\fi %\Finale \endinput