diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-12 23:54:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-12 23:54:03 +0000 |
commit | 33f6c755284c8250061949a2265944f89969fa0a (patch) | |
tree | 303837c81ed099c4ad3703e381bd839c8a1827b0 /Master | |
parent | c5fbfa560c0d2bd40a05f5b6a2f2a4d91bb68cf2 (diff) |
datenumber
git-svn-id: svn://tug.org/texlive/trunk@816 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
7 files changed, 684 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/datenumber/datenumber.sty b/Master/texmf-dist/tex/latex/datenumber/datenumber.sty new file mode 100644 index 00000000000..2c77f6821cf --- /dev/null +++ b/Master/texmf-dist/tex/latex/datenumber/datenumber.sty @@ -0,0 +1,356 @@ +%% +%% This is file `datenumber.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datenumber.dtx (with options: `datenumber') +%% +%% This file is part of the `datenumber' package, +%% +%% Copyright (C) 2001 J"org-Michael Schr"oder. +%% +%% IMPORTANT NOTICE: +%% +%% This program may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.2 +%% 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.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% This program consists of all files listed in README.txt. +%% +%% For error reports, or offers to help make this a more powerful +%% tool, please contact me on schrj020@mail.uni-mainz.de +%% +\def\fileversion{v0.02} +\def\filedate{2001/08/06} + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{datenumber}[\filedate \fileversion] + +\DeclareOption{english}{\input datenumberenglish.ldf} +\DeclareOption{USenglish}{\input datenumberUSenglish.ldf} +\DeclareOption{french}{\input datenumberfrench.ldf} +\DeclareOption{italian}{\input datenumberitalian.ldf} +\DeclareOption{spanish}{\input datenumberspanish.ldf} +\DeclareOption{german}{\input datenumbergerman.ldf} +\DeclareOption{ngerman}{\input datenumbergerman.ldf} +\input datenumberUSenglish.ldf +\ProcessOptions +\newcounter{@dayscnt} +\newcounter{@startyear} + +\def\setstartyear#1{% + \ifnum#1<1 + \errmessage{Package datenumber: startyear < 1}% + \fi + \setcounter{@startyear}{#1}% + \setdatetoday +} + +\def\thestartyear{\the@startyear} + +\def\setmydatenumber#1#2#3#4{% + \ifvaliddate{#2}{#3}{#4}% + \else + \errmessage{\@errmessage}% + \fi + \ifnum\the@startyear<1 + \errmessage{Package datenumber: startyear < 1}% + \fi + \ifnum#2<\the@startyear + \errmessage{Package datenumber: datenumber < startyear (#2 < \the@startyear)}% + \fi + \setcounter{@dayscnt}{0}% + \ifnum#2>\the@startyear + \relax\@yearloop{#2}% + \fi + \addtocounter{@dayscnt}{% + \ifcase #3% + \or 0\or 31\or 59 + \or 90\or 120\or 151 + \or 181\or 212\or 243 + \or 273\or 304\or 334 + \fi + }% + \ifleapyear{#2}% + \ifnum#3>2 + \addtocounter{@dayscnt}{1}% + \fi + \fi + \ifnum#2=1582 + \ifnum#3>10 + \addtocounter{@dayscnt}{-10}% + \fi + \ifnum#3=10 + \ifnum#4>14 + \addtocounter{@dayscnt}{-10}% + \fi + \fi + \fi + \addtocounter{@dayscnt}{#4}% + \setcounter{#1}{\the@dayscnt}% +} + +\def\setmydatebynumber#1#2#3#4{% + \ifnum\the@startyear<1 + \errmessage{Package datenumber: startyear < 1}% + \fi + \ifnum#1<1 + \errmessage{Package datenumber: datenumber < 1}% + \fi + \setcounter{#2}{\the@startyear}% + \setcounter{@dayscnt}{1}% + \loop + \ifleapyear{\thedateyear}% + \@tempcnta=366 + \else + \@tempcnta=365 + \fi + \ifnum\thedateyear=1582 + \@tempcnta=355 + \fi + \addtocounter{@dayscnt}{\the\@tempcnta}% + \ifnum\the@dayscnt<#1\addtocounter{dateyear}{1}% + \repeat + \addtocounter{@dayscnt}{-\the\@tempcnta}% + % + \setcounter{#3}{1}% + \setcounter{#4}{1}% + \setmydatenumber{@dayscnt}{\value{#2}}{\value{#3}}{\value{#4}}% + \ifnum#1>\the@dayscnt\relax + \loop + \mynextdate{#2}{#3}{#4}% + \addtocounter{@dayscnt}{1}% + \ifnum\the@dayscnt<#1\relax + \repeat + \setmydatenumber{@dayscnt}{\value{#2}}{\value{#3}}{\value{#4}}% + \fi +} + +\def\mynextdate#1#2#3{% + \ifvaliddate{\value{#1}}{\value{#2}}{\value{#3}}% + \else + \errmessage{\@errmessage}% + \fi + \addtocounter{#3}{1}% + \ifleapyear{\value{#1}}% + \@tempcnta=29 + \else + \@tempcnta=28 + \fi + \ifnum\value{#3}>% + \ifcase\value{#2}\or31\or\@tempcnta\or31\or30\or31\or30% + \or31\or31\or30\or31\or30\else31% + \fi\relax + \setcounter{#3}{1}% + \addtocounter{#2}{1}% + \ifnum\value{#2}>12 + \setcounter{#2}{1}% + \addtocounter{#1}{1}% + \fi + \fi + \ifnum\value{#1}=1582 + \ifnum\value{#2}=10 + \ifnum\value{#3}=5 + \setcounter{#3}{15}% + \fi + \fi + \fi +} + +\def\myprevdate#1#2#3{% + \ifvaliddate{\value{#1}}{\value{#2}}{\value{#3}}% + \else + \errmessage{\@errmessage}% + \fi + \addtocounter{#3}{-1}% + \ifleapyear{\value{#1}}% + \@tempcnta=29 + \else + \@tempcnta=28 + \fi + \ifnum\value{#3}=0 + \addtocounter{#2}{-1}% + \ifnum\value{#2}=0 + \addtocounter{#1}{-1}% + \setcounter{#2}{12}% + \fi + \setcounter{#3}{% + \ifcase\value{#2}\or 31\or\the\@tempcnta\or 31\or 30\or 31\or 30 + \or 31\or 31\or 30\or 31\or 30\else 31 + \fi + }% + \fi + \ifnum\value{#1}=1582 + \ifnum\value{#2}=10 + \ifnum\value{#3}=14 + \setcounter{#3}{4}% + \fi + \fi + \fi +} + + +\newcounter{datenumber} +\newcounter{dateyear} +\newcounter{datemonth} +\newcounter{dateday} +\newcounter{datedayname} + +\def\setdatenumber#1#2#3{% + \setmydatenumber{datenumber}{#1}{#2}{#3}% + \setcounter{dateyear}{#1}% + \setcounter{datemonth}{#2}% + \setcounter{dateday}{#3}% + \setdaynamebynumber{\thedatenumber}% + \setmonthname{\thedatemonth}% +} + +\def\setdatebynumber#1{% + \setmydatebynumber{#1}{dateyear}{datemonth}{dateday}% + \setcounter{datenumber}{#1}% + \setdaynamebynumber{\thedatenumber}% + \setmonthname{\thedatemonth}% +} + +\def\nextdate{% + \mynextdate{dateyear}{datemonth}{dateday}% + \setdate{\thedateyear}{\thedatemonth}{\thedateday}% +} + +\def\prevdate{% + \myprevdate{dateyear}{datemonth}{dateday}% + \setdate{\thedateyear}{\thedatemonth}{\thedateday}% +} + +\def\setdate#1#2#3{%#1 year, #2 month, #3 day + \setdatenumber{#1}{#2}{#3}% +} + +\def\setdatetoday{% + \setdatenumber{\the\year}{\the\month}{\the\day}% +} + + +\def\setmonthname#1{% + \def\datemonthname{\@monthname{#1}}% +} + + +\def\setdayname#1{% + \def\datedayname{\@dayname{#1}}% +} + +\def\setdaynamebynumber#1{% + \@tempcnta=#1\relax + \ifnum\the@startyear=1800\advance \@tempcnta by 1\fi + \ifnum\the@startyear=1900\advance \@tempcnta by 6\fi + \ifnum\the@startyear=2000\advance \@tempcnta by 4\fi + \@modulo{\the\@tempcnta}{7}% + \setcounter{datedayname}{\the\@den}% + \addtocounter{datedayname}{1}% + \setdayname{\thedatedayname}% +} + +\def\datedate{\@datedate}% + +\def\dateselectlanguage#1{% + \csname @datelanguage#1\endcsname + \setdayname{\thedatedayname}% + \setmonthname{\thedatemonth}% +} + +\def\ifleapyear#1{%#1 year + \ifnum#1>1500 + \@modulo{#1}{100}% + \ifnum\@den=0 + \@modulo{#1}{400}% + \else + \@modulo{#1}{4}% + \fi + \else + \@modulo{#1}{4}% + \fi + \ifnum\@den=0 +} + +\def\ifvaliddate#1#2#3{% + \ifleapyear{#1}% + \@tempcnta=29 + \else + \@tempcnta=28 + \fi + \gdef\@errmessage{}% + \ifnum#1<1 + \gdef\@errmessage{Package datenumber: % + invalid date: year < 1, #1/#2/#3}% + \fi% + \ifnum#2<1 + \gdef\@errmessage{Package datenumber: % + invalid date: month < 1, #1/#2/#3}% + \fi% + \ifnum#2>12 + \gdef\@errmessage{Package datenumber: % + invalid date: month > 12, #1/#2/#3}% + \fi% + \ifnum#3<1 + \gdef\@errmessage{Package datenumber: % + invalid date: day < 1, #1/#2/#3}% + \fi% + \@tempcntb= + \ifcase#2 31\or 31\or\the\@tempcnta\or 31\or 30\or 31\or 30 + \or 31\or 31\or 30\or 31\or 30\else 31 + \fi\relax + \ifnum#3>\@tempcntb + \gdef\@errmessage{Package datenumber: % + invalid date: day > \the\@tempcntb, #1/#2/#3}% + \fi% + \ifnum#1=1582 + \ifnum#2=10 + \ifnum#3>4 + \ifnum#3<15 + \gdef\@errmessage{Package datenumber: % + invalid date: #1/#2/#3}% + \fi + \fi + \fi + \fi + \ifx\@errmessage\empty +} + +\def\@yearloop#1{% + \@tempcnta=\the@startyear% + \loop + \ifleapyear{\@tempcnta}% + \addtocounter{@dayscnt}{366}% + \else + \addtocounter{@dayscnt}{365}% + \fi + \ifnum\@tempcnta=1582 + \addtocounter{@dayscnt}{-10}% + \fi + \advance \@tempcnta by 1 + \ifnum\@tempcnta=#1\else + \repeat +} + +\newcount\@nom\newcount\@den + +\def\@modulo#1#2{% + \@nom=#1\relax + \@den=#2\relax + \divide\@nom by \@den% + \multiply\@nom by \@den% + \@den=#1% + \advance\@den by -\@nom% +} + +\setstartyear{1800} + +\endinput +%% +%% End of file `datenumber.sty'. diff --git a/Master/texmf-dist/tex/latex/datenumber/datenumberUSenglish.ldf b/Master/texmf-dist/tex/latex/datenumber/datenumberUSenglish.ldf new file mode 100644 index 00000000000..3171c058773 --- /dev/null +++ b/Master/texmf-dist/tex/latex/datenumber/datenumberUSenglish.ldf @@ -0,0 +1,53 @@ +%% +%% This is file `datenumberUSenglish.ldf', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datenumber.dtx (with options: `USenglish') +%% +%% This file is part of the `datenumber' package, +%% +%% Copyright (C) 2001 J"org-Michael Schr"oder. +%% +%% IMPORTANT NOTICE: +%% +%% This program may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.2 +%% 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.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% This program consists of all files listed in README.txt. +%% +%% For error reports, or offers to help make this a more powerful +%% tool, please contact me on schrj020@mail.uni-mainz.de +%% + +\ProvidesFile{datenumberUSenglish.ldf} + +\def\@datelanguageUSenglish{% + \def\@dayname{\@daynameUSenglish} + \def\@monthname{\@monthnameUSenglish}% + \def\@datedate{\@datedateUSenglish}% +} + +\def\@monthnameUSenglish#1{% + \ifcase#1\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\@daynameUSenglish#1{% + \ifcase#1\or + Monday\or Tuesday\or Wednesday\or Thursday\or + Friday\or Saturday\or Sunday\fi} + +\def\@datedateUSenglish{\datemonthname\space\thedateday, \thedateyear} + +\@datelanguageUSenglish + +\endinput +%% +%% End of file `datenumberUSenglish.ldf'. diff --git a/Master/texmf-dist/tex/latex/datenumber/datenumberdummy.ldf b/Master/texmf-dist/tex/latex/datenumber/datenumberdummy.ldf new file mode 100644 index 00000000000..789facc8cb6 --- /dev/null +++ b/Master/texmf-dist/tex/latex/datenumber/datenumberdummy.ldf @@ -0,0 +1,57 @@ +%% +%% This is file `datenumberdummy.ldf', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datenumber.dtx (with options: `dummy') +%% +%% This file is part of the `datenumber' package, +%% +%% Copyright (C) 2001 J"org-Michael Schr"oder. +%% +%% IMPORTANT NOTICE: +%% +%% This program may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.2 +%% 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.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% This program consists of all files listed in README.txt. +%% +%% For error reports, or offers to help make this a more powerful +%% tool, please contact me on schrj020@mail.uni-mainz.de +%% + +\ProvidesFile{datenumberdummy.ldf} + +\makeatletter + +\def\@datelanguagedummy{% + \def\@dayname{\@daynamedummy} + \def\@monthname{\@monthnamedummy}% + \def\@datedate{\@datedatedummy}% +} + +\def\@monthnamedummy#1{% + \ifcase#1\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\@daynamedummy#1{% + \ifcase#1\or + Monday\or Tuesday\or Wednesday\or Thursday\or + Friday\or Saturday\or Sunday\fi} + +\def\@datedatedummy{\datemonthname\space\thedateday, \thedateyear} + +\@datelanguagedummy + +\makeatother + +\endinput +%% +%% End of file `datenumberdummy.ldf'. diff --git a/Master/texmf-dist/tex/latex/datenumber/datenumberenglish.ldf b/Master/texmf-dist/tex/latex/datenumber/datenumberenglish.ldf new file mode 100644 index 00000000000..4a2c6388600 --- /dev/null +++ b/Master/texmf-dist/tex/latex/datenumber/datenumberenglish.ldf @@ -0,0 +1,57 @@ +%% +%% This is file `datenumberenglish.ldf', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datenumber.dtx (with options: `english') +%% +%% This file is part of the `datenumber' package, +%% +%% Copyright (C) 2001 J"org-Michael Schr"oder. +%% +%% IMPORTANT NOTICE: +%% +%% This program may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.2 +%% 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.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% This program consists of all files listed in README.txt. +%% +%% For error reports, or offers to help make this a more powerful +%% tool, please contact me on schrj020@mail.uni-mainz.de +%% + +\ProvidesFile{datenumberenglish.ldf} + +\def\@datelanguageenglish{% + \def\@dayname{\@daynameenglish} + \def\@monthname{\@monthnameenglish}% + \def\@datedate{\@datedateenglish}% +} + +\def\@monthnameenglish#1{% + \ifcase#1\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\@daynameenglish#1{% + \ifcase#1\or + Monday\or Tuesday\or Wednesday\or Thursday\or + Friday\or Saturday\or Sunday\fi} + +\def\@datedateenglish{\thedateday \ifcase\thedateday \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~\datemonthname \space\thedateyear} + +\@datelanguageenglish + +\endinput +%% +%% End of file `datenumberenglish.ldf'. diff --git a/Master/texmf-dist/tex/latex/datenumber/datenumberfrench.ldf b/Master/texmf-dist/tex/latex/datenumber/datenumberfrench.ldf new file mode 100644 index 00000000000..202e36ac9ce --- /dev/null +++ b/Master/texmf-dist/tex/latex/datenumber/datenumberfrench.ldf @@ -0,0 +1,54 @@ +%% +%% This is file `datenumberfrench.ldf', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datenumber.dtx (with options: `french') +%% +%% This file is part of the `datenumber' package, +%% +%% Copyright (C) 2001 J"org-Michael Schr"oder. +%% +%% IMPORTANT NOTICE: +%% +%% This program may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.2 +%% 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.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% This program consists of all files listed in README.txt. +%% +%% For error reports, or offers to help make this a more powerful +%% tool, please contact me on schrj020@mail.uni-mainz.de +%% + +\ProvidesFile{datenumberfrench.ldf} + +\def\@datelanguagefrench{% + \def\@dayname{\@daynamefrench} + \def\@monthname{\@monthnamefrench}% + \def\@datedate{\@datedatefrench}% +} + +\def\@monthnamefrench#1{% + \ifcase#1\or + janvier\or f\'evrier\or mars\or avril\or mai\or juin\or + juillet\or ao\^ut\or septembre\or octobre\or novembre\or d\'ecembre\fi}% + +\def\@daynamefrench#1{% + \ifcase#1\or + Lundi\or Mardi\or Mercredi\or Jeudi\or + Vendredi\or Samedi\or Dimanche\fi} + +\def\@datedatefrench{\thedateday \ifnum1=\thedateday \/$^{\rm er}$\fi + \space \datemonthname\space \number\year} + +\@datelanguagefrench + +\endinput +%% +%% End of file `datenumberfrench.ldf'. diff --git a/Master/texmf-dist/tex/latex/datenumber/datenumbergerman.ldf b/Master/texmf-dist/tex/latex/datenumber/datenumbergerman.ldf new file mode 100644 index 00000000000..a953ae6c72c --- /dev/null +++ b/Master/texmf-dist/tex/latex/datenumber/datenumbergerman.ldf @@ -0,0 +1,53 @@ +%% +%% This is file `datenumbergerman.ldf', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datenumber.dtx (with options: `german') +%% +%% This file is part of the `datenumber' package, +%% +%% Copyright (C) 2001 J"org-Michael Schr"oder. +%% +%% IMPORTANT NOTICE: +%% +%% This program may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.2 +%% 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.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% This program consists of all files listed in README.txt. +%% +%% For error reports, or offers to help make this a more powerful +%% tool, please contact me on schrj020@mail.uni-mainz.de +%% + +\ProvidesFile{datenumbergerman.ldf} + +\def\@datelanguagegerman{% + \def\@dayname{\@daynamegerman}% + \def\@monthname{\@monthnamegerman}% + \def\@datedate{\@datedategerman}% +} + +\def\@monthnamegerman#1{% + \ifcase#1\or + Januar\or Februar\or M\"arz\or April\or Mai\or Juni\or + Juli\or August\or September\or Oktober\or November\or Dezember\fi}% + +\def\@daynamegerman#1{% + \ifcase#1\or + Montag\or Dienstag\or Mittwoch\or Donnerstag\or + Freitag\or Samstag\or Sonntag\fi} + +\def\@datedategerman{\thedateday.~\datemonthname\space\thedateyear} + +\@datelanguagegerman + +\endinput +%% +%% End of file `datenumbergerman.ldf'. diff --git a/Master/texmf-dist/tex/latex/datenumber/datenumberspanish.ldf b/Master/texmf-dist/tex/latex/datenumber/datenumberspanish.ldf new file mode 100644 index 00000000000..fd5cfa63198 --- /dev/null +++ b/Master/texmf-dist/tex/latex/datenumber/datenumberspanish.ldf @@ -0,0 +1,54 @@ +%% +%% This is file `datenumberspanish.ldf', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datenumber.dtx (with options: `spanish') +%% +%% This file is part of the `datenumber' package, +%% +%% Copyright (C) 2001 J"org-Michael Schr"oder. +%% +%% IMPORTANT NOTICE: +%% +%% This program may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.2 +%% 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.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% This program consists of all files listed in README.txt. +%% +%% For error reports, or offers to help make this a more powerful +%% tool, please contact me on schrj020@mail.uni-mainz.de +%% + +\ProvidesFile{datenumberspanish.ldf} + +\def\@datelanguagespanish{% + \def\@dayname{\@daynamespanish} + \def\@monthname{\@monthnamespanish}% + \def\@datedate{\@datedatespanish}% +} + +\def\@monthnamespanish#1{% + \ifcase#1\or + enero\or febrero\or marzo\or abril\or mayo\or junio\or + julio\or agosto\or septiembre\or octubre\or noviembre\or diciembre\fi}% + +\def\@daynamespanish#1{% + \ifcase#1\or + Lunes\or Martes\or Mi\'ercoles\or Jueves\or + Viernes\or S\'abado\or Domingo\fi} + +\def\@datedatespanish{\thedateday~de \datemonthname\ de~\the\year} + +\@datelanguagespanish + + +\endinput +%% +%% End of file `datenumberspanish.ldf'. |