## LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

 Options: Use Forum View Use Monospaced Font Show Text Part by Default Show All Mail Headers Message: [<< First] [< Prev] [Next >] [Last >>] Topic: [<< First] [< Prev] [Next >] [Last >>] Author: [<< First] [< Prev] [Next >] [Last >>]

Richard Walker <[log in to unmask]> wrote:

>Part of the problem is that there isn't agreement on many aspects of
>formatting.
>
>A classic example is that of date formats.  Everybody thinks that they
>know best.  In Australia, you will see
>10th February, 1997
>February 10th, 1997
>February 10, 1997
>etc. etc.
...

I think this touches on a a very important issue, which I think ought to
be a major concern for the LaTeX3 project, namely, how to make LaTeX easily
customizable for the user.
Treating the date formats are interesting, because it might be possible
to get ideas of how it should work.
One idea might be implementing some kind of object orientation into LaTeX.
(My intention is just to present some ideas one might play around with.)

* In order to do this, we would need to have a class object \Date, handling
the aspects of dates which are common to all dates. (I use an uppercase
\Date for the class, and lowercase \date for instatiated elements.)

* We could agree that all dates are represented internally by three
numbers, year, month, day (but this would not work when treating different
calenders, in which case using Julian day numbers would be better).

* In order to create a \Date object, we would need a constructor
\new{Date}{x}{\year1997\month2\day10}
which might define
\def\x/date/year{1997}
\def\x/date/month{2}
\def\x/date/day{10}
(the character code of "/" temporarily set so this works).

* We need a print object, telling which formats to print on; the default
print object belongs to the class object \Date.
\Date/print[\format]{x}

* The environment can then set a variable
\Date/format
defining a local date format to print on.

* Then
\date{x}
would print the date in the \format that the latest environment defined, and
\date[\format]{x}
will print on the \format that you choose, which could be defined by another
environment, say
\date[\US/format]{x}
for getting the US date format.
(Alternatively, one could also define a macro \x printing the date, with
takes an optional argument \x[\format], which would be better, if one does
not have a problem with a lot of macro names that might collide.)

* The class object \date could have two variables
\Date/months/full
\Date/months/short
for defining full length month names ("January", etc), and short length month
names ("Jan", etc). (And similar for other attributes, like "10th", "1st".)
Different date printing formats can then call the these variables, which
then come out right when localized to other languages.

* Defining a date formate might then look something like
\set{Date}{format}{\dayorder\ \monthfull, \yearfull}
to get the format "10th February, 1997", if "\dayorder", "\monthfull",
"\yearfull" are selectors for the order number "10th", full month name, and
full year number.

Or something.
This would be complicated, but not so difficult, to use, and all the
formats mentioned by Richard Walker could then be produced.

Hans Aberg