diff options
author | Reinhard Kotucha <reinhard.kotucha@web.de> | 2007-04-08 17:56:27 +0000 |
---|---|---|
committer | Reinhard Kotucha <reinhard.kotucha@web.de> | 2007-04-08 17:56:27 +0000 |
commit | 8c38dc88ed6cf33fd2e9385e102e9935e8b60b00 (patch) | |
tree | 374324d88bb7ddd8f6e57b14683315891102f936 /Master/texmf-dist/source/latex/datetime/datetime.dtx | |
parent | caef592b102b13a49c19d22bc87241b0a99d4045 (diff) |
update datetime to v2.51
git-svn-id: svn://tug.org/texlive/trunk@4130 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/datetime/datetime.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/datetime/datetime.dtx | 214 |
1 files changed, 193 insertions, 21 deletions
diff --git a/Master/texmf-dist/source/latex/datetime/datetime.dtx b/Master/texmf-dist/source/latex/datetime/datetime.dtx index f1000ee8c4d..641a2b33013 100644 --- a/Master/texmf-dist/source/latex/datetime/datetime.dtx +++ b/Master/texmf-dist/source/latex/datetime/datetime.dtx @@ -11,7 +11,7 @@ % -author "Nicola Talbot" % -dir "source" % datetime -% Created on 2006/12/6 11:03 +% Created on 2007/1/30 22:55 %\fi %\iffalse %<*package> @@ -34,7 +34,7 @@ %\fi % \iffalse % Doc-Source file to use with LaTeX2e -% Copyright (C) 2006 Nicola Talbot, all rights reserved. +% Copyright (C) 2007 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> @@ -47,7 +47,7 @@ pdftitle={datetime.sty: A Date and Time Package}, pdfkeywords={date,time,LaTeX}]{hyperref} -\CheckSum{4458} +\CheckSum{4522} \newcommand{\stynamefmt}[1]{\textsf{#1}} \begin{document} @@ -58,12 +58,12 @@ % %\RecordChanges %\OnlyDescription -%\def\docdate{5 Dec 2006} +%\def\docdate{30 Jan 2007} % %\changes{v2.46}{30 Sep 2005}{'today defined using 'DeclareRobustCommand} %\changes{v2.41}{22 Oct 2004}{'today defined using 'providecommand instead of 'renewcommand} % -% \title{datetime.sty v2.49: Formatting Current Date and +% \title{datetime.sty v2.51: Formatting Current Date and %Time} % \author{Nicola L.C. Talbot} % \date{\docdate} @@ -185,7 +185,7 @@ % \section{Time Commands} %\changes{v2.3}{1 May 2004}{Fixed minor bug in 'ampmtime. %(or more specifically, changed the way 'ampmtime, 'xxivtime -% and 'oclock are defined.)} +% and 'oclock are defined.)}\changes{v2.51}{30 Jan 2007}{fixed bug in 'ampmtime between midnight and 1am} %\DescribeMacro{\currenttime} % The current time is displayed using the command %\verb"\currenttime". @@ -536,7 +536,8 @@ % %There is currently only limited multilingual support for %\verb"\dayofweekname" and \verb!\shortdayofweekname! (just -%English, French, Portuguese and Spanish). You can add support for +%English, French, Portuguese, Spanish and German\footnote{thanks +%to Uwe Bieling for supplying the German names}). You can add support for %other languages by defining the commands %\verb'\dayofweeknameid'\meta{lang} and %\verb'\shortdayofweeknameid'\meta{lang}. Note that these @@ -559,7 +560,7 @@ %\or Saturday% %\fi} % -%\providecommand{\shortdayofweekidnameenglish}[1]{% +%\providecommand{\shortdayofweeknameidenglish}[1]{% %\ifcase#1\relax %\or Sun% %\or Mon% @@ -661,7 +662,7 @@ % This section documents the code for \texttt{datetime.sty} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datetime}[2006/12/05 v2.49 Date Time Package] +\ProvidesPackage{datetime}[2007/01/30 v2.51 Date Time Package] % \end{macrocode} %\texttt{fmtcount.sty} needs to be loaded here as it defines the command |\fmtord| which may be redefined later: % \begin{macrocode} @@ -690,6 +691,8 @@ \newif\if@dt@multilingual \@ifpackageloaded{babel}{% \@dt@multilingualtrue}{\@dt@multilingualfalse} +\@ifpackageloaded{ngerman}{% +\@dt@multilingualtrue}{\@dt@multilingualfalse} % \end{macrocode} % Define |\ordinaldate|. This is needed because some % languages only use an ordinal for the first day of @@ -721,7 +724,7 @@ \newcommand{\ordinaldate}[1]{% \if@dt@multilingual \@ifundefined{ordinaldate\languagename}{#1}{% -\csname ordinaldate\languagename\endcsname{#1}} +\csname ordinaldate\languagename\endcsname{#1}}% \else \ordinalnum{#1}% \fi} @@ -1419,11 +1422,17 @@ You can't create a new time format called "#1" as the command % 12-hour time: % \begin{macrocode} \newtimeformat{ampmtime}{% -\THEHOURXII\timeseparator\twodigit\THEMINUTE +\ifthenelse{\value{HOUR}=0}{12}{\THEHOURXII}\timeseparator\twodigit\THEMINUTE \ifthenelse{\value{HOUR}<12}{\amname}{% \ifthenelse{\time=720}{ \noon}{\pmname}}} % \end{macrocode} % Textual time: +% |\hourstring<count>| will print |\midnight| if |<count>| is 0, otherwise +% will do |\Numberstring<count>|. +% \begin{macrocode} +\newcommand*{\hourstring}[1]{% +\ifthenelse{\value{#1}=0}{\midnight}{\Numberstring{#1}}} +% \end{macrocode} % \begin{macrocode} \newtimeformat{oclock}{\ifthenelse{\time=0 \or \time=720}{% % \end{macrocode} @@ -1441,16 +1450,16 @@ You can't create a new time format called "#1" as the command % \begin{macrocode} \Numberstring{HOUR} \oclockstring}{% \ifthenelse{\value{MINUTE}=15}{% -\quarterpast\ \Numberstring{HOUR}}{% +\quarterpast\ \hourstring{HOUR}}{% \ifthenelse{\value{MINUTE}=30}{% -\halfpast\ \Numberstring{HOUR}}{% +\halfpast\ \hourstring{HOUR}}{% \ifthenelse{\value{MINUTE}=45}{% -\quarterto\ \Numberstring{TOHOUR}}{% +\quarterto\ \hourstring{TOHOUR}}{% \ifthenelse{\value{MINUTE}<30}{% \Numberstring{MINUTE}\ \ifthenelse{\value{MINUTE}=1}{minute}{minutes} -past \Numberstring{HOURXII}}{% +past \hourstring{HOURXII}}{% \Numberstring{TOMINUTE}\ \ifthenelse{% -\value{TOMINUTE}=1}{minute}{minutes} to \Numberstring{TOHOUR}}}}}}\ +\value{TOMINUTE}=1}{minute}{minutes} to \hourstring{TOHOUR}}}}}}% % \end{macrocode} % Now say whether it is morning or afternoon % \begin{macrocode} @@ -1458,11 +1467,11 @@ past \Numberstring{HOURXII}}{% % \end{macrocode} % Morning % \begin{macrocode} -\amstring}{% +\ifthenelse{\value{HOUR}=0}{}{\ \amstring}}{% % \end{macrocode} % Afternoon % \begin{macrocode} -\pmstring}}} +\ifthenelse{\value{TOHOUR}=0}{}{\ \pmstring}}}} % \end{macrocode} % Define textual strings used in the above. % \begin{macrocode} @@ -2478,6 +2487,30 @@ Month numbers should go from 1 to 12}% Month numbers should go from 1 (janvier) to 12 (decembre)}% \fi} % \end{macrocode} +% The following week day names were supplied by Uwe Bieling: +% \begin{macrocode} +\providecommand{\dayofweeknameidgerman}[1]{% +\ifcase#1\relax +\or Sonntag% +\or Montag% +\or Dienstag% +\or Mittwoch% +\or Donnerstag% +\or Freitag% +\or Samstag% +\fi} + +\providecommand{\shortdayofweeknameidgerman}[1]{% +\ifcase#1\relax +\or So% +\or Mo% +\or Di% +\or Mi% +\or Do% +\or Fr% +\or Sa% +\fi} +% \end{macrocode} % (Re)Define declaration to switch to this format. % \begin{macrocode} \DeclareRobustCommand*\dategerman{% @@ -2962,6 +2995,30 @@ Month numbers should go from 1 to 12}% Month numbers should go from 1 to 12}% \fi} % \end{macrocode} +% The following week day names were supplied by Uwe Bieling: +% \begin{macrocode} +\providecommand{\dayofweeknameidngerman}[1]{% +\ifcase#1\relax +\or Sonntag% +\or Montag% +\or Dienstag% +\or Mittwoch% +\or Donnerstag% +\or Freitag% +\or Samstag% +\fi} + +\providecommand{\shortdayofweeknameidngerman}[1]{% +\ifcase#1\relax +\or So% +\or Mo% +\or Di% +\or Mi% +\or Do% +\or Fr% +\or Sa% +\fi} +% \end{macrocode} % (Re)Define declaration to switch to this format. % \begin{macrocode} \DeclareRobustCommand*\datengerman{% @@ -3810,8 +3867,8 @@ Month numbers should go from 1 to 12}% % \begin{macrocode} # File : datetime.perl # Author : Nicola Talbot -# Date : 3 Mar 2005 -# Version : 1.01 +# Date : 17 Jan 2007 +# Version : 1.02 # Description : LaTeX2HTML implementation of datetime package. # set up default values for internal counters. @@ -4933,6 +4990,48 @@ sub get_day_of_weekname_portuges{ } } +sub get_day_of_weekname_german{ + local($dow) = @_; + + local(@DayOfWeek) = ('Sonntag', + 'Montag', + 'Dienstag', + 'Mittwoch', + 'Donnerstag', + 'Freitag', + 'Samstag'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_day_of_weekname_ngerman{ + local($dow) = @_; + + local(@DayOfWeek) = ('Sonntag', + 'Montag', + 'Dienstag', + 'Mittwoch', + 'Donnerstag', + 'Freitag', + 'Samstag'); + + 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); @@ -4949,10 +5048,83 @@ sub get_day_of_weekname{ } } +sub get_short_day_of_weekname_english{ + local($dow) = @_; + + local(@DayOfWeek) = ('Sun', + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_short_day_of_weekname_german{ + local($dow) = @_; + + local(@DayOfWeek) = ('So', + 'Mo', + 'Di', + 'Mi', + 'Do', + 'Fr', + 'Sa'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + +sub get_short_day_of_weekname_ngerman{ + local($dow) = @_; + + local(@DayOfWeek) = ('So', + 'Mo', + 'Di', + 'Mi', + 'Do', + 'Fr', + 'Sa'); + + if ($dow <= 0 || $dow > 7) + { + &write_warnings("Invalid day of week number: $dow"); + } + else + { + $DayOfWeek[$dow-1]; + } +} + sub get_short_day_of_weekname{ local($dow)=@_; + local($dowsub); - substr(&get_day_of_weekname($dow),0,3); + $dowsub = "get_short_day_of_weekname_$default_language"; + + if (defined ($dowsub)) + { + &$dowsub($dow); + } + else + { + substr(&get_day_of_weekname($dow),0,3); + } } sub do_cmd_dayofweeknameid{ |