[OS X TeX] datetime package

Bruno Voisin bvoisin at mac.com
Sat Mar 17 10:19:53 CET 2007


Le 16 mars 07 à 17:19, Salvatore Enrico Indiogine a écrit :

> I would like to modify the format of the date produced by \today from
>
> month day, year
>
> to the European format
>
> day month year
>
> I added \usepackage{datetime} to my preamble and received the  
> following message:
>
> LaTeX Error: File `datetime.sty' not found
>
> So, I guess I have something missing in my TeX installation.  I am
> still a TeX newbie so I am at a low here.

Just two remarks, in addition to the other answers you've got already:

- The datetime package isn't included in gwTeX, installed by i- 
Installer, which I suppose is the TeX distribution you've got.  
However, it is included in TeXLive-2007, as installed by the MacTeX  
installer available from <http://www.tug.org/mactex>. Beware: huge  
download!

- If you skip the datetime package and finally decide to do things  
manually, and if you want to go "by the book", there are actually two  
commands in LaTeX, \date and \today:

-- \today is a command taking no argument, and returning the current  
date at the time your .tex document is typeset.

-- \date is a command taking one argument, and defining the date that  
is used in title pages, in headings, in letters, etc.

LaTeX initializes \date to \today (namely latex.ltx sets \date 
{\today}), but you can change this to anything of your liking. For  
example, if you want a report to bear the date it was actually  
completed, say 17 March 2007, just write:

\date{17~March 2007}

Without this redefinition, imagine you lose the .pdf file for your  
report and decide to re-typeset the .tex input later on 27 July 2007,  
say, then your report will have the date returned by \today in its  
title page, namely 27 July 2007, instead of the original date of its  
completion, namely 17 March 2007.

So, if you want to do things consistently, for changing the format of  
all dates generated automatically by LaTeX, you need to redefine  
\today, using either the babel package (which adapts date formats to  
the assumed standards of each language) or doing the redefinition  
yourself manually. The LaTeX default is:

\def\today{\ifcase\month\or
   January\or February\or March\or April\or May\or June\or
   July\or August\or September\or October\or November\or December\fi
   \space\number\day, \number\year}

which is more-or-less self-explanatory, and this can be easily enough  
redefined to the European format using:

\renewcommand{\today}{\number\day\space\ifcase\month\or
   January\or February\or March\or April\or May\or June\or
   July\or August\or September\or October\or November\or December\fi
   \space\number\year}

And for adjusting a given date yourself, just use \date.

Hope this helps,

Bruno Voisin
------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the macostex-archives mailing list