summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/eukdate/eukdate.sty
blob: b4ad759f8cdf798bb4942769015456c7a90d3814 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
%%
%% This is file `eukdate.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% eukdate.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright Andrew Gilbert Moschou 2008
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% 
%%   http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{eukdate}[2009/03/18 v1.04 UK format date (Hart's Rules) with weekday]
\newif\if@euk@noweekday
\newif\if@euk@usdate
\newif\if@euk@julian
\DeclareOption{no-weekday}{\@euk@noweekdaytrue}
\DeclareOption{ukdate}{\@euk@usdatefalse}
\DeclareOption{usdate}{\@euk@usdatetrue}
\DeclareOption{gregorian}{\@euk@julianfalse}
\DeclareOption{julian}{\@euk@juliantrue}
\ExecuteOptions{ukdate,gregorian}
\ProcessOptions\relax
\newcounter{euk@date}
\newcounter{euk@month}
\newcounter{euk@century}
\newcounter{euk@year}
\setcounter{euk@date}{\number\day}
\setcounter{euk@month}{\number\month}
\setcounter{euk@century}{\number\year}
\divide\c@euk@century by 100
\setcounter{euk@year}{\number\year}
\addtocounter{euk@year}{-\theeuk@century00}
\ifnum\number\theeuk@month<3
  \addtocounter{euk@month}{13}
  \addtocounter{euk@year}{-1}
\else
  \addtocounter{euk@month}{1}
\fi
\multiply\c@euk@month by 26
\divide\c@euk@month by 10
\addtocounter{euk@date}{\theeuk@month}
\addtocounter{euk@date}{\theeuk@year}
\divide\c@euk@year by 4
\addtocounter{euk@date}{\theeuk@year}
\if@euk@julian
  \addtocounter{euk@date}{6\theeuk@century}
  \addtocounter{euk@date}{5}
\else
  \addtocounter{euk@date}{5\theeuk@century}
  \divide\c@euk@century by 4
  \addtocounter{euk@date}{\theeuk@century}
\fi
\loop\ifnum6<\theeuk@date
  \addtocounter{euk@date}{-7}
\repeat
\newcommand\weekday{%
  \ifcase\theeuk@date Saturday\or Sunday\or Monday\or
    Tuesday\or Wednesday\or Thursday\or Friday\fi}
\newcommand\monthname{%
  \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}
\def\today{%
  \if@euk@noweekday\else\weekday,\space\fi
  \if@euk@usdate
    \monthname\space\number\day,%
  \else
    \number\day\space\monthname
  \fi
  \space\number\year}
\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
     th\or th\or th\or th\or th\or th\or th\or st\fi}
\endinput
%%
%% End of file `eukdate.sty'.