datetime2 package FAQ

How do I provide for different declension (nominative, genitive etc)?) 🔗

Provide separate commands for each declension. An example is given in this TeX.SE answer for Czech, which defines \DTMczechnominativemonthname for the nominative case, and \DTMczechgenitivemonthname for the genitive case. The command \DTMczechmonthname needs to be initialised to the most appropriate of these. For example,

\newcommand*{\DTMczechmonthname}{\DTMczechgenitivemonthname}
Remember that if support for multiple file encodings is needed, an ASCII version needs to be defined in the -ascii.ldf file and the UTF-8 version needs to be defined in the -utf8.ldf file.

You can then provide a key for use with the language module to allow users to switch forms. For example:

\DTMdefchoicekey{czech}{month}[\val\nr]{genitive,nominative}{%
 \ifcase\nr\relax
  \renewcommand*\DTMczechmonthname{\DTMczechgenitivemonthname}%
  \renewcommand*\DTMczechMonthname{\DTMczechgenitiveMonthname}%
 \or
  \renewcommand*\DTMczechmonthname{\DTMczechnominativemonthname}%
  \renewcommand*\DTMczechMonthname{\DTMczechnominativeMonthname}%
 \fi
}
Similarly for week day names, if supported.

2023-04-14 10:10:40


Permalink: https://www.dickimaw-books.com/faq.php?id=214
Alternative link: https://www.dickimaw-books.com/faq.php?itemlabel=datedeclension

Category: datetime2 package
Topic: Localisation