diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-09 00:44:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-09 00:44:40 +0000 |
commit | b4fc5f639874db951177ec539299d20908adb654 (patch) | |
tree | 52f08823ca58fffe3db6a9b075635038c567626c /Master/texmf-dist/doc/latex/datetime | |
parent | dec3d98ebe442d7ea93efbaa8dd2e2be8149a467 (diff) |
doc 4
git-svn-id: svn://tug.org/texlive/trunk@80 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/datetime')
-rw-r--r-- | Master/texmf-dist/doc/latex/datetime/CHANGES | 41 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/datetime/README | 48 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/datetime/datetime.pdf | bin | 0 -> 156960 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/datetime/datetime.perl | 1739 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/datetime/dt-sampl.tex | 126 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/datetime/manual.html | 853 |
6 files changed, 2807 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/datetime/CHANGES b/Master/texmf-dist/doc/latex/datetime/CHANGES new file mode 100644 index 00000000000..5c399d7640b --- /dev/null +++ b/Master/texmf-dist/doc/latex/datetime/CHANGES @@ -0,0 +1,41 @@ +datetime.sty history + +Version 2.46: Made \today robust. + +Version 2.45: Added command to store dates. + +Version 2.44: Fixed spelling mistakes (oops!) and minor +bugs in LaTeX2HTML style files + +New to version 2.43: Package now compatible with +LaTeX2HTML + +New to version 2.42: Package now compatible with babel. + +New to version 2.41: Package has been split into two +files: datetime.sty and fmtcount.sty. The latter file +contains the definitions for all the macros that display +the value of a counter (e.g. \ordinal, \octal). +Extra macro \decimal added (like \arabic, but can pad it +with leading zeroes.) + +New to version 2.4: New commands: \binary, \octal, +\hexadecimal, \aaalph, \abalph, \Hexadecimal, \AAAlph +and \ABAlph. Added provision for configuration +file datetime.cfg. + +New to version 2.31: The command \pdfdate has been added +(minor bug fixed in version 2.32) + +New to version 2.3: The command \newtimeformat can be +used to define new time formats. Added the command +\currenttime + +New to version 2.2: The command \newdateformat can be +used to define new date formats in addition to the ones +provided by this package. + +see accompanying README file for license and installation +information. + +http://theoval.cmp.uea.ac.uk/~nlct/ diff --git a/Master/texmf-dist/doc/latex/datetime/README b/Master/texmf-dist/doc/latex/datetime/README new file mode 100644 index 00000000000..ef53445b4b8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/datetime/README @@ -0,0 +1,48 @@ +LaTeX Package : datetime v 2.46 + +Last Modified : 30 September 2005 + +Author : Nicola Talbot + +Files : datetime.dtx - documented source file + datetime.ins - installation script + + +The package datetime.sty provides various different +formats for \today, and provides commands for displaying +the current time. + +See the documentation for more details. + +To extract the code do: + +latex datetime.ins + +This will create datetime.sty, lots of .def files, +datetime.perl files and one sample file: dt-sampl.tex. +(NB it may take a while to extract if you have a slow computer!) + +Move the .sty and .def files to somewhere LaTeX will find it +(e.g. texmf/tex/latex/datetime/) and remember to update the TeX +database. + +Copy the .perl file to somewhere where LaTeX2HTML will find it +(e.g. latex2html/styles/). + +To extract the documentation do: + +latex datetime.dtx +makeindex -s gglo.ist -t datetime.glg -o datetime.gls datetime.glo +latex datetime.dtx +latex datetime.dtx + +Place the resulting file (datetime.dvi) into the documentation +directory (e.g. texmf/doc/latex/datetime/). + +Read the file CHANGES for version changes. + +This material is subject to the LaTeX Project Public License. +See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html for +the details of that license. + +http://theoval.cmp.uea.ac.uk/~nlct/ diff --git a/Master/texmf-dist/doc/latex/datetime/datetime.pdf b/Master/texmf-dist/doc/latex/datetime/datetime.pdf Binary files differnew file mode 100644 index 00000000000..e243bdd0473 --- /dev/null +++ b/Master/texmf-dist/doc/latex/datetime/datetime.pdf diff --git a/Master/texmf-dist/doc/latex/datetime/datetime.perl b/Master/texmf-dist/doc/latex/datetime/datetime.perl new file mode 100644 index 00000000000..3f8ab5bfb80 --- /dev/null +++ b/Master/texmf-dist/doc/latex/datetime/datetime.perl @@ -0,0 +1,1739 @@ +# File : datetime.perl +# Author : Nicola Talbot +# Date : 3 Mar 2005 +# Version : 1.01 +# Description : LaTeX2HTML implementation of datetime package. + +# set up default values for internal counters. + +($global{SECONDS},$global{MINUTE},$global{HOUR},$global{DAY},$global{MONTH},$global{YEAR})=localtime(time); +$global{YEAR} += 1900; +$global{MONTH}++; + +$global{HOURXII} = ($global{HOUR} == 12 ? 12 : ($global{HOUR})%12); +$global{TOHOUR} = ($global{HOUR} == 11 ? 12 :($global{HOUR}+1)%12); +$global{TOMINUTE} = ($global{MINUTE} == 0? 0 : 60 - $global{MINUTE}); + +package main; + +&do_require_package('fmtcount'); + +sub do_cmd_ordinaldate{ + &do_cmd_ordinalnum(@_); +} + +# define package options + +sub do_datetime_long{ + &do_cmd_longdate(@_); +} + +sub do_datetime_short{ + &do_cmd_shortdate(@_); +} + +sub do_datetime_text{ + &do_cmd_textdate(@_); +} + +sub do_datetime_ddmmyyyy{ + &do_cmd_ddmmyyyydate(@_); +} + +sub do_datetime_dmyyyy{ + &do_cmd_dmyyyydate(@_); +} + +sub do_datetime_ddmmyy{ + &do_cmd_ddmmyydate(@_); +} + +sub do_datetime_dmyy{ + &do_cmd_dmyyyydate(@_); +} + +sub do_datetime_us{ + &do_cmd_usdate(@_); +} + +sub do_datetime_mmddyyyy{ + &do_cmd_mmddyyyydate(@_); +} + +sub do_datetime_mdyyyy{ + &do_cmd_mdyyyydate(@_); +} + +sub do_datetime_mmddyy{ + &do_cmd_mmddyydate(@_); +} + +sub do_datetime_mdyy{ + &do_cmd_mdyyyydate(@_); +} + +sub do_datetime_raise{ + local($tmp)=""; + + $tmp .= 'sub do_cmd_fmtord{'; + $tmp .= 'local($_) = @_;'; + $tmp .= 'local($num) = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($num=$2));'; + $tmp .= 'join("", "<SUP>",$num,"</SUP>",$_);'; + $tmp .='}'; + + eval($tmp); +} + +sub do_datetime_level{ + local($tmp)=""; + + $tmp .= 'sub do_cmd_fmtord{'; + $tmp .= 'local($_) = @_;'; + $tmp .= 'local($num) = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($num=$2));'; + $tmp .= 'join("", $num,$_);'; + $tmp .='}'; + + eval($tmp); +} + +sub do_datetime_dayofweek{ + &do_cmd_showdowtrue(@_); +} + +sub do_datetime_nodayofweek{ + &do_cmd_showdowfalse(@_); +} + +sub do_datetime_24hr{ + $tmp = 'sub do_cmd_currenttime{local($_) = @_; join(\'\', "\\\\xxivtime", $_[0]); }'; + + eval($tmp); + + join('', $_[0]); +} + +sub do_datetime_12hr{ + $tmp = 'sub do_cmd_currenttime{local($_) = @_; join(\'\', "\\\\ampmtime", $_[0]); }'; + + eval($tmp); + + join('', $_[0]); +} + +sub do_datetime_oclock{ + $tmp = 'sub do_cmd_currenttime{local($_) = @_; join(\'\', "\\\\oclock", $_[0]); }'; + + eval($tmp); + + join('', $_[0]); +} + +# babel stuff (Month will already be redefined by babel, so only need to change $dateformat) + +sub do_datetime_austrian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateaustrian{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateaustrian(@_); +} + +if (defined &austrian_today) +{ + &do_datetime_austrian(@_); +} + +sub do_datetime_bahasa{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datebahasa{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datebahasa(@_); +} + +if (defined &bahasa_today) +{ + &do_datetime_bahasa(@_); +} + +sub do_datetime_basque{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datebasque{'; + $tmp .= ' $dateformat = "THEYEAR.eko MONTHNAME[THEMONTH] THEDAY";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datebasque(@_); +} + +if (defined &basque_today) +{ + &do_datetime_basque(@_); +} + +sub do_datetime_breton{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datebreton{'; + $tmp .= ' $dateformat = "{ORDINALDATE{DAY}}\\ a viz MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + $tmp = 'sub do_cmd_ordinaldate{'; + $tmp .= 'local($_) = @_;'; + $tmp .= 'local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2));'; + $tmp .= 'local($before) = $num;'; + + $tmp .= 'if ($num == 1)'; + $tmp .= '{ $before .= \'a\~n\'; }'; + + $tmp .= '$before . $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datebreton(@_); +} + +if (defined &breton_today) +{ + &do_datetime_breton(@_); +} + +sub do_datetime_bulgarian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datebulgarian{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR \\cyrg.";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datebulgarian(@_); +} + +if (defined &bulgarian_today) +{ + &do_datetime_bulgarian(@_); +} + +sub do_datetime_catalan{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datecatalan{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] de THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datecatalan(@_); +} + +if (defined &catalan_today) +{ + &do_datetime_catalan(@_); +} + +sub do_datetime_croatian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datecroatian{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR.";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datecroatian(@_); +} + +if (defined &croatian_today) +{ + &do_datetime_croatian(@_); +} + +sub do_datetime_czech{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateczech{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateczech(@_); +} + +if (defined &czech_today) +{ + &do_datetime_czech(@_); +} + +sub do_datetime_danish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datedanish{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datedanish(@_); +} + +if (defined &danish_today) +{ + &do_datetime_danish(@_); +} + +sub do_datetime_dutch{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datedutch{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datedutch(@_); +} + +if (defined &dutch_today) +{ + &do_datetime_dutch(@_); +} + +sub do_datetime_esperanto{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateesperanto{'; + $tmp .= ' $dateformat = "THEDAY--a de MONTHNAME[THEMONTH], THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateesperanto(@_); +} + +if (defined &esperanto_today) +{ + &do_datetime_esperanto(@_); +} + +sub do_datetime_estonian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateestonian{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR. a.";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateestonian(@_); +} + +if (defined &estonian_today) +{ + &do_datetime_estonian(@_); +} + +sub do_datetime_finnish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datefinnish{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datefinnish(@_); +} + +if (defined &finnish_today) +{ + &do_datetime_finnish(@_); +} + +sub do_datetime_french{ + local($tmp) = ""; + + eval($tmp); + $tmp .= 'sub do_cmd_datefrench{'; + $tmp .= ' $dateformat = "{ORDINALDATE{DAY}}\\ MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + $tmp = 'sub do_cmd_ordinaldate{'; + $tmp .= 'local($_) = @_;'; + $tmp .= 'local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2));'; + $tmp .= 'local($before) = $num;'; + + $tmp .= 'if ($num == 1)'; + $tmp .= '{ $before .= \'\ier\'; }'; + + $tmp .= '$before . $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datefrench(@_); +} + +if (defined &french_today) +{ + &do_datetime_french(@_); +} + +sub do_datetime_galician{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dategalician{'; + $tmp .= ' $dateformat = "THEDAY de MONTHNAME[THEMONTH] de THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dategalician(@_); +} + +if (defined &galician_today) +{ + &do_datetime_galician(@_); +} + +sub do_datetime_german{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dategerman{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dategerman(@_); +} + +if (defined &german_today) +{ + &do_datetime_german(@_); +} + +sub do_datetime_greek{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dategreek{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dategreek(@_); +} + +if (defined &greek_today) +{ + &do_datetime_greek(@_); +} + +sub do_datetime_icelandic{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateicelandic{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateicelandic(@_); +} + +if (defined &icelandic_today) +{ + &do_datetime_icelandic(@_); +} + +sub do_datetime_irish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateirish{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateirish(@_); +} + +if (defined &irish_today) +{ + &do_datetime_irish(@_); +} + +sub do_datetime_italian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateitalian{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateitalian(@_); +} + +if (defined &italian_today) +{ + &do_datetime_italian(@_); +} + +sub do_datetime_latin{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datelatin{'; + $tmp .= ' $dateformat = "ROMANNUMERALU{THEDAY} MONTHNAME[THEMONTH] ROMANNUMERALU{THEYEAR}";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datelatin(@_); +} + +if (defined &latin_today) +{ + &do_datetime_latin(@_); +} + +sub do_datetime_lsorbian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datelsorbian{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datelsorbian(@_); +} + +if (defined &lsorbian_today) +{ + &do_datetime_lsorbian(@_); +} + +sub do_datetime_magyar{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datemagyar{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR.";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datemagyar(@_); +} + +if (defined &magyar_today) +{ + &do_datetime_magyar(@_); +} + +sub do_datetime_naustrian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datenaustrian{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datenaustrian(@_); +} + +if (defined &naustrian_today) +{ + &do_datetime_naustrian(@_); +} + +sub do_datetime_ngerman{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datengerman{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datengerman(@_); +} + +if (defined &ngerman_today) +{ + &do_datetime_ngerman(@_); +} + +sub do_datetime_norsk{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datenorsk{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datenorsk(@_); +} + +if (defined &norsk_today) +{ + &do_datetime_norsk(@_); +} + +sub do_datetime_polish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datenorsk{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datenorsk(@_); +} + +if (defined &polish_today) +{ + &do_datetime_polish(@_); +} + +sub do_datetime_portuges{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateportuges{'; + $tmp .= ' $dateformat = "THEDAY de MONTHNAME[THEMONTH] de THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateportuges(@_); +} + +if (defined &portuges_today) +{ + &do_datetime_portuges(@_); +} + +sub do_datetime_romanian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateromanian{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateromanian(@_); +} + +if (defined &romanian_today) +{ + &do_datetime_romanian(@_); +} + +sub do_datetime_russian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_daterussian{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR \\\\cyrg.";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_daterussian(@_); +} + +if (defined &russian_today) +{ + &do_datetime_russian(@_); +} + +sub do_datetime_samin{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datesamin{'; + $tmp .= ' $dateformat = "MONTHNAME[THEMONTH] THEDAY.~b. THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datesamin(@_); +} + +if (defined &samin_today) +{ + &do_datetime_samin(@_); +} + +sub do_datetime_scottish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datescottish{'; + $tmp .= ' $dateformat = "THEDAY MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datescottish(@_); +} + +if (defined &scottish_today) +{ + &do_datetime_scottish(@_); +} + +sub do_datetime_serbian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateserbian{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateserbian(@_); +} + +if (defined &serbian_today) +{ + &do_datetime_serbian(@_); +} + +sub do_datetime_slovak{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateslovak{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateslovak(@_); +} + +if (defined &slovak_today) +{ + &do_datetime_slovak(@_); +} + +sub do_datetime_slovene{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateslovene{'; + $tmp .= ' $dateformat = "THEDAY. MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateslovene(@_); +} + +if (defined &slovene_today) +{ + &do_datetime_slovene(@_); +} + +sub do_datetime_spanish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datespanish{'; + $tmp .= ' $dateformat = "THEDAY~de MONTHNAME[THEMONTH] de~THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datespanish(@_); +} + +if (defined &spanish_today) +{ + &do_datetime_spanish(@_); +} + +sub do_datetime_swedish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateswedish{'; + $tmp .= ' $dateformat = "THEDAY~MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + $tmp = ""; + $tmp .= 'sub do_cmd_datesymd{'; + $tmp .= ' $dateformat = "THEYEAR-TWODIGIT{THEMONTH}-TWODIGIT{THEDAY}";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + $tmp = ""; + $tmp .= 'sub do_cmd_datesdmy{'; + $tmp .= ' $dateformat = "THEDAY/THEMONTH THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateswedish(@_); +} + +if (defined &swedish_today) +{ + &do_datetime_swedish(@_); +} + +sub do_datetime_turkish{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateturkish{'; + $tmp .= ' $dateformat = "THEDAY~MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateturkish(@_); +} + +if (defined &turkish_today) +{ + &do_datetime_turkish(@_); +} + +sub do_datetime_ukraineb{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateukraineb{'; + $tmp .= ' $dateformat = "THEDAY~MONTHNAME[THEMONTH] THEYEAR~\\\\cyrr.";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateukraineb(@_); +} + +if (defined &ukraineb_today) +{ + &do_datetime_ukraineb(@_); +} + +sub do_datetime_usorbian{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_dateusorbian{'; + $tmp .= ' $dateformat = "THEDAY.~MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_dateusorbian(@_); +} + +if (defined &usorbian_today) +{ + &do_datetime_usorbian(@_); +} + +sub do_datetime_welsh{ + local($tmp) = ""; + + $tmp .= 'sub do_cmd_datewelsh{'; + $tmp .= ' $dateformat = "{ORDINALDATE{DAY}}\\ a viz MONTHNAME[THEMONTH] THEYEAR";'; + $tmp .= ' $_[0];'; + $tmp .= '}'; + + eval($tmp); + + $tmp = 'sub do_cmd_ordinaldate{'; + $tmp .= 'local($_) = @_;'; + $tmp .= 'local($num) = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($num=$2));'; + $tmp .= 'local($before) = $num;'; + + $tmp .= 'if ($num == 1)'; + $tmp .= '{ $before .= \'a\~n\'; }'; + + $tmp .= '$before . $_[0];'; + $tmp .= '}'; + + eval($tmp); + + &do_cmd_datewelsh(@_); +} + +if (defined &welsh_today) +{ + &do_datetime_welsh(@_); +} + +# As far as I know, LaTeX2HTML doesn't implement TeX conditionals. +# $showdow corresponds to LaTeX boolean variable showdow +$showdow = 1; + +sub get_monthname{ + local($month) = @_; + + if ($month eq 'THEMONTH' or $month eq '\THEMONTH') + { + # this is a cludge to help newdateformat work + + 'MONTHNAME[THEMONTH]'; + } + else + { + if ($month eq '') + { + local($today) = &get_date(); + $today =~ m|(\d+)/0?(\d+)/|; + $month = $1; + } + + $Month[$month]; + } +} + +sub do_cmd_monthname{ + local($_) = @_; + local($month,$pat) = &get_next_optional_argument; + + local($monthname) = &get_monthname($month); + join('',$monthname,$_); +} + +sub get_shortmonthname{ + local($month) = @_; + + if ($month eq 'THEMONTH' or $month eq '\THEMONTH') + { + 'SHORTMONTHNAME[THEMONTH]'; + } + else + { + substr(&get_monthname($month), 0, 3); + } +} + +sub do_cmd_shortmonthname{ + local($_) = @_; + local($month,$pat) = &get_next_optional_argument; + + local($monthname) = &get_shortmonthname($month); + + join('',$monthname,$_); +} + +sub is_leap_year{ + local($year) = @_; + local($isleapyear) = 0; + + if (($year%400) == 0) + { + # year mod 400 = 0 => leap year + + $isleapyear = 1; + } + elsif (($year%100) == 0) + { + # year mod 100 = 0 and year mod 400 != 0 => not a leap year + + $isleapyear = 0; + } + elsif (($year%4) == 0) + { + # year mod 4 = 0 and year mod 100 != 0 => leap year + + $isleapyear = 1; + } + + $isleapyear; +} + +sub get_day_of_year{ + local($day,$month,$year) = @_; + local($dayofyear) = 0; + + SWITCH: { + if ($month == 2) {$dayofyear += 31; last SWITCH; } + if ($month == 3) {$dayofyear += 59; last SWITCH; } + if ($month == 4) {$dayofyear += 90; last SWITCH; } + if ($month == 5) {$dayofyear += 120; last SWITCH; } + if ($month == 6) {$dayofyear += 151; last SWITCH; } + if ($month == 7) {$dayofyear += 181; last SWITCH; } + if ($month == 8) {$dayofyear += 212; last SWITCH; } + if ($month == 9) {$dayofyear += 243; last SWITCH; } + if ($month == 10) {$dayofyear += 273; last SWITCH; } + if ($month == 11) {$dayofyear += 304; last SWITCH; } + if ($month == 12) {$dayofyear += 334; last SWITCH; } + } + + if ($month > 2 && &is_leap_year($year)) + { + $dayofyear += 1; + } + + $dayofyear += $day; + local($_)=$dayofyear; +} + +sub get_day_of_week{ + local($day,$month,$year) = @_; + local($dayofyear) = &get_day_of_year($day,$month,$year); + local($_) = (((($year-1901)%28)*1.25 + 2)%7 + $dayofyear - 1)%7 + 1; +} + +sub get_day_of_weekname_english{ + local($dow) = @_; + + local(@DayOfWeek) = ('Sunday', + 'Monday', + 'Tuesday', + 'Wednesday', + 'Thursday', + 'Friday', + 'Saturday'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_day_of_weekname_french{ + local($dow) = @_; + + local(@DayOfWeek) = ('dimanche', + 'lundi', + 'mardi', + 'mercredi', + 'jeudi', + 'vendredi', + 'samedi'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_day_of_weekname_spanish{ + local($dow) = @_; + + local(@DayOfWeek) = ('domingo', + 'lunes', + 'martes', + 'mi\\\'ercoles', + 'jueves', + 'viernes', + 's\\\'abado'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_day_of_weekname_portuges{ + local($dow) = @_; + + local(@DayOfWeek) = ('domingo', + 'segunda-feira', + 'ter\c{c}a-feira', + 'quarta-feira', + 'quinta-feira', + 'sexta-feira', + 'sabado'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_day_of_weekname{ + local($dow)=@_; + local($dowsub); + + $dowsub = "get_day_of_weekname_$default_language"; + + if (defined ($dowsub)) + { + &$dowsub($dow); + } + else + { + &get_day_of_weekname_english($dow); + } +} + +sub get_short_day_of_weekname{ + local($dow)=@_; + + substr(&get_day_of_weekname($dow),0,3); +} + +sub do_cmd_dayofweeknameid{ + local($_) = @_; + local($dow); + + $dow = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($dow=$2)); + + join('',&get_day_of_weekname($dow), $_); +} + +sub do_cmd_dayofweekname{ + local($_) = @_; + local($day,$month,$year); + # read 1st argument + $day = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($day=$2)); + # read 2nd argument + $month = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($month=$2)); + # read 3rd argument + $year = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($year=$2)); + + if ($day eq 'THEDAY' or $day eq '\THEDAY') + { + # this is a cludge to help newdateformat work + + join('', '{DOW}', $_); + } + else + { + local($dow) = &get_day_of_week($day,$month,$year); + + join('',&get_day_of_weekname($dow), $_); + } +} + +sub do_cmd_shortdayofweekname{ + local($_) = @_; + local($day,$month,$year); + # read 1st argument + $day = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($day=$2)); + # read 2nd argument + $month = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($month=$2)); + # read 3rd argument + $year = &missing_braces unless ((s/$next_pair_pr_rx//o)&&($year=$2)); + + local($dow) = &get_day_of_week($day,$month,$year); + + join('',&get_short_day_of_weekname($dow), $_); +} + +sub do_cmd_thisdayofweekname{ + local($dow) = &get_day_of_week($global{DAY}, $global{MONTH}, $global{YEAR}); + + join('',$DayOfWeek[$dow], $_); +} + +sub do_cmd_thisshortdayofweekname{ + local($dow) = &get_day_of_week($global{DAY}, $global{MONTH}, $global{YEAR}); + + join('',&get_short_day_of_weekname($dow), $_); +} + +$dateformat = "\\ifshowdow{DOW}\\fi {ORDINALDATE{DAY}}\\ MONTHNAME[THEMONTH], THEYEAR"; + +sub format_date{ + local($day,$month,$year) = @_; + + local($str) = $dateformat; + + $str =~ s/THEDAY/$day/g; + $str =~ s/THEMONTH/$month/g; + $str =~ s/THEYEAR/$year/g; + + $str =~ s/TWODIGIT{([\d]+)}/&get_twodigit($1)/eg; + $str =~ s/ROMANNUMERAL{([\d]+)}/&froman($1)/eg; + $str =~ s/ROMANNUMERALU{([\d]+)}/uc(&froman($1))/eg; + $str =~ s/TRUNCATE{([\d]+)}/&get_twodigit($1%100)/eg; + $str =~ s/SHORTMONTHNAME\[([\d]+)\]/&get_shortmonthname($1)/eg; + $str =~ s/MONTHNAME\[([\d]+)\]/&get_monthname($1)/eg; + + local($X) = ++$global{'max_id'}; + local($Y) = ++$global{'max_id'}; + local($Z) = ++$global{'max_id'}; + $str =~ s/{DOW}/\\dayofweekname${OP}$X${CP}$day${OP}$X${CP}${OP}$Y${CP}$month${OP}$Y${CP}${OP}$Z${CP}$year${OP}$Z${CP}/g; + $str =~ s/{SDOW}/\\shortdayofweekname${OP}$X${CP}$day${OP}$X${CP}${OP}$Y${CP}$month${OP}$Y${CP}${OP}$Z${CP}$year${OP}$Z${CP}/g; + + local($br_id) = ++$global{'max_id'}; + $suffix = &get_ordinal_suffix($day); + $str =~ s/{ORDINAL{DAY}}/$day\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}/g; + + $br_id = ++$global{'max_id'}; + $suffix = &get_ordinal_suffix($month); + $str =~ s/{ORDINAL{MONTH}}/$month\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}/g; + + $br_id = ++$global{'max_id'}; + $suffix = &get_ordinal_suffix($year); + $str =~ s/{ORDINAL{YEAR}}/$year\\fmtord${OP}$br_id${CP}$suffix${OP}$br_id${CP}/g; + + local($br_id) = ++$global{'max_id'}; + $str =~ s/{ORDINALDATE{DAY}}/\\ordinaldate${OP}$br_id${CP}$day${OP}$br_id${CP}/g; + + $str =~ s/{NUMBERSTRING{DAY}}/&get_numberstring($day)/eg; + $str =~ s/{NUMBERSTRING{MONTH}}/&get_numberstring($month)/eg; + $str =~ s/{NUMBERSTRING{YEAR}}/&get_numberstring($year)/eg; + + $str =~ s/{ORDINALSTRING{DAY}}/&get_ordinalstring($day)/eg; + $str =~ s/{ORDINALSTRING{MONTH}}/&get_ordinalstring($month)/eg; + $str =~ s/{ORDINALSTRING{YEAR}}/&get_ordinalstring($year)/eg; + + $str =~ s/{NNUMBERSTRING{DAY}}/&get_Numberstring($day)/eg; + $str =~ s/{NNUMBERSTRING{MONTH}}/&get_Numberstring($month)/eg; + $str =~ s/{NNUMBERSTRING{YEAR}}/&get_Numberstring($year)/eg; + + $str =~ s/{OORDINALSTRING{DAY}}/&get_Ordinalstring($day)/eg; + $str =~ s/{OORDINALSTRING{MONTH}}/&get_Ordinalstring($month)/eg; + $str =~ s/{OORDINALSTRING{YEAR}}/&get_Ordinalstring($year)/eg; + + $str; +} + +sub do_cmd_formatdate{ + local($day,$month,$year); + # read 1st argument + $day = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($day=$2)); + # read 2nd argument + $month = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($month=$2)); + # read 3rd argument + $year = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($year=$2)); + + join('', &format_date($day,$month,$year), $_[0]); +} + +sub do_cmd_today{ + join('', &format_date($global{DAY},$global{MONTH},$global{YEAR}), $_[0]); +} + +sub do_cmd_day{ + join('', $global{DAY}, $_[0]); +} + +sub do_cmd_month{ + join('', $global{MONTH}, $_[0]); +} + +sub do_cmd_year{ + join('', $global{YEAR}, $_[0]); +} + +sub do_cmd_showdowtrue{ + local($_) = @_; + $showdow = 1; + $_[0]; +} + +sub do_cmd_showdowfalse{ + local($_) = @_; + $showdow = 0; + $_[0]; +} + +# This is a bit primative, it doesn't allow for +# nested conditionals + +sub do_cmd_ifshowdow{ + local($_) = @_; + local($ifbit,$elsebit); + + $_[0] =~s/(.*)\\fi//; + + $ifbit = $1; + + $ifbit =~s/(.*)\\else(.*)/\1/g; + + $elsebit = $2; + + if ($showdow) + { + join('', $ifbit, $_[0]); + } + else + { + join('', $elsebit, $_[0]); + } +} + +sub do_cmd_dateseparator{ + join('', '/', $_[0]); +} + +sub do_cmd_longdate{ + $dateformat = "\\ifshowdow{DOW}\\fi {ORDINALDATE{DAY}}\\ MONTHNAME[THEMONTH], THEYEAR"; + + $_[0]; +} + +sub do_cmd_shortdate{ + $dateformat = "\\ifshowdow{SDOW}\\fi {ORDINALDATE{DAY}}\\ SHORTMONTHNAME[THEMONTH], THEYEAR"; + + $_[0]; +} + +sub do_cmd_ddmmyyyydate{ + $dateformat = "TWODIGIT{THEDAY}\\dateseparator TWODIGIT{THEMONTH}\\dateseparator THEYEAR"; + + $_[0]; +} + +sub do_cmd_dmyyyydate{ + $dateformat = "THEDAY\\dateseparator THEMONTH\\dateseparator THEYEAR"; + + $_[0]; +} + +sub do_cmd_dmyydate{ + $dateformat = "THEDAY\\dateseparator THEMONTH\\dateseparator TRUNCATE{THEYEAR}"; + + $_[0]; +} + +sub do_cmd_ddmmyydate{ + $dateformat = "TWODIGIT{THEDAY}\\dateseparator TWODIGIT{THEMONTH}\\dateseparator TRUNCATE{THEYEAR}"; + + $_[0]; +} + +sub do_cmd_textdate{ + $dateformat = "\\ifshowdow{DOW} the\\fi {OORDINALSTRING{DAY}} of MONTHNAME[THEMONTH], {NNUMBERSTRING{YEAR}}"; + + $_[0]; +} + +sub do_cmd_usdate{ + $dateformat = "MONTHNAME[THEMONTH] THEDAY, THEYEAR"; + + $_[0]; +} + +sub do_cmd_mmddyyyydate{ + $dateformat = "TWODIGIT{THEMONTH}\\dateseparator TWODIGIT{THEDAY}\\dateseparator THEYEAR"; + + $_[0]; +} + +sub do_cmd_mdyyyydate{ + $dateformat = "THEMONTH\\dateseparator THEDAY\\dateseparator THEYEAR"; + + $_[0]; +} + +sub do_cmd_mmddyydate{ + $dateformat = "TWODIGIT{THEMONTH}\\dateseparator TWODIGIT{THEDAY}\\dateseparator TRUNCATE{THEYEAR}"; + + $_[0]; +} + +sub do_cmd_mdyydate{ + $dateformat = "THEMONTH\\dateseparator THEDAY\\dateseparator TRUNCATE{THEYEAR}"; + + $_[0]; +} + +sub do_cmd_THEYEAR{ + join('', 'THEYEAR', $_[0]); +} + +sub do_cmd_THEMONTH{ + join('', 'THEMONTH', $_[0]); +} + +sub do_cmd_THEDAY{ + join('', 'THEDAY', $_[0]); +} + +sub do_cmd_newdateformat{ + local($_) = @_; + local($cmd,$cmdbody); + local($ntmp); + + $cmd = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($cmd=$2)); + $cmdbody = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($cmdbody=$2)); + + $ntmp = 'sub do_cmd_' . $cmd . '{'; + $ntmp .= '$dateformat = "' . $cmdbody . '";'; + + $ntmp .= '$_[0];'; + $ntmp .= '}'; + + eval($ntmp); + + join('', $_[0]); +} + +sub do_cmd_pdfdate{ + local($_) = @_; + + local($timestring) = sprintf "%d%02d%02d%02d%02d%02d", + $global{YEAR}, $global{MONTH}, $global{DAY}, $global{HOUR}, $global{MINUTE}, $global{SECONDS}; + + join('', $timestring, $_[0]); +} + + %userdates = (); + +sub do_cmd_newdate{ + local($_)=@_; + local($datename,$mon,$day,$year); + + $datename = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($datename=$2)); + + $day = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($day=$2)); + + $mon = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($mon =$2)); + + $year = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($year =$2)); + + $userdates{$datename}{day} = $day; + $userdates{$datename}{month} = $mon; + $userdates{$datename}{year} = $year; + + join('', $_[0]); +} + +sub do_cmd_displaydate{ + local($_)=@_; + local($datename); + local($cmd,$br_id); + + $datename = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($datename=$2)); + + $br_id = ++$global{'max_id'}; + $cmd = "$OP$br_id$CP" . $userdates{$datename}{day} ."$OP$br_id$CP"; + $br_id = ++$global{'max_id'}; + $cmd .= "$OP$br_id$CP" . $userdates{$datename}{month} ."$OP$br_id$CP"; + $br_id = ++$global{'max_id'}; + $cmd .= "$OP$br_id$CP" . $userdates{$datename}{year} ."$OP$br_id$CP"; + + join('', '\formatdate', $cmd, $_[0]); +} + +sub do_cmd_getdateyear{ + local($_)=@_; + local($datename); + + $datename = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($datename=$2)); + + join('', $userdates{$datename}{year}, $_[0]); +} + +sub do_cmd_getdatemonth{ + local($_)=@_; + local($datename); + + $datename = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($datename=$2)); + + join('', $userdates{$datename}{month}, $_[0]); +} + +sub do_cmd_getdateday{ + local($_)=@_; + local($datename); + + $datename = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($datename=$2)); + + join('', $userdates{$datename}{day}, $_[0]); +} + +# time commands + +sub do_cmd_timeseparator{ + join('', ':', $_[0]); +} + +sub do_cmd_xxivtime{ + local($_) = @_; + + local($timestring) = sprintf "%02d\\timeseparator %02d", $global{HOUR}, $global{MINUTE}; + + join('', $timestring, $_[0]); +} + +sub do_cmd_noon{ + local($_) = @_; + + join('', "Noon", $_[0]); +} + +sub do_cmd_midnight{ + local($_) = @_; + + join('', "Midnight", $_[0]); +} + +sub do_cmd_amname{ + local($_) = @_; + + join('', "am", $_[0]); +} + +sub do_cmd_pmname{ + local($_) = @_; + + join('', "pm", $_[0]); +} + +sub do_cmd_amstring{ + local($_) = @_; + + join('', "in the morning", $_[0]); +} + +sub do_cmd_pmstring{ + local($_) = @_; + + join('', "in the afternoon", $_[0]); +} + +sub do_cmd_halfpast{ + local($_) = @_; + + join('', "Half past", $_[0]); +} + +sub do_cmd_quarterpast{ + local($_) = @_; + + join('', "Quarter past", $_[0]); +} + +sub do_cmd_quarterto{ + local($_) = @_; + + join('', "Quarter to", $_[0]); +} + +sub do_cmd_oclockstring{ + local($_) = @_; + + join('', "O'Clock", $_[0]); +} + +sub do_cmd_amorpmname{ + if ($global{HOUR}>12) + { + &do_cmd_pmname; + } + else + { + &do_cmd_amname; + } +} + +sub do_cmd_amorpmstring{ + if ($global{HOUR}>12) + { + &do_cmd_pmstring; + } + else + { + &do_cmd_amstring; + } +} + +sub do_cmd_ampmtime{ + local($_) = @_; + local($timestring); + + $timestring = sprintf "%d\\timeseparator %02d\\amorpmname", $global{HOUR}, $global{MINUTE}; + + join('', $timestring, $_[0]); +} + +sub do_cmd_oclock{ + local($_) = @_; + local($timestring); + + if ($global{HOUR} == 0 && $global{MINUTE} == 0) + { + $timestring = "\\midnight"; + } + elsif ($global{HOUR} == 12 && $global{MINUTE} == 0) + { + $timestring = "\\noon"; + } + else + { + if ($global{MINUTE} == 0) + { + $timestring = &get_Numberstring($global{HOURXII}) . " \\oclockstring"; + } + elsif ($global{MINUTE} == 15) + { + $timestring = "\\quarterpast\\ " . &get_Numberstring($global{HOURXII}); + } + elsif ($global{MINUTE} == 30) + { + $timestring = "\\halfpast\\ " . &get_Numberstring($global{HOURXII}); + } + elsif ($global{MINUTE} == 45) + { + $timestring = "\\quarterto\\ " . &get_Numberstring($global{TOHOUR}); + } + elsif ($global{MINUTE} < 30) + { + $timestring = get_Numberstring($global{MINUTE}); + + $timestring .= ($global{MINUTE} == 1 ? " minute" : " minutes") . " past "; + + $timestring .= get_Numberstring($global{HOURXII}); + } + else + { + $timestring = get_Numberstring($global{TOMINUTE}); + + $timestring .= ($global{MINUTE} == 1 ? " minute" : " minutes") . " to "; + + $timestring .= get_Numberstring($global{TOHOUR}); + } + + $timestring .= ($global{HOUR} < 12 ? " \\amstring" : " \\pmstring"); + } + + join('', $timestring, $_[0]); +} + +sub do_cmd_currenttime{ + local($_) = @_; + + join('', "\\xxivtime", $_[0]); +} + +sub do_cmd_settimeformat{ + local($_) = @_; + local($cmd); + + $cmd = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($cmd=$2)); + + #$tmp = 'sub do_cmd_currenttime{local($_) = @_; join(\'\', "\\\\' . $cmd . '", $_[0]); }'; + + $tmp = 'sub do_cmd_currenttime{&do_cmd_' . $cmd . '(@_);}'; + + eval($tmp); + + join('', $_[0]); +} + +sub do_cmd_newtimeformat{ + local($_) = @_; + local($cmd,$cmdbody); + + $cmd = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($cmd=$2)); + $cmdbody = &missing_braces unless ($_[0]=~(s/$next_pair_pr_rx//o)&&($cmdbody=$2)); + + $tmp = 'sub do_cmd_' . $cmd . '{' . "\n"; + + $tmp .= 'local($_) = @_;'. "\n"; + + $tmp .= 'join(\'\',"' . $cmdbody. '", $_[0]); }'; + + eval($tmp); + + join('', $_[0]); +} + +sub do_cmd_THEHOUR{ + local($_) = @_; + + join('', $global{HOUR}, $_[0]); +} + +sub do_cmd_THEMINUTE{ + local($_) = @_; + + join('', $global{MINUTE}, $_[0]); +} + +sub do_cmd_THETOHOUR{ + local($_) = @_; + + join('', $global{TOHOUR}, $_[0]); +} + +sub do_cmd_THETOMINUTE{ + local($_) = @_; + + join('', $global{TOMINUTE}, $_[0]); +} + +sub do_cmd_THEHOURXII{ + local($_) = @_; + + join('', $global{HOURXII}, $_[0]); +} + +1; diff --git a/Master/texmf-dist/doc/latex/datetime/dt-sampl.tex b/Master/texmf-dist/doc/latex/datetime/dt-sampl.tex new file mode 100644 index 00000000000..44f781b5578 --- /dev/null +++ b/Master/texmf-dist/doc/latex/datetime/dt-sampl.tex @@ -0,0 +1,126 @@ +%% +%% This is file `dt-sampl.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datetime.dtx (with options: `dt-sampl.tex,package') +%% Copyright (C) 2005 Nicola Talbot, all rights reserved. +%% If you modify this file, you must change its name first. +%% You are NOT ALLOWED to distribute this file alone. You are NOT +%% ALLOWED to take money for the distribution or use of either this +%% file or a changed version, except for a nominal charge for copying +%% etc. +%% \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 \~} +\documentclass[a4paper]{article} + +\usepackage{ifpdf} +\usepackage{datetime} + +\ifpdf +\pdfinfo{ + /CreationDate (D:20040501215500) + /ModDate (D:\pdfdate) +} +\fi + +\padzeroes[8] + +\newdateformat{dashdate}{\twodigit{\THEDAY}-\twodigit{\THEMONTH}-\THEYEAR} +\newdateformat{usvardate}{\monthname[\THEMONTH]~\ordinaldate{\THEDAY}, \THEYEAR} +\newdateformat{mydate}{\ifshowdow \dayofweekname{\THEDAY}{\THEMONTH}{\THEYEAR} \fi +\THEDAY\ \monthname[\THEMONTH], \THEYEAR} +\newdateformat{yyyymmdd}{\THEYEAR\twodigit{\THEMONTH}\twodigit{\THEDAY}} + +\newtimeformat{dottime}{\twodigit{\THEHOUR}.\twodigit{\THEMINUTE}} +\newtimeformat{dashtime12}{\THEHOURXII-\twodigit{\THEMINUTE}} +\newtimeformat{hhmm}{\twodigit{\THEHOUR}\twodigit{\THEMINUTE}} + +\begin{document} + +\section{Date Formats} +Default: \today. + +\begin{tabular}{ll} +\bfseries Declaration & \bfseries\verb|\today|\\ +\verb|\longdate| & \longdate\today\\ +\verb|\shortdate| & \shortdate\today\\ +\verb|\ddmmyyyydate| & \ddmmyyyydate\today\\ +\verb|\dmyyyydate| & \dmyyyydate\today\\ +\verb|\ddmmyydate| & \ddmmyydate\today\\ +\verb|\dmyydate| & \dmyydate\today\\ +\verb|\textdate| & \textdate\today\\ +\verb|\usdate| & \usdate\today\\ +\verb|\mmddyyyydate| & \mmddyyyydate\today\\ +\verb|\mdyyyydate| & \mdyyyydate\today\\ +\verb|\mmddyydate| & \mmddyydate\today\\ +\verb|\mdyydate| & \mdyydate\today +\end{tabular} + +\section{Time Formats} +Default: \currenttime. + +\begin{tabular}{@{\ttfamily}ll} +\bfseries\rmfamily Format & \bfseries \verb|\currenttime|\\ +xxivtime & \settimeformat{xxivtime}\currenttime\\ +ampmtime & \settimeformat{ampmtime}\currenttime\\ +oclock & \settimeformat{oclock}\currenttime +\end{tabular} + +\section{Specific Date:} + +\begin{tabular}{ll} +\verb|\longdate| & \longdate\formatdate{1}{3}{2000}\\ +\verb|\shortdate| & \shortdate\formatdate{8}{3}{2000}\\ +\verb|\ddmmyyyydate| & \ddmmyyyydate\formatdate{8}{3}{2000}\\ +\verb|\dmyyyydate| & \dmyyyydate\formatdate{8}{3}{2000}\\ +\verb|\ddmmyydate| & \ddmmyydate\formatdate{8}{3}{2000}\\ +\verb|\dmyydate| & \dmyydate\formatdate{8}{3}{2000}\\ +\verb|\textdate| & \textdate\formatdate{8}{3}{2000}\\ +\verb|\usdate| & \usdate\formatdate{8}{3}{2000}\\ +\verb|\mmddyyyydate| & \mmddyyyydate\formatdate{8}{3}{2000}\\ +\verb|\mdyyyydate| & \mdyyyydate\formatdate{8}{3}{2000}\\ +\verb|\mmddyydate| & \mmddyydate\formatdate{8}{3}{2000}\\ +\verb|\mdyydate| & \mdyydate\formatdate{8}{3}{2000} +\end{tabular} + +\section{Defining New Dates} + +\begin{tabular}{ll} +\verb|\dashdate| & \dashdate\today\\ +\verb|\usvardate| & \usvardate\today\\ +\verb|\mydate| & \mydate\today\\ +\verb|\yyyymmdd| & \yyyymmdd\today\\ +\verb|\dashdate| & \dashdate\formatdate{8}{3}{2000}\\ +\verb|\usvardate| & \usvardate\formatdate{8}{3}{2000}\\ +\verb|\mydate| & \mydate\formatdate{8}{3}{2000}\\ +\verb|\yyyymmdd| & \yyyymmdd\formatdate{8}{3}{2000} +\end{tabular} + +\section{Defining New Times} + +\begin{tabular}{@{\ttfamily}ll} +\bfseries\rmfamily Format & \bfseries \verb|\currenttime|\\ +dottime & \settimeformat{dottime}\currenttime\\ +dashtime12 & \settimeformat{dashtime12}\currenttime\\ +hhmm & \settimeformat{hhmm}\currenttime +\end{tabular} + +\end{document} +\endinput +%% +%% End of file `dt-sampl.tex'. diff --git a/Master/texmf-dist/doc/latex/datetime/manual.html b/Master/texmf-dist/doc/latex/datetime/manual.html new file mode 100644 index 00000000000..b94fed19019 --- /dev/null +++ b/Master/texmf-dist/doc/latex/datetime/manual.html @@ -0,0 +1,853 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> + +<!--Converted with jLaTeX2HTML 2002-2-1 (1.70) JA patch-2.0 +patched version by: Kenshi Muto, Debian Project. +* modified by: Shige TAKENO +LaTeX2HTML 2002-2-1 (1.70), +original version by: Nikos Drakos, CBLU, University of Leeds +* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan +* with significant contributions from: + Jens Lippmann, Marek Rouchal, Martin Wilck and others --> +<HTML> +<HEAD> +<TITLE>datetime.sty v2.46: Formatting Current Date and Time</TITLE> +<META NAME="description" CONTENT="datetime.sty v2.46: Formatting Current Date and Time"> +<META NAME="keywords" CONTENT="manual"> +<META NAME="resource-type" CONTENT="document"> +<META NAME="distribution" CONTENT="global"> + +<META NAME="Generator" CONTENT="jLaTeX2HTML v2002-2-1 JA patch-2.0"> +<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> + + +</HEAD> + +<BODY > +<A NAME="tex2html1" + HREF="http://theoval.cmp.uea.ac.uk/~nlct/">Dr Nicola Talbot</A> +| +<A NAME="tex2html2" + HREF="http://www.cmp.uea.ac.uk/">School of Computing Sciences</A> +| +<A NAME="tex2html3" + HREF="http://www.uea.ac.uk/">University of East Anglia</A> + +<P> + +<P> + + <H1 ALIGN="CENTER">datetime.sty v2.46: Formatting Current Date and +Time</H1> +<DIV> + +<P ALIGN="CENTER"><STRONG>N.L.C. Talbot</STRONG></P> +<P ALIGN="CENTER"><STRONG>25 May 2005</STRONG></P> +</DIV> + <BR> + +<H2><A NAME="SECTION00010000000000000000"> +Contents</A> +</H2> +<!--Table of Contents--> + +<UL> +<LI><A NAME="tex2html26" + HREF="manual.html#SECTION00020000000000000000">Introduction</A> +<LI><A NAME="tex2html27" + HREF="manual.html#SECTION00030000000000000000">Date Declarations</A> +<LI><A NAME="tex2html28" + HREF="manual.html#SECTION00040000000000000000">Time Commands</A> +<LI><A NAME="tex2html29" + HREF="manual.html#SECTION00050000000000000000">Formating Dates</A> +<LI><A NAME="tex2html30" + HREF="manual.html#SECTION00060000000000000000">Defining New Date Formats</A> +<LI><A NAME="tex2html31" + HREF="manual.html#SECTION00070000000000000000">Saving Dates</A> +<LI><A NAME="tex2html32" + HREF="manual.html#SECTION00080000000000000000">Predefined Names</A> +<LI><A NAME="tex2html33" + HREF="manual.html#SECTION00090000000000000000">Package Options</A> +<LI><A NAME="tex2html34" + HREF="manual.html#SECTION000100000000000000000">Multilingual Support</A> +<LI><A NAME="tex2html35" + HREF="manual.html#SECTION000110000000000000000">Configuration File</A> +<LI><A NAME="tex2html36" + HREF="manual.html#SECTION000120000000000000000">LaTeX2HTML styles</A> +<LI><A NAME="tex2html37" + HREF="manual.html#SECTION000130000000000000000">Contact Details</A> +</UL> +<!--End of Table of Contents--> +<H1><A NAME="SECTION00020000000000000000"> +Introduction</A> +</H1> + +The <TT>datetime</TT> package is a LaTeX2e package that +provides various different formats for <code>\today</code>, +and provides commands for displaying the current time. +If you only want the +time commands but not the date changing commands, you can pass +the option <TT>nodate</TT> to the package. + +<P> +Since version 2.4, the <TT>datetime</TT> package has been +separated into two packages: <TT>datetime</TT> and +<TT>fmtcount</TT>. When I originally created this package, +I defined the commands, <code>\ordinal</code> etc which could be used +in the definition of <code>\today</code>. Since then, I have extended +the number of commands available that can be used to display the +value of a LaTeX counter, however it seems more appropriate to +define all these counter-related commands in a separate package. +The <TT>fmtcount</TT> package is now distributed separately +from the <TT>datetime</TT> package, and will also need to +be installed. + +<P> +As from version 2.42, the <TT>datetime</TT> package is now +compatible with <TT>babel</TT>, however you must load the +<TT>datetime</TT> package <I>after</I> the <TT>babel</TT> package. For example: +<PRE> +\usepackage[francais]{babel} +\usepackage{datetime} +</PRE> + +<P> + +<H1><A NAME="SECTION00030000000000000000"> +Date Declarations</A> +</H1> + There are various declarations that change the effect of +<code>\today</code>. The change can be localised by placing the +declaration within a group. + +<P> + + <I>Day</I> <I>Month</I> <I>Year</I> formats: +<BR> +The declaration <code>\longdate</code> will redefine +<code>\today</code> to produce the current date displayed in the form +Wednesday 8<SUP>th</SUP> March, 2000 + if the package option <TT>dayofweek</TT> is used, or +8<SUP>th</SUP> March, 2000 if the package option + <TT>nodayofweek</TT> is used. +<BR> +The declaration <code>\shortdate</code> will redefine +<code>\today</code> to produce the current date displayed in the form +Wed 8<SUP>th</SUP> Mar, 2000 if the package option +<TT>dayofweek</TT> is used, or 8<SUP>th</SUP> Mar, 2000 +if the package option <TT>nodayofweek</TT> is used. +<BR> +The declaration <code>\ddmmyyyydate</code> will redefine +<code>\today</code> to produce + the current date displayed in the form 08/03/2000 +<BR> +The declaration <code>\dmyyyydate</code> will redefine +<code>\today</code> to produce + the current date displayed in the form 8/3/2000 +<BR> +The declaration <code>\ddmmyydate</code> will redefine +<code>\today</code> to produce + the current date displayed in the form 08/03/00 +<BR> +The declaration <code>\dmyydate</code> will redefine +<code>\today</code> to produce + the current date displayed in the form 8/3/00 +<BR> +The declaration <code>\textdate</code> will redefine +<code>\today</code> to produce the current date displayed in the form: +Wednesday the Eighth of March, Two Thousand if the package option +<TT>dayofweek</TT> is used, or Eighth of March, Two Thousand if +the package option <TT>nodayofweek</TT> is used. + +<P> + + <I>Month</I> <I>Day</I> <I>Year</I> formats: +<BR> +The declaration <code>\usdate</code> will redefine +<code>\today</code> to produce the current date displayed in the form +March 8, 2000. (As TeX and LaTeX do by default.) +<BR> +The declaration <code>\mmddyyyydate</code> will redefine +<code>\today</code> to produce the current date displayed in the form +03/08/2000 +<BR> +The declaration <code>\mdyyyydate</code> will redefine +<code>\today</code> to produce the current date displayed in the form +3/8/2000 +<BR> +The declaration <code>\mmddyydate</code> will redefine +<code>\today</code> to produce the current date displayed in the form +03/08/00 +<BR> +The declaration <code>\mdyydate</code> will redefine +<code>\today</code> to produce the current date displayed in the form +3/8/00 + +<P> +In addition, the declarations <code>\date</code><I>lang</I> are +available for all languages defined either by +calling <TT>babel</TT> prior to <TT>datetime</TT> or by +passing the language name as an option to <TT>datetime</TT>. +See <A HREF="#sec:newdate">later</A> +if you want to define your own customised date format. + +<P> +As from version 2.43, the numerical date formats (such as +<code>\ddmmyyyydate</code>) use the command +<code>\dateseparator</code> to separate the numbers. So, for example, +if you want to hyphens instead of slashes, you can do: +<PRE> +\renewcommand{\dateseparator}{-} +</PRE> + +<P> + +<H1><A NAME="SECTION00040000000000000000"> +Time Commands</A> +</H1> + + The current time is displayed using the command +<code>\currenttime</code>. + + The format can be changed using the declaration +<code>\settimeformat{</code><I>style</I><code>}</code>, + where <I>style</I> is the name of the format<A NAME="tex2html4" + HREF="#foot371"><SUP>1</SUP></A>. Available +formats are: +<DL> +<DT><STRONG>xxivtime</STRONG></DT> +<DD>Twenty-four hour time in the form 22:28 (Default) +</DD> +<DT><STRONG>ampmtime</STRONG></DT> +<DD>Twelve hour time in the form 10:28pm +</DD> +<DT><STRONG>oclock</STRONG></DT> +<DD>Displays the current time as a string, e.g. +Twenty-Eight minutes past Ten in the afternoon.<A NAME="tex2html5" + HREF="#foot131"><SUP>2</SUP></A> +</DD> +</DL> + +<P> +New time formats can be defined using the command: +<BR> +<BR><code>\newtimeformat{</code><I>name</I><code>}{</code><I>format</I><code>}</code> +<BR> +<BR> +where <I>name</I> is the name of the new format (used in +<code>\settimeformat</code>), and <I>format</I> is how to format the +time. Within <I>format</I> you can use the counters +<TT>HOUR</TT> (number of hours after midnight), <TT>MINUTE</TT> +(number of minutes past the hour), <TT>HOURXII</TT> (number of +hours after midnight/midday), <TT>TOHOUR</TT> (the next hour) + and <TT>TOMINUTE</TT> (number of minutes to the next hour), and +the corresponding commands: + <code>\THEHOUR</code>, +<code>\THEMINUTE</code>, +<code>\THEHOURXII</code>, +<code>\THETOHOUR</code> and +<code>\THETOMINUTE</code>. + +<P> +For example, to define a new time format that uses a dot instead of a colon: +<PRE> +\newtimeformat{dottime}{\twodigit{\THEHOUR}.\twodigit{\THEMINUTE}} +</PRE> +You then need to switch to this new format before you can use it: +<PRE> +\settimeformat{dottime} +\currenttime +</PRE> + +<P> +As from version 2.43, if you only want to change the separator, +you can simply redefine <code>\timeseparator</code> +instead of defining a new time format. For example: +<PRE> +\renewcommand{\timeseparator}{.} +</PRE> +The <TT>xxivtime</TT> format will now work like the <TT>dottime</TT> format defined above. + +<P> + +<H1><A NAME="SECTION00050000000000000000"> +Formating Dates</A> +</H1> + + The command <code>\pdfdate</code><A NAME="tex2html6" + HREF="#foot169"><SUP>3</SUP></A> prints the date in the format required for + PDF files, e.g. if the date is 1 May 2004 and time is + 22:02, <code>\pdfdate</code> will print 20040501220200. The reason +this date format is separate from all the others is because the +other form doesn't get properly expanded by PDFTeX. (This +command is defined regardless of whether the package option +<TT>nodate</TT> is called.) +Example: +<PRE> +\pdfinfo{ + /Author (Me) + /Title (A Sample Document) + /CreationDate (D:20040501215500) + /ModificationDate (D:\pdfdate) +} +</PRE> + +<P> +There are two commands that print the name of the current + month: + + <code>\monthname</code> prints the current month name in full, +e.g. August, and + + <code>\shortmonthname</code> prints the abbreviated month name, +e.g. Aug. Both <code>\monthname</code> and +<code>\shortmonthname</code> take an optional argument (a number from +1 to 12) if the name of a specific month is required. For +example, <code>\monthname[6]</code> will produced the output: June. + +<P> +The day of the week is computed using the algorithm documented at + <TT><A NAME="tex2html7" + HREF="http://userpages.wittenburg.edu/bshelburne/Comp150/DayOfWeek.htm">http://userpages.wittenburg.edu/bshelburne/Comp150/DayOfWeek.htm</A></TT>. + This algorithm works for any date between 1<SUP>st</SUP> +Jan, 1901 and 31<SUP>st</SUP> Dec, 2099. + The following macros display the day of week for a given date: + +<P> + + <code>\dayofweekname{</code><I>day</I><code>}{</code><I>month</I><code>}{</code><I>year</I><code>}</code> prints the + day of week for the specified date. For example, +<code>\dayofweekname{31}{10}{2002}</code> + will produce the output: Thursday. +<BR> + <code>\shortdayofweekname{</code><I>day</I><code>}{</code><I>month</I><code>}{</code><I>year</I><code>}</code> prints the abbreviated name for the + day of week for the specified date. For example +<BR> <code>\shortdayofweekname{31}{10}{2002}</code> +<BR> +will produce the output: Thu. + +<P> +The TeX conditional <code>\ifshowdow</code> can be used to determine + whether or not the option <TT>dayofweek</TT> has been passed to +the package. + For example: +<PRE> +\ifshowdow\dayofweekname{31}{10}{2002} \fi +</PRE> + will only display the day of week if the <TT>dayofweek</TT> +option was passed to <TT>datetime</TT>. + Alternatively, you can use David Carlisle's <TT>ifthen</TT> +package: +<PRE> +\ifthenelse{\boolean{showdow}}{\dayofweekname{31}{10}{2002} }{} +</PRE> + +<P> +The command <code>\ordinaldate{</code><I>number</I><code>}</code> +displays <I>number</I> as a date-type ordinal. If the +current language is English, this will simply pass +the argument to <code>\ordinalnum</code> (defined in the +<TT>fmtcount</TT> package), +if the current language is Breton, Welsh or French, a superscript +will only be added if <I>number</I> is 1, otherwise only +<I>number</I> will be displayed. + +<P> +The macro <code>\formatdate{</code><I>day</I><code>}{</code><I>month</I><code>}{</code><I>year</I><code>}</code><A NAME="tex2html8" + HREF="#foot373"><SUP>4</SUP></A> formats + the specified date according to the current format of +<code>\today</code><A NAME="tex2html9" + HREF="#foot374"><SUP>5</SUP></A>. (Arguments + must all be integers.) For example, in combination with +<code>\longdate</code>, the command +<BR><code>\formatdate{27}{9}{2004}</code> +<BR> +will produce the output: Monday 27<SUP>th</SUP> +September, 2004. + +<P> +You can ensure that a number is displayed with at least two +digits by using the command +<code>\twodigit{</code><I>num</I><code>}</code><A NAME="tex2html10" + HREF="#foot233"><SUP>6</SUP></A>. + This is of use if you want to define your own date or time +formats. + +<P> + +<H1><A NAME="SECTION00060000000000000000"></A><A NAME="sec:newdate"></A> +<BR> +Defining New Date Formats +</H1> + +<P> +New date formats can be defined using the command: +<BR> +<BR> <code>\newdateformat{</code><I>name</I><code>}{</code><I>format</I><code>}</code> +<BR> +<BR> +where <I>name</I> is the name of the new format, and + <I>format</I> is how to format the date. Within the + argument <I>format</I> you can use the commands <code>\THEDAY</code>, +<code>\THEMONTH</code> + and <code>\THEYEAR</code> to represent the relevant day, month and +year, or you can use the counters + <TT>DAY</TT>, <TT>MONTH</TT> and <TT>YEAR</TT> if you want to +use <code>\ordinal</code> etc. Once you have defined the + new date format, you can then switch to it using the declaration <code>\</code><I>name</I> + (i.e. the name you specified preceded by a backslash), and + subsequent calls to <code>\today</code> and <code>\formatdate</code> will +use your new format. + +<P> +For example, suppose you want to define a new date format called, + say, <TT>mydate</TT>, that will typeset the date in the form: +8-3-2002, + then you can do: +<PRE> +\newdateformat{mydate}{\THEDAY-\THEMONTH-\THEYEAR} +</PRE> + <code>\newdateformat</code> will then define the declaration +<code>\mydate</code> which can be used to + switch to your new format. In the following example, + two new date formats are defined, and they are then + selected to produce two different formats for the current date: +<PRE> +\newdateformat{dashdate}{% +\twodigit{\THEDAY}-\twodigit{\THEMONTH}-\THEYEAR} + +\newdateformat{usvardate}{% +\monthname[\THEMONTH] \ordinal{DAY}, \THEYEAR} + +Dash: \dashdate\today. +US: \usvardate\today. +</PRE> +If the current date is, say, 8th March, 2002, the above code will + produce the following: +Dash: 08-03-2002. +US: March 8<SUP>th</SUP>, 2002. + +<P> +Note that <code>\THEDAY</code> etc and <TT>DAY</TT> etc have no real +meaning outside <code>\newdateformat</code> (this is why they +are in uppercase). Incidentally, the <TT>dashdate</TT> format +is not really necessary, as you can achieve this format +using: +<PRE> +\renewcommand{\dateseparator}{-} +\ddmmyyyydate +</PRE> + +<P> +Another note: in the above code, <code>\ordinal</code> was +used to illustrate the use of the <TT>DAY</TT> counter. It +is better to use <code>\ordinaldate</code> instead: +<PRE> +\newdateformat{usvardate}{% +\monthname[\THEMONTH] \ordinaldate{\THEDAY}, \THEYEAR} +</PRE> + +<P> + +<H1><A NAME="SECTION00070000000000000000"> +Saving Dates</A> +</H1> + +<P> +It is possible to save a date for later use using the command: +<A NAME="tex2html11" + HREF="#foot266"><SUP>7</SUP></A> +<P> + +<code>\newdate{</code><I>name</I><code>}{</code><I>day</I><code>}{</code><I>month</I><code>}{</code><I>year</I><code>}</code> + +<P> +This date can later be displayed using the same format as that +used by <code>\formatdate</code> using the command: +<P> + +<code>\displaydate{</code><I>name</I><code>}</code> + +<P> +Individual elements of the date can be extracted using the +commands: +<P> + +<code>\getdateday{</code><I>name</I><code>}</code> +<P> + +<code>\getdatemonth{</code><I>name</I><code>}</code> +<P> + +<code>\getdateyear{</code><I>name</I><code>}</code> + +<P> + +<H1><A NAME="SECTION00080000000000000000"> +Predefined Names</A> +</H1> + +<P> +The following commands are defined by the <TT>datetime</TT> +package: + +<P> +<TABLE CELLPADDING=3> +<TR><TH ALIGN="LEFT"><B>Command Name </B></TH> +<TH ALIGN="LEFT"><B>Default Value</B></TH> +</TR> +<TR><TD ALIGN="LEFT"><code>\dateseparator</code></TD> +<TD ALIGN="LEFT"><code>/</code></TD> +</TR> +<TR><TD ALIGN="LEFT"><code>\timeseparator</code></TD> +<TD ALIGN="LEFT"><code>:</code></TD> +</TR> +<TR><TD ALIGN="LEFT"><code>\amname</code></TD> +<TD ALIGN="LEFT"><TT>am</TT></TD> +</TR> +<TR><TD ALIGN="LEFT"><code>\pmname</code></TD> +<TD ALIGN="LEFT"><TT>pm</TT></TD> +</TR> +<TR><TD ALIGN="LEFT"><code>\amorpmname</code></TD> +<TD ALIGN="LEFT"><code>\amname</code> if morning, otherwise +<code>\pmname</code></TD> +</TR> +<TR><TD ALIGN="LEFT"><code>\amstring</code></TD> +<TD ALIGN="LEFT"><TT>in the morning</TT></TD> +</TR> +<TR><TD ALIGN="LEFT"><code>\pmstring</code></TD> +<TD ALIGN="LEFT"><TT>in the afternoon</TT></TD> +</TR> +<TR><TD ALIGN="LEFT"><code>\amorpmstring</code></TD> +<TD ALIGN="LEFT"><code>\amstring</code> if morning, otherwise +<code>\pmstring</code></TD> +</TR> +<TR><TD ALIGN="LEFT"><code>\halfpast</code></TD> +<TD ALIGN="LEFT"><TT>Half past</TT></TD> +</TR> +<TR><TD ALIGN="LEFT"><code>\quarterpast</code></TD> +<TD ALIGN="LEFT"><TT>Quarter past</TT></TD> +</TR> +<TR><TD ALIGN="LEFT"><code>\quarterto</code></TD> +<TD ALIGN="LEFT"><TT>Quarter to</TT></TD> +</TR> +<TR><TD ALIGN="LEFT"><code>\noon</code></TD> +<TD ALIGN="LEFT"><TT>Noon</TT></TD> +</TR> +<TR><TD ALIGN="LEFT"><code>\midnight</code></TD> +<TD ALIGN="LEFT"><TT>Midnight</TT></TD> +</TR> +<TR><TD ALIGN="LEFT"><code>\oclockstring</code></TD> +<TD ALIGN="LEFT"><TT>O'Clock</TT></TD> +</TR> +</TABLE> + +<P> + +<H1><A NAME="SECTION00090000000000000000"> +Package Options</A> +</H1> + +<P> +The following options may be passed to this package: +<BR> +<BR> <TABLE CELLPADDING=3> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">long </TT></TD> +<TD ALIGN="LEFT">make <code>\today</code> produce long date</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">short </TT></TD> +<TD ALIGN="LEFT">make <code>\today</code> produce short date</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">ddmmyyyy </TT></TD> +<TD ALIGN="LEFT">make <code>\today</code> produce DD/MM/YYYY date</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">dmyyyy </TT></TD> +<TD ALIGN="LEFT">make <code>\today</code> produce D/M/YYYY date</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">ddmmyy </TT></TD> +<TD ALIGN="LEFT">make <code>\today</code> produce DD/MM/YY date</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">dmyy </TT></TD> +<TD ALIGN="LEFT">make <code>\today</code> produce D/M/YY date</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">text </TT></TD> +<TD ALIGN="LEFT">make <code>\today</code> produce text date</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">us </TT></TD> +<TD ALIGN="LEFT">make <code>\today</code> produce US style date</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">mmddyyyy </TT></TD> +<TD ALIGN="LEFT">make <code>\today</code> produce MM/DD/YYYY date</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">mdyyyy </TT></TD> +<TD ALIGN="LEFT">make <code>\today</code> produce M/D/YYYY date</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">mmddyy </TT></TD> +<TD ALIGN="LEFT">make <code>\today</code> produce MM/DD/YY date</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">mdyy </TT></TD> +<TD ALIGN="LEFT">make <code>\today</code> produce M/D/YY date</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">raise </TT></TD> +<TD ALIGN="LEFT">make ordinal st,nd,rd,th appear as superscript</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">level </TT></TD> +<TD ALIGN="LEFT">make ordinal st,nd,rd,th appear level with rest of +text</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">dayofweek </TT></TD> +<TD ALIGN="LEFT">make the day of week appear for <code>\longdate</code>, +<code>\shortdate</code></TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT"></TT></TD> +<TD ALIGN="LEFT">or <code>\textdate</code></TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">nodayofweek </TT></TD> +<TD ALIGN="LEFT">don't display the day of week.</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">24hr </TT></TD> +<TD ALIGN="LEFT">make <code>\currenttime</code> produce <TT>xxivtime</TT> +format</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">12hr </TT></TD> +<TD ALIGN="LEFT">make <code>\currenttime</code> produce <TT>ampmtime</TT> +format</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">oclock </TT></TD> +<TD ALIGN="LEFT">make <code>\currenttime</code> produce <TT>oclock</TT> +format</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT">nodate </TT></TD> +<TD ALIGN="LEFT">Don't redefine <code>\today</code> or define the month or +day of week commands</TD> +</TR> +<TR><TD ALIGN="LEFT"><TT></TD><TD ALIGN="LEFT"></TT></TD> +<TD ALIGN="LEFT">(useful if you only want the time commands or +<code>\pdfdate</code>)</TD> +</TR> +</TABLE> + +<P> +The default options are: <TT>long</TT>, <TT>raise</TT>, +<TT>dayofweek</TT> and <TT>24hr</TT>. + +<P> + +<H1><A NAME="SECTION000100000000000000000"> +Multilingual Support</A> +</H1> + +<P> +If the <TT>babel</TT> package is called prior to +<TT>datetime</TT>, <code>\date</code><I>lang</I> +will be the default date format, +where <I>lang</I> is the current language. + +<P> +The commands <code>\monthname</code> and <code>\shortmonthname</code>, +will produce the month name in the current language. +If you want the month name in a specific language, you +can use the command <code>\monthname</code><I>lang</I>. +For example, <code>\monthnamefrench[6]</code> will produce the output: +juin. + +<P> +There is currently only limited multilingual support for +<code>\dayofweekname</code> and <code>\shortdayofweekname</code> (just +English, French, Portuguese and Spanish). You can add support for +other languages by defining the commands +<code>\dayofweeknameid</code><I>lang</I> and +<code>\shortdayofweeknameid</code><I>lang</I>. Note that these +commands only take <I>one</I> argument which should be +a number from 1 to 7 indicating the day of the week. + +<P> +You can use the following as templates. Replace +<TT>english</TT> with the name of your language (as given +by <code>\languagename</code>) and replace <TT>Sunday</TT> +etc as appropriate: +<PRE> +\providecommand{\dayofweeknameidenglish}[1]{% +\ifcase#1\relax +\or Sunday% +\or Monday% +\or Tuesday% +\or Wednesday% +\or Thursday% +\or Friday% +\or Saturday% +\fi} + +\providecommand{\shortdayofweekidnameenglish}[1]{% +\ifcase#1\relax +\or Sun% +\or Mon% +\or Tue% +\or Wed% +\or Thu% +\or Fri% +\or Sat% +\fi} +</PRE> +If you want them added to future versions of +<TT>datetime</TT>, please e-mail me the code. + +<P> + +<H1><A NAME="SECTION000110000000000000000"> +Configuration File</A> +</H1> + +<P> +As from Version 2.4, the <TT>datetime</TT> package will read in +settings from the configuration + file <TT>datetime.cfg</TT>, if it exists, which will override +the default package options. + For example, suppose you prefer a short date without the day of +week by default, you will need to create + a file called <TT>datetime.cfg</TT> that contains the line: +<PRE> +\shortdate\showdowfalse +</PRE> +The file <TT>datetime.cfg</TT> should then go somewhere on the +TeX path. Now all you need to do is: +<PRE> +\usepackage{datetime} +</PRE> +without having to specify the <TT>short</TT> and +<TT>nodayofweek</TT> options. + +<P> +You can also use this file to define and set your own date +styles. For example, you could create +a configuration file that has the following lines: +<PRE> +\newdateformat{dashdate}{\twodigit{\THEDAY}-\twodigit{\THEMONTH}-\THEYEAR} +\dashdate +</PRE> +Whenever you use the <TT>datetime</TT> package, it will now +use this format by default. + +<P> + +<H1><A NAME="SECTION000120000000000000000"> +LaTeX2HTML styles</A> +</H1> + +<P> +Version 2.43 and above of the <TT>datetime</TT> bundle +supplies the LaTeX2HTML style file <TT>datetime.perl</TT>. +This file should be placed in a +directory searched by LaTeX2HTML. The following limitations +apply to the LaTeX2HTML styles: + +<P> + +<UL> +<LI>The configuration file <TT>datetime.cfg</TT> +is currently ignored. (This is because +I can't work out the correct code to do this. If you +know how to do this, please let me know.) You can however +do: +<PRE> +\usepackage{datetime} +\html{\input{datetime.cfg}} +</PRE> +This, I agree, is an unpleasant cludge. + +<P> +</LI> +<LI>The commands <code>\monthname</code><I>language</I> are not +implemented. + +<P> +</LI> +<LI>Some of the languages are not implemented. + +<P> +</LI> +<LI>The package option <TT>nodate</TT> is not implemented. + +<P> +</LI> +</UL> + +<P> + +<H1><A NAME="SECTION000130000000000000000"> +Contact Details</A> +</H1> + Dr Nicola Talbot +<BR> +School of Computing Sciences +<BR> +University of East Anglia +<BR> +Norwich. NR4 7TJ. +<BR> +United Kingdom. +<BR> <TT><A NAME="tex2html12" + HREF="http://theoval.cmp.uea.ac.uk/~nlct/">http://theoval.cmp.uea.ac.uk/~nlct/</A></TT> +<BR><HR><H4>Footnotes</H4> +<DL> +<DT><A NAME="foot371">... format</A><A + HREF="manual.html#tex2html4"><SUP>1</SUP></A></DT> +<DD>Note that the commands <TT>\xxivtime</TT>, +<TT>\ampmtime</TT> and + <TT>\oclock</TT> are still available, +<TT>\settimeformat</TT> + redefines <TT>\currenttime</TT> to the command +given by placing a backslash in front of <I>style</I>. So + <TT>\settimeformat{xxivtime}</TT> sets +<TT>\currenttime</TT> + to <TT>\xxivtime</TT> and so on. + +</DD> +<DT><A NAME="foot131">... afternoon.</A><A + HREF="manual.html#tex2html5"><SUP>2</SUP></A></DT> +<DD>Version +2.43 fixed bug which caused an infinite loop on the hour. + +</DD> +<DT><A NAME="foot169">... <code>\pdfdate</code></A><A + HREF="manual.html#tex2html6"><SUP>3</SUP></A></DT> +<DD>thanks to Ulrich Dirr for +asking about this + +</DD> +<DT><A NAME="foot373">...year<code>}</code></A><A + HREF="manual.html#tex2html8"><SUP>4</SUP></A></DT> +<DD>Note the + name change since version 1.1. The command name was changed +from <TT>\thedate</TT> + to <TT>\formatdate</TT> + to avoid a name clash when using the <TT>seminar</TT> class +file. + +</DD> +<DT><A NAME="foot374">... +<code>\today</code></A><A + HREF="manual.html#tex2html9"><SUP>5</SUP></A></DT> +<DD>To be more precise, \ +<TT>today</TT> is defined to be \ +<TT>formatdate{\day}{\month}{\year}</TT> + where \<TT>longdate</TT> etc change the definition +of \<TT>formatdate</TT> + +</DD> +<DT><A NAME="foot233">...num<code>}</code></A><A + HREF="manual.html#tex2html10"><SUP>6</SUP></A></DT> +<DD>New to version 2.2 + +</DD> +<DT><A NAME="foot266">... command:</A><A + HREF="manual.html#tex2html11"><SUP>7</SUP></A></DT> +<DD>Thanks to Denis Bitouzé for asking about this + +</DD> +</DL> +<BR><HR> +<ADDRESS> +<a href=http://theoval.cmp.uea.ac.uk/~nlct/>Nicola L. C. Talbot</a>. <a href=http://www.cmp.uea.ac.uk/>School of Computing Sciences</a>. <a href=http://www.uea.ac.uk/>University of East Anglia.</a> Last Modified: 2005-10-01 +</ADDRESS> +</BODY> +</HTML> |