The isodate package ∗
Harald Harders [email protected]
File Date 2010-01-03, Printed 2010-01-03
Abstract
This package provides commands to switch between different date formats (standard, ISO, numeric, LATEX package). They are used by the \today command, by the\printdateand\printdateTeXcommands that print any date, and by the\daterangecommand that prints a date range. At the mo- ment, this package supports German (old and new orthography, Austrian), British, US, Australian as well as New Zealand English,1 French, Italian, Danish, Swedish, and Norwegian.
The idea for this package was taken from the akletter class.
Contents
1 Commands 2
1.1 Switching the date output format . . . 2
1.2 Printing today’s date . . . 3
1.3 Printing any date . . . 4
1.4 Printing date ranges . . . 4
1.5 Changing the ISO format . . . 4
1.6 Changing the original and short original format . . . 5
1.7 Changing the short original format . . . 5
1.8 Changing the German format . . . 6
1.9 Changing the English format . . . 6
1.10 User defined month formatting . . . 6
1.11 Switching the date input format . . . 7
2 Calling the package 8
3 Add new languages to the package 10
A Licence 10
∗This file has version v2.30 last revised 2010-01-03.
1In order to use Australian or New Zealand, you need a version of babel that supports the used language. It should be available, soon.
B Known errors 10
C Planned features and changes 11
D The implementation 11
D.1 Package file isodate.sty . . . 11
D.2 Language definition file danish.idf . . . 24
D.3 Language definition file english.idf . . . 28
D.4 Language definition file french.idf . . . 37
D.5 Language definition file german.idf . . . 40
D.6 Language definition file italian.idf . . . 44
D.7 Language definition file norsk.idf . . . 46
D.8 Language definition file swedish.idf . . . 49
Acknowledgements
First of all I have to thank Axel Kielhorn who wrote the packageakletterwhich inspired me to writeisodate. The help of Heiko Oberdiek was necessary to handle characters in substrings which resulted in the packagesubstr. David Sanderson found the bug which disabledisodate to work without babel. He also helped me to improve the documentation and sent me a link to the ISO 8601 norm [1].
Svend Tollak Munkejord has added the Norwegian language, Christian Schlauer has added Swedish, Philip Ratcliffe has added Italian.
Requirements
The packageisodateneeds the packagesubstr.stywhich can be obtained from CTAN:macros/latex/contrib/substr/.
1 Commands
1.1 Switching the date output format
This package provides five commands to switch the output format of all commands
\isodate
\numdate
\shortdate
\TeXdate
\origdate
\shortorigdate
\Romandate
\romandate
that print dates (described later):
\shortRomandate
\shortromandate
\isodate date format described in ISO 8601 and DIN 5008 [1]
(yyyy-mm-dd)
\numdate numeric date format with four digits of the year
\shortdate short numeric date format with two digits of the year
\TeXdate date format used for version description of packages (yyyy/mm/dd)
\origdate original LATEX format
\shortorigdate original LATEX format with two instead of four digits of
the year
\Romandate As\numdatebut with uppercase Roman numerals for the month
\romandate As\numdatebut with lowercase Roman numerals for the month
\shortRomandate As\shortdate but with uppercase Roman numerals for the month
\shortromandate As\shortdate but with lowercase Roman numerals for the month
These commands do not print any dates and they don’t take an argument.
They just switch the format for later usage of the date-printing commands\today,
\printdate,\printdateTeX, and\daterange.
The numeric and short numeric as well as the Roman numbered formats change their behaviour depending on the current language:
German, nGerman dd.\,mm.~yyyy resp. dd.\,mm.\,yy US English mm/dd/yyyy resp. mm/dd/yy other languages dd/mm/yyyy resp. dd/mm/yy
This package supports German (old and new rules, Austrian), US English, French, Danish, Italian, Swedish, and Norwegian. Switching the language by using\selectlanguagedoesnot switch back to the original date format. So the current date format stays active when changing the language.
The change of the date format works locally. So it is possible to change it locally inside a group; e.g.,
\today, {\origdate\today}, \today
leads to ‘2010-01-03, 3rd January 2010, 2010-01-03’.
By default, all formats print the day, month, and year. Sometimes, you may
\printyearoff
\printyearon want to print the date without the year. This can be reached by using the com- mand \printyearoff. You can switch back with \printyearon or by using
\printyearoff inside a group (e.g., an environment). To switch globally, pre- ceed the command by\global. An example:
\today, {\printyearoff\today}, \today
leads to ‘3rd January 2010, 3rd January, 3rd January 2010’.
Likewise you can switch on or off printing the day using \printdayon and
\printdayoff
\printdayon \printdayoff. Note that you still have to provide complete dates in the
\printdatecommand, described in Section 1.3 below.
1.2 Printing today’s date
As usual, the command\todayprints the date of today. Its appearance is influ-
\today
enced by the current date format
1.3 Printing any date
The command\printdate{#1}prints any date in the current format. The argu-
\printdate
ment may be a date in German, British English, or ISO format, e.g.,
\printdate{24.12.2000}
\printdate{24/12/2000}
\printdate{2000-12-24}
The command\printdateTeX{#1} prints any date in the actual format. The
\printdateTeX
argument must be in the LATEX format yyyy/mm/dd, e.g.,
\printdateTeX{2000/12/24}
This command is useful for printing version information stored in a macro.
For example the version of this package is stored in the macro \filedate (‘2010/01/03’). To print it with the actual date format you can use the com- mand\printdateTeX{\filedate}which leads to e.g., ‘2010-01-03’ or ‘3rd Jan- uary 2010’. Another possibility is to switch the input format to tex using
\dateinputformat, described below.
1.4 Printing date ranges
The command \daterange{#1}{#2} prints a date range in the current format.
\daterange
The arguments may be a date in German, British English, or ISO format (see above). But there is a limitation: Both arguments must have the same input format.
Depending on the language and date format, this commands leaves out some of the data. The simplest way to understand it is to watch some examples:
{\isodate
\daterange{1999-05-03}{1999-05-31}−→1999-05-03 to 31
\daterange{1999-05-03}{1999-11-03}−→1999-05-03 to 11-03
\daterange{1999-05-03}{2000-04-07}−→1999-05-03 to 2000-04-07 }
{\origdate
\daterange{1999-05-03}{1999-05-31}−→3rd to 31st May 1999
\daterange{1999-05-03}{1999-11-03}−→0503 to 3rd November 1999
\daterange{1999-05-03}{2000-04-07}−→3rd May 1999 to 7th April 2000 }
1.5 Changing the ISO format
The ISO norm says that the date format is ‘yyyy-mm-dd’ or ‘yyyymmdd’ [1]. By
\isodash
default I use the hyphen ‘-’ as separator. You can change this using the\isodash2 command, e.g.,
2The name ‘isodash’ is a little bit confusing and was chosen due to my limited knowledge in English. It should be named ‘isoseparator’ or ‘isosep’. But for compatiblity reasons I will not change it.
\printdate{24/12/2000},
\isodash{--}%
\printdate{24/12/2000},
\isodash{}%
\printdate{24/12/2000}
leads to ‘2000-12-24, 2000–12–24, 20001224’. Or for example
\isodash{$\cdot$}
\printdate{24/12/2000}
leads to ‘2000·12·24’.
1.6 Changing the original and short original format
\isospacebeforeday
\isospacebeforemonth
\isospacebeforeyear
By default, the original and short original format prints unbreakable spaces between the parts of the dates, e.g., ‘19~May~2001’. If you want to allow breakable spaces or other characters, you can redefine the spaces using\isospacebeforeday,
\isospacebeforemonth, and \isospacebeforeyear:
\isospacebeforeyear{\ }
leads to ‘19~May\ 2001’. Notice that the space is written as\ to ensure that the space is not getting lost under all circumstances.
As the names imply, the spaces before the specified part (day, month, or year) is changed. For most formats, only \isospacebeforemonth and
\isospacebeforeyearare relevant, while for US English, \isospacebeforeday and\isospacebeforeyearare used.
This only effects theorigandshortorigformats.
1.7 Changing the short original format
\shortyearsign
The short original format normally prints the year with two digits, e.g., ‘19th May 01’. Some people want to add an additional sign before the year, e.g., ‘19th May ’01’. This can be achieved by using the command\shortyearsign, e.g.,
\printdate{24/12/2000},
\shortyearsign{’}%
\printdate{24/12/2000}
leads to ‘24 december 00, 24 december ’00’ in English.
This only effects the shortorig format. The short numerical format stays unchanged.
1.8 Changing the German format
The spacings for the numerical formats in the German language (24. 12. 2000 resp.
24. 12. 00) were taken from the Duden [2] and are the defaults when using one of the German derivatives. Some people want to use different spacings. Thus from version 2.03 on it is possible to change them. You can change the spacing between
\daymonthsepgerman
\monthyearsepgerman
\monthyearsepnodaygerman
the day and the month using the command \daymonthsepgerman. Using the command\monthyearsepgermanyou can change the spacing between the month and the year for the long and the short format, e.g.,
\daymonthsepgerman{\quad}%
\monthyearsepgerman{\qquad}{\quad}%
{\numdate\printdate{24.12.2000}}, {\shortdate\printdate{24.12.2000}}
leads to ‘24. 12. 2000, 24. 12. 00’.
The default values are ‘\,’ for the separator between day and month resp. ‘\,’
between month and year in the short format and ‘~’ in the long format.
Likewise, \monthyearsepnodaygerman is used for defining the spacing be- tween the month and the year when printing the day is switched off (using
\printdayoff). The arguments are the same as for\monthyearsepgerman. De- fault is no space for long and short format.
1.9 Changing the English format
By default, the English date format looks like ‘24th December 2000’. During the last years, a change has occured in many documents towards ‘24 December 2000’. This new format is called ‘clean look’. Isodate’s behaviour can be changed
\cleanlookdateon
\cleanlookdateoff towards it using\cleanlookdateon and \cleanlookdateoff. This can also be done globally using thecleanlookpackage option.
At the moment, the ‘clean look’ functionality only affects British English. If this trend also counts for different languages, please tell it me that I can add support for them.
1.10 User defined month formatting
Internally, the formats using Roman numerals for the month are just links to the
\numdateand\shortdateformats with a changed format for printing the month.
Therefore, the command\Romandate calls\numdateby following sequence:
\numdate[Roman]%
\isotwodigitdayfalse
This tells\numdateto format the month using the\Romancommand and to type- set the day without a leading zero if it is less than ten.
You may do similar things, e.g.,
\numdate[Alph]
prints the months with the command\Alph, ‘A’, ‘B’, . . . The day is printed with two digits since every call of\numdateor\shortdatecalls\isotwodigitdaytrue which switches printing the day with two digits on. This does not make any sence but may serve as example. If you want to enable days with one digit, append
\isotwodigitdaytrue:
\numdate[Alph]%
\isotwodigitdaytrue
You may declare any command that typesets a counter that is given as its mandatory argument (e.g.,\alph,\Alph,\arabic, . . . ) in the optional argument of the\numdate, \shortdate, \isodate, and\TeXdatecommands, without the leading backslash. You can, of course, define own commands that do it. For instance,
{\def\boldnum#1{\textbf{\twodigitarabic{#1}}}%
\numdate[boldnum]%
\printdate{24.3.2000}}
leas to ‘24/03/2000’. Here, the \twodigitarabiccommand has been used that
\twodigitarabic
prints a positive number with at least two digits.3
If you, for example want a numerical date format with the day and month printed with the ‘natural’ number of digits rather than with two digits, you may do it as follows:
{\numdate[arabic]\isotwodigitdayfalse
\printdate{1.2.2000}}
which leads to ‘1/2/2000’.
Using one of the other date formats reset the numerical format to its standard settings with arabic numerals (with two digits), e.g.,
{\numdate[Alph]\printdate{6.12.2000};
\isodate\printdate{6.12.2000};
\numdate\printdate{6.12.2000}}
leads to ‘6/L/2000; 2000-12-06; 06/12/2000’.
1.11 Switching the date input format
As described above, the date can be given in different formats. For the German
\dateinputformat
formatdd.mm.yyyyand the ISO formatyyyy-mm-dd, the input format is definite.
But when using slashes to seperate the day, month, and year, different formats exist. British people use dd/mm/yyyy, American people use mm/dd/yyyy, while TEX uses yyyy/mm/dd which in fact is an ISO format with slashes instead of dashes.
By default, the British format is used. If the user wants to give the American or TEX format as argument of the \printdate or \daterange com- mands, the macro \dateinputformat can be used to change the behaviour.
3This command is also used for the numerical date formats.
This macro takes the name of the input format as single parameter, e.g.,
\dateinputformat{american}, for switching to American behaviour, e.i.,mm/dd/yyyy.
For example,
\numdate
\selectlanguage{UKenglish}%
\dateinputformat{american}%
\printdate{12/31/2004}
gives 31/12/2004. In this example, input format is American while the output format is English.
Valid arguments for the\dateinputformatcommand areenglish,UKenglish, british, american, USenglish, tex, latex, TeX, LaTeX. The meaning of most possibilities should be clear;englishmeans British English.
Beware that the input format may only be changed for the date format using slashes. Thus, you don’t have to and are not allowed to specify input formats other than these described above. For example, \dateinputformat{german} is not allowed (and not necessary).
2 Calling the package
The package is called using the\usepackagecommand:
\usepackage[option]{isodate}.
The possible package options can be seen in table 2.
Be aware that at least one language option must be set when calling isodate.
The last language in the option list is the default language.
The package isodate works well together with babel.sty, german.sty, or ngerman.sty. It does not matter if isodate is loaded before or after the used language package.
It is also possible to use isodate without one of the language packages. Then it is not possible to switch between languages using the\selectlanguage com- mand.4 Then the default language is the last one in the option list. If an error oc- curs when using isodate without one of the packagesbabel.sty,german.sty, and ngerman.styplease runtstlang.texthrough latex and send the filetstlang.log to the [email protected].
If using isodate together with babel it can be useful to put the language options as global options into the optional parameters of the\documentclasscommand.
Then automatically the available languages are the same for the text and the dates, and the default language is also the same. For example:
\documentclass[english,german]{article}
\usepackage{babel}
\usepackage[num]{isodate}
4Yes, there is a way to change the date language, but it is a little bit tricky:
\makeatletter
\def\iso@languagename{german}%
\dategerman%
\makeatother
Table 2: Package options
option function
iso start with ISO date format
num start with numeric date format with 4 digits of the year short start with numeric date format with 2 digits of the year TeX start with LATEX numeric date format (yyyy/mm/dd) orig start with normal LATEX date format (defaulta) shortorig start with short normal LATEX date format (2 digits) Roman start with numeric date format (month in uppercase
Roman numerals)
roman start with numeric date format (month in lowercase Roman numerals)
shortRoman start with short Roman format shortroman start with short roman format
american support American English date format austrian support Austrian date format
british support British English date format danish support Danish date format
english support British English date format french support French date format
german support German date format naustrian support new Austrian date format ngerman support new German date format italian support Italian date format norsk support Norwegian date format norwegian support Norwegian date format swedish support Swedish date format UKenglish support British English date format USenglish support American English date format inputenglish English date input format (default) inputbritish English date input format (default) inputUKenglish English date input format (default) inputamerican American date input format inputUSenglish American date input format inputtex TEX date input format inputTeX TEX date input format inputlatex TEX date input format inputLaTeX TEX date input format
cleanlook use ‘clean look’ for English dates
nocleanlook don’t use ‘clean look’ for English dates (default) printdayon print complete date including the day (default) printdayoff omit the day in the date
aThe original format is used as default in order to avoid a different document output by just including the package.
The input format options specify the input format that is used at the begin of the document. You don’t have to define multiple options if you want to change the input format in the document using\dateinputformat. For example,
\documentclass[american,german,british]{article}
\usepackage{babel}
\usepackage[iso,inputamerican]{isodate}
\begin{document}
D \printdate{28.2.2000}\par ISO \printdate{2000-2-28}\par US \printdate{2/28/2000}\par
\dateinputformat{british}UK \printdate{28/2/2000}\par
\dateinputformat{tex}\TeX\ \printdate{2000/2/28}
\end{document}
works as expected.
Beware that only the mentioned input formats are defined. For example, inputgermandoes not exist because it is not necessary.
3 Add new languages to the package
The easiest way to add new languages to the package is to copy one of the sim- ple language files danish.idf or french.idf to the new language name, e.g., plattdeutsch.idf, and change it as necessary.
This new file can be used without changing isodate.styif you use its name explicitly in the optional parameter of the \usepackage command. If you have added support for a new language please mail me.
A Licence
Copyright 2000–2010 Harald Harders
This program can be redistributed and/or modified under the terms of the LaTeX Project Public License Distributed from CTAN archives in directory macros/latex/base/lppl.txt; either version 1 of the License, or any later version.
B Known errors
• The\printdateand\printdateTeXcommands are not very good in check- ing the argument for correct syntax.
• The language definition filesfrench.idf andgerman.idfare not yet com- mented.
• Isodate and draftcopy do not work together.
• Documentation of the code is partly poor.
C Planned features and changes
• Add other languages. Please help me with this topic. I don’t know the date formats in other languages.
• Format short given years to four digits and calculate reasonable first and second digits.
References
[1] International Standard: ISO 8601. http://www.iso.ch/markete/8601.pdf, 1988-06-15.
[2] DUDEN Band 1. Die deutsche Rechtschreibung. 21. Auflage, Dudenverlag, Mannheim, Germany, 1996.
D The implementation
D.1 Package file isodate.sty
Heading of the files:
1hisodatei\NeedsTeXFormat{LaTeX2e}
2hisodatei\ProvidesPackage{isodate}
3hdanishi\ProvidesFile{danish.idf}
4henglishi\ProvidesFile{english.idf}
5hfrenchi\ProvidesFile{french.idf}
6hgermani\ProvidesFile{german.idf}
7hitaliani\ProvidesFile{italian.idf}
8hnorski\ProvidesFile{norsk.idf}
9hswedishi\ProvidesFile{swedish.idf}
10hisodatei [2010/01/03 v2.30 Print dates with different formats (HH)]
11hlanguagei [2010/01/03 v2.30 Language definitions for isodate package (HH)]
The package:
12h∗isodatei
13\RequirePackage{ifthen}
14\IfFileExists{substr.sty}{\RequirePackage{substr}%
15 }{\PackageError{isodate.sty}{Package file substr.sty not found}
16 {This version of isodate.sty needs the package substr.sty.^^J%
17 You can download it from
18 CTAN:/macros/latex/contrib/substr/^^J%
19 e.g., one CTAN node is ftp.dante.de.
20 Install substr.sty into your TeX tree.}}
Declare the options for the default date format.
21\DeclareOption{iso}{\AtEndOfPackage{\isodate}}
22\DeclareOption{num}{\AtEndOfPackage{\numdate}}
23\DeclareOption{short}{\AtEndOfPackage{\shortdate}}
24\DeclareOption{TeX}{\AtEndOfPackage{\TeXdate}}
25\DeclareOption{orig}{\AtEndOfPackage{\origdate}}
26\DeclareOption{shortorig}{\AtEndOfPackage{\shortorigdate}}
27\DeclareOption{Roman}{\AtEndOfPackage{\Romandate}}
28\DeclareOption{roman}{\AtEndOfPackage{\romandate}}
29\DeclareOption{shortRoman}{\AtEndOfPackage{\shortRomandate}}
30\DeclareOption{shortroman}{\AtEndOfPackage{\shortromandate}}
31\DeclareOption{cleanlook}{\AtEndOfPackage{\cleanlookdateon}}
32\DeclareOption{nocleanlook}{\AtEndOfPackage{\cleanlookdateoff}}
Declare the options which decide wheather day is printed.
33\DeclareOption{printdayoff}{\AtEndOfPackage{\printdayoff}}
34\DeclareOption{printdayon}{\AtEndOfPackage{\printdayon}}
Declare the options for the default date input format.
35\DeclareOption{inputenglish}{\AtEndOfPackage{\dateinputformat{english}}}
36\DeclareOption{inputbritish}{\AtEndOfPackage{\dateinputformat{english}}}
37\DeclareOption{inputUKenglish}{\AtEndOfPackage{\dateinputformat{english}}}
38\DeclareOption{inputamerican}{\AtEndOfPackage{\dateinputformat{american}}}
39\DeclareOption{inputUSenglish}{\AtEndOfPackage{\dateinputformat{american}}}
40\DeclareOption{inputtex}{\AtEndOfPackage{\dateinputformat{tex}}}
41\DeclareOption{inputTeX}{\AtEndOfPackage{\dateinputformat{tex}}}
42\DeclareOption{inputlatex}{\AtEndOfPackage{\dateinputformat{tex}}}
43\DeclareOption{inputLaTeX}{\AtEndOfPackage{\dateinputformat{tex}}}
Declare the options for language support.
44\DeclareOption{american}{\input{english.idf}}
45\DeclareOption{australian}{\input{english.idf}}
46\DeclareOption{austrian}{\input{german.idf}}
47\DeclareOption{danish}{\input{danish.idf}}
48\DeclareOption{english}{\input{english.idf}}
49\DeclareOption{british}{\input{english.idf}}
50\DeclareOption{french}{\input{french.idf}}
51\DeclareOption{frenchb}{\input{french.idf}}
52\DeclareOption{german}{\input{german.idf}}
53\DeclareOption{italian}{\input{italian.idf}}
54\DeclareOption{naustrian}{\input{german.idf}}
55\DeclareOption{newzealand}{\input{english.idf}}
56\DeclareOption{ngerman}{\input{german.idf}}
57\DeclareOption{norsk}{\input{norsk.idf}}
58\DeclareOption{norwegian}{\input{norsk.idf}}
59\DeclareOption{swedish}{\input{swedish.idf}}
60\DeclareOption{UKenglish}{\input{english.idf}}
61\DeclareOption{USenglish}{\input{english.idf}}
Make it possible to load language definition files that are not known by this pack- age.
62\DeclareOption*{%
63 \InputIfFileExists{\CurrentOption.idf}{}{%
64 \PackageError{isodate}{%
65 Isodate definition file \CurrentOption.idf not found}{%
66 Maybe you misspelled the language option?}}%
67 }
Set default option toorig.
68\ExecuteOptions{orig,nocleanlook,printdayon}
Process the options.
69\ProcessOptions*
Handle the case that no language was given. Throw an error message. Each language definition file*.idf must contain a line
\let\iso@languageloaded\active
that defines the command\iso@languageloaded.
70\ifx\iso@languageloaded\@undefined
71 \PackageError{isodate}{%
72 You haven’t specified a language option}{%
73 You need to specify a language, either as a global
74 option\MessageBreak
75 or as an optional argument to the \string\usepackage\space
76 command.\MessageBreak
77 If you have used the old isodate package (version <=1.06) you can
78 change the\MessageBreak
79 usepackage command to \protect\usepackage{isodate}.\MessageBreak
80 You shouldn’t try to proceed from here, type x to quit.}
81\fi
\iso@printday Prints a day.
82\newcommand*\iso@printday[1]{%
83 \ifisotwodigitday
84 \ifthenelse{\number#1<10}{0}{}%
85 \fi
86 \number#1%
87}%
\twodigitarabic Typesets the given counter with at least two digits. This command is very simple and does only work for positive numbers below 100.
88\newcommand*\twodigitarabic[1]{%
89 \ifthenelse{\number\arabic{#1}<10}{0}{}%
90 \arabic{#1}%
91}
\iso@printmonth Prints a month using\theiso@tmpmonthas output fourmat.
92\newcommand*\iso@printmonth[1]{%
93 \setcounter{iso@tmpmonth}{#1}%
94 \theiso@tmpmonth%
95}
Define the help counter that prints the month and initialize it to print arabic numbers.
96\newcounter{iso@tmpmonth}
97%\def\theiso@tmpmonth{\arabic{iso@tmpmonth}}
\iso@yeartwo Prints the argument of the command with two digits.
Example: \iso@yeartwo{1873}−→73.
98\newcounter{iso@yeartwo}%
99\newcommand*\iso@yeartwo[1]{%
100 \setcounter{iso@yeartwo}{\number#1}%
101 \whiledo{\theiso@yeartwo>99}{%
102 \addtocounter{iso@yeartwo}{-100}}{}%
103 \ifthenelse{\number\theiso@yeartwo<10}{0}{}\theiso@yeartwo
104}
\iso@yearfour Prints the argument of the command with four digits.
105\newcommand*\iso@yearfour[1]{%
106 \ifthenelse{\number#1<1000}{0}{}%
107 \ifthenelse{\number#1<100}{0}{}%
108 \ifthenelse{\number#1<10}{0}{}%
109 \number#1%
110}%
\ifisotwodigitday Print day with two digits or natural number of digits?
111\newif\ifisotwodigitday
\iso@dateformat In this command, the current active date format ist stored. Possible values are:
numeric, short,iso, orig,shortorig,TeX.
112\def\iso@dateformat{numeric}
\iso@inputformat This macro stores which input format is used for dates given with slashes.
Valid formats are english (dd/mm/yyyy), american (mm/dd/yyyy), and tex (yyyy/mm/dd). By default, English is used.
113\DeclareRobustCommand*\dateinputformat[1]{%
114 \ifthenelse{%
115 \equal{#1}{english}\OR
116 \equal{#1}{british}\OR
117 \equal{#1}{UKenglish}}{%
118 \def\iso@inputformat{english}%
119 }{%
120 \ifthenelse{%
121 \equal{#1}{american}\OR
122 \equal{#1}{USenglish}}{%
123 \def\iso@inputformat{american}%
124 }{%
125 \ifthenelse{%
126 \equal{#1}{tex}\OR
127 \equal{#1}{TeX}\OR
128 \equal{#1}{latex}\OR
129 \equal{#1}{LaTeX}}{%
130 \def\iso@inputformat{tex}%
131 }{%
132 \PackageError{isodate}{Invalid date input format}{%
133 Maybe you misspelled the language option (english, american,
134 tex)?}%
135 }%
136 }%
137 }%
138}
\iso@inputformat This macro stores which input format is used for dates given with slashes.
Valid formats are english (dd/mm/yyyy), american (mm/dd/yyyy), and tex (yyyy/mm/dd). By default, English is used.
139\dateinputformat{english}
\numdate Switches to long numerical date format.
140\DeclareRobustCommand*\numdate[1][twodigitarabic]{%
141 \def\iso@dateformat{numeric}%
142 \isotwodigitdaytrue
143 \def\theiso@tmpmonth{\csname #1\endcsname{iso@tmpmonth}}%
144}
\shortdate Switches to short numerical date format.
145\DeclareRobustCommand*\shortdate[1][twodigitarabic]{%
146 \def\iso@dateformat{short}%
147 \isotwodigitdaytrue
148 \def\theiso@tmpmonth{\csname #1\endcsname{iso@tmpmonth}}%
149}
\isodate Switches to ISO date format.
150\DeclareRobustCommand*\isodate[1][twodigitarabic]{%
151 \def\iso@dateformat{iso}%
152 \isotwodigitdaytrue
153 \def\theiso@tmpmonth{\csname #1\endcsname{iso@tmpmonth}}%
154}
\origdate Switches to the original date format.
155\DeclareRobustCommand*\origdate{%
156 \def\iso@dateformat{orig}%
157 \isotwodigitdayfalse
158 \def\theiso@tmpmonth{\twodigitarabic{iso@tmpmonth}}%
159}
\shortorigdate Switches to the short original date format.
160\DeclareRobustCommand*\shortorigdate{%
161 \def\iso@dateformat{shortorig}%
162 \isotwodigitdayfalse
163 \def\theiso@tmpmonth{\twodigitarabic{iso@tmpmonth}}%
164} q
\TeXdate Switches to LATEX date format.
165\DeclareRobustCommand*\TeXdate[1][twodigitarabic]{%
166 \def\iso@dateformat{TeX}%
167 \isotwodigitdaytrue
168 \def\theiso@tmpmonth{\csname #1\endcsname{iso@tmpmonth}}%
169}
\Romandate Switches to long numerical date format with month printed in uppercase Roman numerals.
170\DeclareRobustCommand*\Romandate{%
171 \numdate[Roman]%
172 \isotwodigitdayfalse
173}
\romandate Switches to long numerical date format with month printed in lowercase Roman numerals.
174\DeclareRobustCommand*\romandate{%
175 \numdate[roman]%
176 \isotwodigitdayfalse
177}
\shortRomandate Switches to short numerical date format with month printed in uppercase Roman numerals.
178\DeclareRobustCommand*\shortRomandate{%
179 \shortdate[Roman]%
180 \isotwodigitdayfalse
181}
\shortromandate Switches to short numerical date format with month printed in lowercase Roman numerals.
182\DeclareRobustCommand*\shortromandate{%
183 \shortdate[roman]%
184 \isotwodigitdayfalse
185}
\isodash Changes the dash in the ISO date format. The default is ‘-’.
186\def\iso@isodash{-}%
187\DeclareRobustCommand*\isodash[1]{\def\iso@isodash{#1}}%
Define the sign that is printed before a two digit year in the short original format.
Default is nothing.
\shortyearsign
188\def\iso@twodigitsign{}
189\DeclareRobustCommand*\shortyearsign[1]{\def\iso@twodigitsign{#1}}%
\isorangesign Defines the sign or word that is printed between the two dates in a date range.
e.g., in English the default is ‘ to ’.
190\def\iso@rangesign{\csname iso@rangesign@\iso@languagename\endcsname}%
191\DeclareRobustCommand*\isorangesign[1]{\def\iso@rangesign{#1}}%
\printyearoff
\printyearon
Switches printing of the year on or off. Default is to print the year.
192\newif\ifiso@printyear
193\DeclareRobustCommand*\printyearon{\iso@printyeartrue}
194\DeclareRobustCommand*\printyearoff{\iso@printyearfalse}
195\printyearon
\printdayoff
\printdayon
Switch on or off suppressing the day in date output. Default is not print the day.
196\newif\ifiso@doprintday
197\DeclareRobustCommand*\printdayon{\iso@doprintdaytrue}
198\DeclareRobustCommand*\printdayoff{\iso@doprintdayfalse}
199\printdayon
\cleanlookdateoff
\cleanlookdateon
Switch on or off ‘clean look’ for English dates. Default is not to use ‘clean look’.
200\newif\ifiso@cleanlook
201\DeclareRobustCommand*\cleanlookdateon{\iso@cleanlooktrue}
202\DeclareRobustCommand*\cleanlookdateoff{\iso@cleanlookfalse}
203\cleanlookdateoff
\isospacebeforeday
\isospacebeforemonth
\isospacebeforeyear
Change the spaces in the orig and short orig format. Default is~for all of them.
204\newcommand*\iso@daysep{~}
205\newcommand*\iso@monthsep{~}
206\newcommand*\iso@yearsep{~}
207\DeclareRobustCommand*\isospacebeforeday[1]{\def\iso@daysep{#1}}
208\DeclareRobustCommand*\isospacebeforemonth[1]{\def\iso@monthsep{#1}}
209\DeclareRobustCommand*\isospacebeforeyear[1]{\def\iso@yearsep{#1}}
\iso@printdate Defines the commandiso@printdatewhich takes three arguments (year, month, day) and prints the date by using the\todaycommand.
210\newcommand*\iso@printdate[3]{%
211 \begingroup%
Generate a warning if the active language is not known byisodate.
212 \@ifundefined{iso@printdate@\iso@languagename}{%
213 \PackageWarning{isodate}{Language \iso@languagename\space unknown
214 to isodate.\MessageBreak
215 Using default format}%
216 }{}%
The counters \year, \month, and \day are preserved as counters instead of changed to macros (as it has been done until version 2.25) to avoid problems with languages that are not defined inisodate.sty.
217 \year=#1 %
218 \month=#2 %
219 \day=#3 %
220 \today%
221 \endgroup%
222}
\printdate Prints a date that is given as one argument in one of these formats: yyyy-mm-dd, dd/mm/yyyy,dd.mm.yyyy.
223\DeclareRobustCommand*\printdate[1]{%
Define\iso@datecommand to expand the argument#1.
224 \edef\iso@date{#1}%
Count appearances of ‘/’, ‘-’, and ‘.’ in the argument.
225 \SubStringsToCounter{iso@slash}{/}{\iso@date}%
226 \SubStringsToCounter{iso@minus}{-}{\iso@date}%
227 \SubStringsToCounter{iso@dot}{.}{\iso@date}%
If number of ‘.’ in the argument is equal to 2 then the German formatdd.mm.yyyy is used.
228 \ifthenelse{\equal{\theiso@dot}{2}}{%
229 \expandafter\iso@input@german\iso@date\@empty}{%
If number of ‘-’ in the argument is equal to 2 then the ISO formatyyyy-mm-ddis used.
230 \ifthenelse{\equal{\theiso@minus}{2}}{%
231 \expandafter\iso@input@iso\iso@date\@empty}{%
If number of ‘/’ in the argument is equal to 2 then the British English format dd/mm/yyyyis used.
232 \ifthenelse{\equal{\theiso@slash}{2}}{%
233 \expandafter\iso@input@english\iso@date\@empty}{%
Else no of the formats above is used an thus an error message is thrown.
234 ????\iso@isodash ??\iso@isodash ??%
235 \PackageError{isodate}{unrecognized date format}{Use one of
236 the following formats as macro argument:^^J%
237 \space\space dd.mm.yyyy^^J%
238 \space\space dd/mm/yyyy^^J%
239 \space\space yyyy-mm-dd^^J%
240 Don’t use any spaces or commands like \protect\, or
241 \protect~ inside the argument.}%
242 }}}%
243}
\iso@input@iso Converts a string with the formatyyyy-mm-ddto three arguments{#1}{#2}{#3}
and calls\iso@printdate.
244\def\iso@input@iso#1-#2-#3\@empty{\iso@printdate{#1}{#2}{#3}}
\iso@input@german Converts a string with the formatdd.mm.yyyyto three arguments{#3}{#2}{#1}
and calls\iso@printdate.
245\def\iso@input@german#1.#2.#3\@empty{\iso@printdate{#3}{#2}{#1}}
\iso@input@english Converts a string with the formatdd/mm/yyyyto three arguments{#3}{#2}{#1}
and calls\iso@printdate.
246\def\iso@input@english#1/#2/#3\@empty{%
247 \ifthenelse{\equal{\iso@inputformat}{tex}}{%
248 \iso@printdate{#1}{#2}{#3}%
249 }{%
250 \ifthenelse{\equal{\iso@inputformat}{american}}{%
251 \iso@printdate{#3}{#1}{#2}%
252 }{%
253 \iso@printdate{#3}{#2}{#1}%
254 }%
255 }%
256}
\printdateTeX Prints a date that is given as one argument in the formatyyyy/mm/dd.
257\DeclareRobustCommand*\printdateTeX[1]{%
Define\iso@datecommand to expand the argument#1.
258 \edef\iso@date{#1}%
Count appearances of ‘/’ in the argument.
259 \SubStringsToCounter{iso@slash}{/}{\iso@date}%
If number of ‘/’ in the argument is equal to 2 then the LATEX format yyyy/mm/dd is used.
260 \ifthenelse{\equal{\theiso@slash}{2}}{%
261 \expandafter\iso@input@TeX\iso@date\@empty}{%
Else no of the formats above is used an thus an error message is thrown.
262 ????\iso@isodash ??\iso@isodash ??%
263 \PackageError{isodate}{unrecognized date format}{Use one of
264 the following formats as macro argument:^^J%
265 \space\space dd.mm.yyyy^^J%
266 \space\space dd/mm/yyyy^^J%
267 \space\space yyyy-mm-dd^^J%
268 Don’t use any spaces or commands like \protect\, or
269 \protect~ inside the argument.}%
270 }}
\iso@input@TeX Converts a string with the formatyyyy/mm/ddto three arguments{#1}{#2}{#3}
and calls\iso@printdate.
271\def\iso@input@TeX#1/#2/#3\@empty{\iso@printdate{#1}{#2}{#3}}
\iso@printmonthday@int ??????
272\def\iso@printmonthday@int#1#2{%
273 \ifthenelse{\equal{\iso@dateformat}{iso}}{%
274 \iso@printmonth{#1}%
275 \ifiso@doprintday
276 \iso@isodash\iso@printday{#2}%
277 \fi
278 }{%
279 \ifthenelse{\equal{\iso@dateformat}{TeX}}{%
280 \iso@printmonth{#1}%
281 \ifiso@doprintday
282 /\iso@printday{#2}%
283 \fi
284 }{%
285 \PackageError{isodate.sty}{\csname iso@printmonthday\endcsname:
286 Invalid date format ‘\iso@dateformat’}{Internal error. Please
287 report to the package author.}
288 }%
289 }%
290}
\iso@printdate@int ??????
291\def\iso@printdate@int#1#2#3{%
292 \ifiso@printyear
293 \ifthenelse{\equal{\iso@dateformat}{iso}}{%
294 \iso@yearfour{\number#1}\iso@isodash%
295 }{%
296 \ifthenelse{\equal{\iso@dateformat}{TeX}}{%
297 \iso@yearfour{\number#1}/%
298 }{%
299 \PackageError{isodate.sty}{\csname iso@printmonthday\endcsname:
300 Invalid date format ‘\iso@dateformat’}{Internal error. Please
301 report to the package author.}
302 }%
303 }%
304 \fi
305 \csname iso@printmonthday@int\endcsname{\number#2}{\number#3}%
306}
\iso@daterange@int ??????
307\def\iso@daterange@int#1#2#3#4#5#6{%
308 \ifthenelse{\equal{\iso@dateformat}{iso}\OR
309 \equal{\iso@dateformat}{TeX}}{%
310 \csname iso@printdate@\iso@languagename\endcsname{#1}{#2}{#3}%
311 \iso@rangesign%
312 \ifthenelse{\equal{\number#1}{\number#4}}{%
313 \ifthenelse{\equal{\number#2}{\number#5}}{%
314 \ifiso@doprintday
315 \iso@printday{#6}%
316 \else
317 \iso@printmonthday@int{#5}{#6}%
318 \fi
319 }{%
320 \iso@printmonthday@int{#5}{#6}%
321 }%
322 }{%
323 \iso@printdate@int{#4}{#5}{#6}%
324 }%
325 }{%
326 \PackageError{isodate.sty}{\csname iso@printmonthday\endcsname:
327 Invalid date format ‘\iso@dateformat’}{Internal error. Please
328 report to the package author.}
329 }%
330}
\daterange Prints a date range.
331\DeclareRobustCommand*\daterange[2]{%
Define\iso@dateand\iso@@datecommands to expand the argument#1and#2.
Define\iso@@@datewhich contains both arguments devided by a komma.
332 \edef\iso@date{#1}%
333 \edef\iso@@date{#2}%
334 \edef\iso@@@date{\iso@date,\iso@@date}%
Count appearances of ‘/’, ‘-’, and ‘.’ in the arguments.
335 \SubStringsToCounter{iso@slash}{/}{\iso@date}%
336 \SubStringsToCounter{iso@minus}{-}{\iso@date}%
337 \SubStringsToCounter{iso@dot}{.}{\iso@date}%
338 \SubStringsToCounter{iso@@slash}{/}{\iso@@date}%
339 \SubStringsToCounter{iso@@minus}{-}{\iso@@date}%
340 \SubStringsToCounter{iso@@dot}{.}{\iso@@date}%
If number of ‘.’ in both arguments is equal to 2 then the German format dd.mm.yyyyis used.
341 \ifthenelse{\equal{\theiso@dot}{2}\AND\equal{\theiso@@dot}{2}}{%
342 \expandafter\iso@range@input@german\iso@@@date\@empty}{%
If number of ‘-’ in both arguments is equal to 2 then the ISO formatyyyy-mm-dd is used.
343 \ifthenelse{\equal{\theiso@minus}{2}\AND\equal{\theiso@@minus}{2}}{%
344 \expandafter\iso@range@input@iso\iso@@@date\@empty}{%
If number of ‘/’ in both arguments is equal to 2 then the British English format dd/mm/yyyyis used.
345 \ifthenelse{\equal{\theiso@slash}{2}\AND
346 \equal{\theiso@@slash}{2}}{%
347 \expandafter\iso@range@input@english\iso@@@date\@empty}{%
Else no of the formats above is used an thus an error message is thrown.
348 ????\iso@isodash ??\iso@isodash ??%
349 \PackageError{isodate}{unrecognized date format}{Use one of
350 the following formats as macro argument:^^J%
351 \space\space dd.mm.yyyy^^J%
352 \space\space dd/mm/yyyy^^J%
353 \space\space yyyy-mm-dd^^J%
354 Don’t use any spaces or commands like \protect\, or
355 \protect~ inside the argument.^^J
356 Use the same format for both arguments.}%
357 }}}%
358}
\iso@range@input@iso Converts a string with the format yyyy-mm-dd,yyyy-mm-dd to six arguments {#1}{#2}{#3}{#4}{#5}{#6}and calls\iso@daterange@language.
359\def\iso@range@input@iso#1-#2-#3,#4-#5-#6\@empty{%
360 \begingroup
Generate a warning if the active language is not known byisodate.
361 \@ifundefined{iso@daterange@\iso@languagename}{%
362 \PackageWarning{isodate}{Language \iso@languagename\space unknown
363 to isodate.\MessageBreak
364 Using default date range\MessageBreak
365 with range sign --}%
366 \expandafter\def\csname iso@printdate@\iso@languagename\endcsname{}%
Print date range in fall-back format.
367 \iso@printdate{#1}{#2}{#3}--\iso@printdate{#4}{#5}{#6}%
368 }{%
Print date range in the chosenisodateformat.
369 \ifthenelse{\equal{\number#1}{\number#4}}{}{\printyearon}%
370 \csname iso@daterange@\iso@languagename\endcsname{%
371 #1}{#2}{#3}{#4}{#5}{#6}%
372 }%
373 \endgroup
374}
\iso@range@input@german Converts a string with the format dd.mm.yyyy,dd.mm.yyyy to six arguments {#3}{#2}{#1}{#6}{#5}{#4}and calls\iso@daterange@language.
375\def\iso@range@input@german#1.#2.#3,#4.#5.#6\@empty{%
376 \begingroup
Generate a warning if the active language is not known byisodate.
377 \@ifundefined{iso@daterange@\iso@languagename}{%
378 \PackageWarning{isodate}{Language \iso@languagename\space unknown
379 to isodate.\MessageBreak
380 Using default date range\MessageBreak
381 with range sign --}%
382 \expandafter\def\csname iso@printdate@\iso@languagename\endcsname{}%
Print date range in fall-back format.
383 \iso@printdate{#3}{#2}{#1}--\iso@printdate{#6}{#5}{#4}%
384 }{%
Print date range in the chosenisodateformat.
385 \ifthenelse{\equal{\number#3}{\number#6}}{}{\printyearon}%
386 \csname iso@daterange@\iso@languagename\endcsname{%
387 #3}{#2}{#1}{#6}{#5}{#4}%
388 }%
389 \endgroup
390}
\iso@range@input@english Converts a string with the format dd/mm/yyyy,dd/mm/yyyy to six arguments {#3}{#2}{#1}{#6}{#5}{#4}and calls\iso@daterange@language.
391\def\iso@range@input@english#1/#2/#3,#4/#5/#6\@empty{%
392 \begingroup
Generate a warning if the active language is not known byisodate.
393 \@ifundefined{iso@daterange@\iso@languagename}{%
394 \PackageWarning{isodate}{Language \iso@languagename\space unknown
395 to isodate.\MessageBreak
396 Using default date range\MessageBreak
397 with range sign --}%
398 \expandafter\def\csname iso@printdate@\iso@languagename\endcsname{}%
Print date range in fall-back format.
399 \ifthenelse{\equal{\iso@inputformat}{tex}}{%
400 \iso@printdate{#1}{#2}{#3}--\iso@printdate{#4}{#5}{#6}%
401 }{%
402 \ifthenelse{\equal{\iso@inputformat}{american}}{%
403 \iso@printdate{#3}{#1}{#2}--\iso@printdate{#6}{#4}{#5}%
404 }{%
405 \iso@printdate{#3}{#2}{#1}--\iso@printdate{#6}{#5}{#4}%
406 }%
407 }%
408 }{%
Print date range in the chosenisodateformat.
409 \ifthenelse{\equal{\number#3}{\number#6}}{}{\printyearon}%
410 \ifthenelse{\equal{\iso@inputformat}{tex}}{%
411 \csname iso@daterange@\iso@languagename\endcsname{%
412 #1}{#2}{#3}{#4}{#5}{#6}%
413 }{%
414 \ifthenelse{\equal{\iso@inputformat}{american}}{%
415 \csname iso@daterange@\iso@languagename\endcsname{%
416 #3}{#1}{#2}{#6}{#4}{#5}%
417 }{%
418 \csname iso@daterange@\iso@languagename\endcsname{%
419 #3}{#2}{#1}{#6}{#5}{#4}%
420 }%
421 }%
422 }%
423 \endgroup
424}
Define the counters for conting the appearances of ‘.’, ‘-’, and ’/’ in the arguments.
425\newcounter{iso@slash}
426\newcounter{iso@minus}
427\newcounter{iso@dot}
428\newcounter{iso@@slash}
429\newcounter{iso@@minus}
430\newcounter{iso@@dot}
The command\iso@languagenameis defined to be able to use this package with- out loading one of the language packages babel.sty, german.sty, or ngerman.sty.
If neither babel.sty nor german.sty nor ngerman.sty is loaded my computer returns ‘nohyphenation’ when using \languagename. So this is the indication that none of the above packages is loaded.
431\AtBeginDocument{%
432 \@tempswafalse
433 \@ifpackageloaded{babel}{%
434 \@tempswatrue
435 \typeout{isodate: babel.sty has been loaded}%
436 }{}%
437 \@ifpackageloaded{german}{%
438 \@tempswatrue
439 \typeout{isodate: german.sty has been loaded}%
440 }{}%
441 \@ifpackageloaded{ngerman}{%
442 \@tempswatrue
443 \typeout{isodate: ngerman.sty has been loaded}%
444 }{}%
The language is not equal ‘nohyphenation’. So one of the language packages is loaded. Replace the internal language name \iso@languagename by the global language name\languagename.
445 \if@tempswa
446 \gdef\iso@languagename{\languagename}%
Reload language to surely switch to new date format. The languagename gets first expanded because of errors that would occur otherwise.
447 \edef\iso@tmplang{\languagename}%
448 \expandafter\selectlanguage\expandafter{\iso@tmplang}%
449 \else
At the end of the preamble still none of the language packages are loaded. So no language switching is possible. Set the date language manually to the last language that was loaded for isodate.
450 \typeout{isodate: babel.sty, (n)german.sty have not been loaded}%
451 \csname date\iso@languagename\endcsname%
452 \fi
453}
454h/isodatei
D.2 Language definition file danish.idf
\iso@languageloaded Define the command \iso@languageloaded in order to enable isodate.sty to determine if at least one language is loaded.
455h∗danishi
456\let\iso@languageloaded\active
457\typeout{Define commands for Danish date format}
\month@danish Prints the name of today’s month in the long form for the original date format.
458\def\month@danish{\ifcase\month\or
459 januar\or februar\or marts\or april\or maj\or juni\or
460 juli\or august\or september\or oktober\or november\or december\fi}
\iso@printmonthday@danish Prints the month and the day given as two arguments ({mm}{dd}) in the current date format.
461\def\iso@printmonthday@danish#1#2{%
462 \ifthenelse{\equal{\iso@dateformat}{iso}\OR
463 \equal{\iso@dateformat}{TeX}}{%
464 \iso@printmonthday@int{#1}{#2}%
465 }{%
Numeric and short date format: dd/mm/
466 \ifthenelse{\equal{\iso@dateformat}{numeric}\OR
467 \equal{\iso@dateformat}{short}}{%
468 \ifiso@doprintday
469 \iso@printday{#2}/%
470 \fi
471 \iso@printmonth{#1}%
472 }{%
Original date format: d. mmm
473 \ifthenelse{\equal{\iso@dateformat}{orig}\OR
474 \equal{\iso@dateformat}{shortorig}}{%
475 \ifiso@doprintday
476 \iso@printday{#2}.\iso@monthsep
477 \fi
478 \begingroup
479 \edef\lmonth{#1}\def\month{\lmonth}%
480 \month@danish%
481 \endgroup
482 }{}%
483 }%
484 }%
485}
\iso@printdate@danish Prints the date given as three arguments ({yyyy}{mm}{dd}) in the actual date format
486\def\iso@printdate@danish#1#2#3{%
ISO or LATEXdate format: yyyy\iso@printmonthday@danish
487 \ifthenelse{\equal{\iso@dateformat}{iso}\OR
488 \equal{\iso@dateformat}{TeX}}{%
489 \iso@printdate@int{#1}{#2}{#3}%
490 }{%
491 \iso@printmonthday@danish{\number#2}{\number#3}%
492 \ifiso@printyear
?????
493 \ifthenelse{\equal{\iso@dateformat}{orig}\OR
494 \equal{\iso@dateformat}{shortorig}}{%
495 }{%
496 /%
497 }%
numeric date format: \iso@printmonthday@danish yyyy
498 \ifthenelse{\equal{\iso@dateformat}{numeric}}{%
499 \iso@yearfour{\number#1}%
500 }{%
original date format: \iso@printmonthday@danish~yyyy
501 \ifthenelse{\equal{\iso@dateformat}{orig}}{%
502 \iso@yearsep\iso@yearfour{\number#1}%
503 }{%
short original date format: \iso@printmonthday@danish~yy
504 \ifthenelse{\equal{\iso@dateformat}{shortorig}}{%
505 \iso@yearsep\iso@twodigitsign\iso@yeartwo{\number#1}%
506 }{%
short date format: \iso@printmonthday@danish yy
507 \ifthenelse{\equal{\iso@dateformat}{short}}{%
508 \iso@yeartwo{\number#1}%
509 }{}%
510 }%
511 }%
512 }%
513 \fi
514 }%
515}
\iso@datedanish This command redefines the\todaycommand to print in the actual date format.
516\def\iso@datedanish{%
517 \def\today{\iso@printdate@danish{\year}{\month}{\day}}}%
\iso@daterange@... Define date-range commands for dialects.
518\expandafter\def\csname iso@daterange@\CurrentOption\endcsname{%
519 \iso@daterange@danish}%
\iso@daterange@danish This command takes six arguments ({yyyy1}{mm1}{dd1}{yyyy2}{mm2}{dd2}) and prints the corrosponding date range in the actual date format.
520\def\iso@daterange@danish#1#2#3#4#5#6{%
ISO or LATEX date format.
521 \ifthenelse{\equal{\iso@dateformat}{iso}\OR
522 \equal{\iso@dateformat}{TeX}}{%
Call the appropriate international routine.
523 \iso@daterange@int{#1}{#2}{#3}{#4}{#5}{#6}%
524 }{%
Numeric, short, or original date format.
If year and month are equal, only print the day of the start date. If only the year is equal, only print month and day of the start date. Otherwise print the whole start date.
525 \ifthenelse{\equal{\number#1}{\number#4}}{%
526 \ifthenelse{\equal{\number#2}{\number#5}}{%
527 \ifiso@doprintday
528 \ifthenelse{\equal{\iso@dateformat}{orig}\OR
529 \equal{\iso@dateformat}{shortorig}}{%
530 \iso@printday{#3}.%
531 }{%
532 \iso@printday{#3}%
533 }%
534 \else
535 \iso@printmonthday@danish{#2}{#3}%
536 \fi
537 }{%
538 \iso@printmonthday@danish{#2}{#3}%
539 }%
540 }{%
541 \csname iso@printdate@\iso@languagename\endcsname{#1}{#2}{#3}%
542 }%
Print the end date.
543 \iso@rangesign
544 \csname iso@printdate@\iso@languagename\endcsname{#4}{#5}{#6}%
545 }%
546}
\iso@rangesign@danish Sets the word between start and end date in a date range to ‘ til ’.
547\expandafter\def\csname iso@rangesign@\CurrentOption\endcsname{~til~}
Define the language name that will the active language for isodate if none of the packages babel.sty, german.sty, and ngerman.sty is loaded and if this is the last language that is used for isodate. If one of the above packages is used this definition will be overridden by the command \languagename that will always return the current used language.
548\def\iso@languagename{danish}%
Redefine the command\datedanishthat is used by babel to switch to the original Danish date format to enable the use of different date formats. This has to be done after the preamble in order to ensure to overwrite the babel command.
549\AtBeginDocument{%
550 \ifx\undefined\iso@datedanish\else
551 \def\datedanish{\iso@datedanish}%
552 \fi
553}
554h/danishi
D.3 Language definition file english.idf
\iso@languageloaded Define the command \iso@languageloaded in order to enable isodate.sty to determine if at least one language is loaded.
555h∗englishi
556\let\iso@languageloaded\active
\month@english Prints the name of today’s month in the long form for the original date format.
557\def\month@english{\ifcase\month\or
558 January\or February\or March\or April\or May\or June\or
559 July\or August\or September\or October\or November\or December\fi}
British and American English dates are very different. So handle them seperately.
It might have been easier to put them in different files but I wanted to organize my files analogous to babel.
First handle British English.
560\ifthenelse{\equal{\CurrentOption}{english}\OR
561 \equal{\CurrentOption}{british}\OR
562 \equal{\CurrentOption}{UKenglish}}{%
563 \typeout{Define commands for English date format}
\day@english Prints today’s day for the original date format.
564 \def\day@english{%
565 \ifiso@cleanlook
566 \day
567 \else
568 \ifcase\day\or
569 1st\or 2nd\or 3rd\or 4th\or 5th\or
570 6th\or 7th\or 8th\or 9th\or 10th\or
571 11th\or 12th\or 13th\or 14th\or 15th\or
572 16th\or 17th\or 18th\or 19th\or 20th\or
573 21st\or 22nd\or 23rd\or 24th\or 25th\or
574 26th\or 27th\or 28th\or 29th\or 30th\or
575 31st%
576 \fi
577 \fi
578 }
\iso@printmonthday@english Prints the month and the day given as two arguments ({mm}{dd}) in the current date format.
579 \def\iso@printmonthday@english#1#2{%
Numeric and short date format: dd/mm/
580 \ifthenelse{\equal{\iso@dateformat}{iso}\OR
581 \equal{\iso@dateformat}{TeX}}{%
582 \iso@printmonthday@int{#1}{#2}%
583 }{%
584 \ifthenelse{\equal{\iso@dateformat}{numeric}\OR
585 \equal{\iso@dateformat}{short}}{%
586 \ifiso@doprintday
587 \iso@printday{#2}/%
588 \fi
589 \iso@printmonth{#1}%
590 }{%
Original date format: ddd mmm
591 \ifthenelse{\equal{\iso@dateformat}{orig}\OR
592 \equal{\iso@dateformat}{shortorig}}{%
593 \begingroup
594 \edef\lday{#2}\def\day{\lday}%
595 \edef\lmonth{#1}\def\month{\lmonth}%
596 \ifiso@doprintday
597 \day@english\iso@monthsep\@empty
598 \fi
599 \month@english
600 \endgroup
601 }{}%
602 }%
603 }%
604 }
\iso@printdate@english Prints the date given as three arguments ({yyyy}{mm}{dd}) in the actual date format.
605 \def\iso@printdate@english#1#2#3{%
606 \ifthenelse{\equal{\iso@dateformat}{iso}\OR
607 \equal{\iso@dateformat}{TeX}}{%
608 \iso@printdate@int{#1}{#2}{#3}%
609 }{%
ISO date format: yyyy-\iso@printmonthday@english
610 \iso@printmonthday@english{\number#2}{\number#3}%
Numeric date format: \iso@printmonthday@english yyyy
611 \ifiso@printyear
612 \ifthenelse{\equal{\iso@dateformat}{orig}\OR
613 \equal{\iso@dateformat}{shortorig}}{%
614 }{%
615 /%
616 }%
617 \ifthenelse{\equal{\iso@dateformat}{numeric}}{%
618 \iso@yearfour{\number#1}%
619 }{%
Original date format: \iso@printmonthday@english~yyyy
620 \ifthenelse{\equal{\iso@dateformat}{orig}}{%
621 \iso@yearsep\iso@yearfour{\number#1}%
622 }{%
Short original date format: \iso@printmonthday@english~yy
623 \ifthenelse{\equal{\iso@dateformat}{shortorig}}{%
624 \iso@yearsep\iso@twodigitsign\iso@yeartwo{\number#1}%
625 }{%
Short date format: \iso@printmonthday@english yy
626 \ifthenelse{\equal{\iso@dateformat}{short}}{%
627 \iso@yeartwo{\number#1}%
628 }{}%
629 }%
630 }%
631 }%
632 \fi
633 }%
634 }
\iso@printdate@UKenglish Just a second name for\iso@printdate@UKenglish.
635 \def\iso@printdate@UKenglish{\iso@printdate@english}
636 \def\iso@printdate@british{\iso@printdate@english}
\iso@dateenglish This command redefines the\todaycommand to print in the actual date format.
637 \def\iso@dateenglish{%
638 \def\today{\iso@printdate@english{\year}{\month}{\day}}}%
\iso@daterange@... Define date-range commands for dialects of English.
639 \expandafter\def\csname iso@daterange@\CurrentOption\endcsname{%
640 \iso@daterange@english}%
\iso@daterange@english This command takes six arguments ({yyyy1}{mm1}{dd1}{yyyy2}{mm2}{dd2}) and prints the corrosponding date range in the actual date format.
641 \def\iso@daterange@english#1#2#3#4#5#6{%
ISO or LATEX date format.
642 \ifthenelse{\equal{\iso@dateformat}{iso}\OR
643 \equal{\iso@dateformat}{TeX}}{%
Print the start date.
644 \iso@daterange@int{#1}{#2}{#3}{#4}{#5}{#6}%
645 }{%
Numeric, short, or original date format.
If year and month are equal, only print the day of the start date. If only the year is equal, only print month and day of the start date. Otherwise print the whole start date.
646 \ifthenelse{\equal{\number#1}{\number#4}}{%
647 \ifthenelse{\equal{\number#2}{\number#5}}{%
648 \ifiso@doprintday
649 \ifthenelse{\equal{\iso@dateformat}{orig}\OR
650 \equal{\iso@dateformat}{shortorig}}{%
651 \begingroup
652 \edef\lday{#3}\def\day{\lday}%
653 \day@english
654 \endgroup
655 }{%
656 \iso@printday{#3}%
657 }%
658 \else
659 \csname iso@printmonthday@\iso@languagename\endcsname{#2}{#3}%
660 \fi
661 }{%
662 \csname iso@printmonthday@\iso@languagename\endcsname{#2}{#3}%
663 }%
664 }{%
665 \csname iso@printdate@\iso@languagename\endcsname{#1}{#2}{#3}%
666 }%
Print the end date.
667 \iso@rangesign
668 \csname iso@printdate@\iso@languagename\endcsname{#4}{#5}{#6}%
669 }%
670 }
Define the language name that will the active language for isodate if none of the packages babel.sty, german.sty, and ngerman.sty is loaded and if this is the last language that is used for isodate. If one of the above packages is used this definition will be overridden by the command \languagename that will always return the current used language.
671 \def\iso@languagename{english}%
The end of the British section.
Second handle Australian and New Zealand.
672}{%
673 \ifthenelse{\equal{\CurrentOption}{australian}\OR
674 \equal{\CurrentOption}{newzealand}}{%
675 \typeout{Define commands for Australian date format}
\iso@printmonthday@australian Prints the month and the day given as two arguments ({mm}{dd}) in the current date format.
676 \def\iso@printmonthday@australian#1#2{%
677 \ifthenelse{\equal{\iso@dateformat}{iso}\OR
678 \equal{\iso@dateformat}{TeX}}{%
679 \iso@printmonthday@int{#1}{#2}%
680 }{%
Numeric and short date format: dd/mm/
681 \ifthenelse{\equal{\iso@dateformat}{numeric}\OR
682 \equal{\iso@dateformat}{short}}{%
683 \ifiso@doprintday
684 \iso@printday{#2}/%
685 \fi
686 \iso@printmonth{#1}%
687 }{%