From 048192eed34c6907165dc00320dc880cc749e21a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 19 Mar 2009 16:40:07 +0000 Subject: eukdate update (17mar09) git-svn-id: svn://tug.org/texlive/trunk@12436 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/eukdate/eukdate.dtx | 55 ++++++++++++++-------- 1 file changed, 36 insertions(+), 19 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/eukdate/eukdate.dtx b/Master/texmf-dist/source/latex/eukdate/eukdate.dtx index 8e55525807c..bcee0cf05c6 100644 --- a/Master/texmf-dist/source/latex/eukdate/eukdate.dtx +++ b/Master/texmf-dist/source/latex/eukdate/eukdate.dtx @@ -16,7 +16,7 @@ % % \iffalse %\NeedsTeXFormat{LaTeX2e} -%\ProvidesPackage{eukdate}[2008/07/07 v1.02 LaTeX Package UK format date with weekday] +%\ProvidesPackage{eukdate}[2009/03/18 v1.04 UK format date (Hart's Rules) with weekday] % %<*driver> \documentclass{ltxdoc} @@ -28,6 +28,7 @@ \newcommand\floor[1]{\left\lfloor#1\right\rfloor} \newcommand\pp[1]{\left(#1\right)} \usepackage{amsmath} +\hyphenation{ori-gin-al-ly ca-len-dar} \frenchspacing \begin{document} \DocInput{eukdate.dtx} @@ -41,7 +42,7 @@ % % \DoNotIndex{\addtocounter} % \DoNotIndex{\day,\DeclareOption,\def,\divide} -% \DoNotIndex{\else,\ExecuteOptions,\eukordinal} +% \DoNotIndex{\edef,\else,\eukordinal,\ExecuteOptions} % \DoNotIndex{\fi} % \DoNotIndex{\ifcase,\ifnum} % \DoNotIndex{\loop} @@ -53,20 +54,30 @@ % \DoNotIndex{\setcounter,\space} % \DoNotIndex{\year} % -% \title{The \textsf{eukdate} package\thanks{This document corresponds to \textsf{eukdate}~\fileversion, dated~\filedate.}} +% \title{The \textsf{eukdate} package} % \author{Andrew Gilbert Moschou\\\textsf{andmos@gmail.com}} +% \makeatletter +% \date{\today\\v.~\expandafter\@gobble\fileversion} +% \makeatother % % \maketitle % % \section{Introduction} % -% This package redefines \DescribeMacro{\today}|\today|, to typeset |\today|'s date in, for example the format \emph{Day, Date Month Year} (here, called `\UK\ format'), `\weekday, \number\day\ \monthname\ \number\year' as is preferred in many parts of the world outside the \US. Thus, |\maketitle| uses the \UK\ format (instead of the default \US\ format, `\monthname\ \number\day, \number\year' as used in the |article| class). +% This package redefines \DescribeMacro{\today}|\today|, to typeset |\today|'s date in, the format \emph{Day, Date Month Year} (here, called `\UK\ format'), e.g., `\weekday, \number\day\ \monthname\ \number\year', as is preferred in many parts of the world outside the \US. Thus, |\maketitle| uses the \UK\ format (instead of the default \US\ format, e.g. \monthname\ \number\day, \number\year, as used in the |article| class). +% +% From \emph{Hart's Rules} (Hart, H., 1983. \emph{Hart's Rules for Compositors and Readers at the University Press Oxford}, Thirty-ninth edition, Completely revised, Originally compiled by Horace Hart, \textsc{m.a.}, Printer to the University, 1883--1915, Oxford University Press, Oxford, pp.~18--19.): +% +% \makeatletter\begin{center}\begin{minipage}[t]{100mm} +% \def\thempfootnote{{\@arabic\c@mpfootnote}} +% In dates, print 25 June 1978.\footnote{~This will not apply to quotations, nor to reprints of documents. As to the form May 19, 1862, Sir James Murray said, `This is not logical: 19 May 1862 is. \emph{Begin} at day, \emph{ascend} to month, \emph{ascend} to year; not \emph{begin} at month, \emph{descend} to day, then \emph{ascend} to year.'} Omit comma between month and year: `The delay after November 1967 was due to an oversight.' +% \end{minipage}\end{center}\makeatother % % This package also determines |\today|'s day of the week, which still makes the package useful even to Americans who might use the |usdate| option. The day of the week is calculated according to Zeller's congruence: % \begin{align*}w &= \begin{cases} -% d + \floor{\frac{26}{10}\pp{m+1}} + y + \floor{\frac{y}{4}} + \floor{\frac{c}{4}} - 2c\mod 7 & \mbox{Gregorian calendar}\\ -% d + \floor{\frac{26}{10}\pp{m+1}} + y + \floor{\frac{y}{4}} + 5 - c\mod 7 & \mbox{Julian calendar} -% \end{cases}\end{align*}where $d$ is the day of the month, $m$ is the number of the month, $y$ is the two digit year, $c$ is the century (so the year is given by $100c+y$) and $w$ represents the day of the week (0 for Saturday through to 6 for Friday); January and February are counted as months 13 and 14 of the previous year. +% d + \floor{\frac{26}{10}\pp{m+1}} + y + \floor{\frac{y}{4}} + \floor{\frac{c}{4}} - 2c\pmod 7 & \mbox{Gregorian calendar}\\ +% d + \floor{\frac{26}{10}\pp{m+1}} + y + \floor{\frac{y}{4}} + 5 - c\pmod 7 & \mbox{Julian calendar} +% \end{cases}\end{align*}where $d$ is the day of the month, $m$ is the number of the month, $y$ is the two digit year, $c$ is the century (so the four digit year is given by $100c+y$) and $w$ represents the day of the week (0 for Saturday through to 6 for Friday); January and February are counted as months 13 and 14 of the previous year. % % \makeatletter % The ordinal indicator of the date (in e.g. \number\day\textsuperscript{\euk@ordinal}, \number\day\euk@ordinal) is absent because its use is outdated. @@ -82,10 +93,16 @@ % \item[\sffamily no-weekday]Suppresses the weekday when typesetting |\today|, for example, `\number\day\ \monthname\ \number\year'. |\weekday| is still defined and can be used in the document. % \item[\sffamily ukdate]Typesets |\today| in \UK\ format, `\weekday, \number\day\ \monthname\ \number\year'. This option is applied by default, if the |usdate| option is not specified. % \item[\sffamily usdate]Typesets |\today| in \US\ format, `\weekday, \monthname\ \number\day, \number\year'. -% \item[\sffamily gregorian]Calculates the day of the week according to the Gregorian calendar, which is the calendar that is socially used today. This option is applied by default, if the |julian| option is not specified. +% \item[\sffamily gregorian]Calculates the day of the week according to the Gregorian calendar, which is the calendar that is generally used today. This option is applied by default, if the |julian| option is not specified. % \item[\sffamily julian]Calculates the day of the week according to the Julian calendar. However, since |\today|'s date is not \emph{today}'s date, as intepreted using the Julian calendar, this option is of limited use and can be safely ignored for every day use. % \end{description} % +% \section{Why a new solution?} +% +% It is natural to ask `Why a new solution to this problem?' because surely, somebody has already dealt with the issue. This is true but other solutions tend to be cumbersome. A similar effect can be achieved with |\usepackage[australian]{babel}| or |\usepackage[english,cleanlook]{isodate}|, but these instances do not include the day of the week. The day of the week can be calculated separately with scripts like |dow| or |dayofweek|, but neither is automatically integrated into the definition of |\today|. The |datetime| package can do this with the |\longdate| command, but there are minor format issues, which can be fixed only by defining a new format. +% +% This package was created to offer a simple method to set the date using a format according to \emph{my} preferences in a way that is portable to each system. It supports only a handful of date formats and in no way aims to be comprehensive. +% % \StopEventually{\PrintIndex} % \section{\textsf{eukdate.sty}} % \begin{macrocode} @@ -102,8 +119,8 @@ % \end{macrocode} % \subsection{Zeller's congruence} % Actually, the equivalent congruence:\begin{align*}w &= \begin{cases} -% d + \floor{\frac{26}{10}\pp{m+1}} + y + \floor{\frac{y}{4}} + \floor{\frac{c}{4}} + 5c\mod 7 & \mbox{Gregorian calendar}\\ -% d + \floor{\frac{26}{10}\pp{m+1}} + y + \floor{\frac{y}{4}} + 5 + 6c\mod 7 & \mbox{Julian calendar} +% d + \floor{\frac{26}{10}\pp{m+1}} + y + \floor{\frac{y}{4}} + \floor{\frac{c}{4}} + 5c\pmod 7 & \mbox{Gregorian calendar}\\ +% d + \floor{\frac{26}{10}\pp{m+1}} + y + \floor{\frac{y}{4}} + 5 + 6c\pmod 7 & \mbox{Julian calendar} % \end{cases}\end{align*}is used instead of Zeller's, as claimed, to simplify the algorithm for the modulo operation. % \begin{macrocode} \newcounter{euk@date} @@ -148,7 +165,7 @@ % Define |\weekday| to typeset the day of the week. % \begin{macrocode} \newcommand\weekday{% - \ifcase\theeuk@date Saturday\or Sunday\or Monday\or% + \ifcase\theeuk@date Saturday\or Sunday\or Monday\or Tuesday\or Wednesday\or Thursday\or Friday\fi} % \end{macrocode} % \end{macro} @@ -156,8 +173,8 @@ % Define |\monthname| to typeset the month. % \begin{macrocode} \newcommand\monthname{% - \ifcase\number\month\or January\or February\or March\or% - April\or May\or June\or July\or August\or% + \ifcase\number\month\or January\or February\or March\or + April\or May\or June\or July\or August\or September\or October\or November\or December\fi} % \end{macrocode} % \end{macro} @@ -165,11 +182,11 @@ % Redefine |\today|. % \begin{macrocode} \def\today{% - \if@euk@noweekday\else\weekday,\space\fi% + \if@euk@noweekday\else\weekday,\space\fi \if@euk@usdate \monthname\space\number\day,% \else - \number\day\space\monthname% + \number\day\space\monthname \fi \space\number\year} % \end{macrocode} @@ -177,10 +194,10 @@ % An `undocumented' feature. % \begin{macrocode} \edef\euk@ordinal{% - \ifcase\number\day\or st\or nd\or rd\or th\or th\or% - th\or th\or th\or th\or th\or th\or th\or th\or th\or% - th\or th\or th\or th\or th\or th\or st\or nd\or rd\or% + \ifcase\number\day\or st\or nd\or rd\or th\or th\or + th\or th\or th\or th\or th\or th\or th\or th\or th\or + th\or th\or th\or th\or th\or th\or st\or nd\or rd\or th\or th\or th\or th\or th\or th\or th\or st\fi} % \end{macrocode} % \Finale -\endinput \ No newline at end of file +\endinput -- cgit v1.2.3