Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am building a fairly complex letter template as article-extending class, which needs to be able to understand two languages (English and German). This is implemented via babel (with both ngerman and english as package options) and \DeclareOption, which uses \selectlanguage to determine which one.

Currently, I use datetime and \today to set the date, but that requires to load babel BEFORE datetime (source). What is the correct way to do this?

I could imagine the following, but don't know how to do any of these:

  • reload babel so that it updates the dateformat AFTER language option has been processed

  • specifiy the language for datetime (or use another package that supports this)

  • do it manually via ifthenelse (I can do that, but there has to be a more elegant way?)

Thanks for your input!

Minimal Non-Working Example:

\usepackage[english, ngerman]{babel}
\usepackage{datetime}

\DeclareOption{E}{
    \selectlanguage{english}
}
\ProcessOptions\relax
% date formatting magic here please %
\today
share|improve this question

1 Answer 1

For the time being, I decided to settle with the following (this thing needs to work after all), but if somebody knows a more elegant solution, I would be happy to hear it!

\ifthenelse{
    \equal{\mylanguage}{german}
    }{ % german
    \renewcommand{\dateseparator}{.}
    }{ % english
    \renewcommand{\dateseparator}{/}
    }
    \ddmmyyyydate
    \today
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.