datetime2 package FAQ
showdow
setting to a style? 🔗
You can use the \ifDTMshowdow
conditional to determine the showdow
setting, but remember that the style should also check if the day of week index has been set to -1
(which indicates that the day of week name should be ignored for a specific use case). So when you redefine \DTMdisplaydate
within \DTMnewstyle
or \DTMnewdatestyle
the test for the day of week name should look something like:
\ifDTMshowdow \ifnum##4>-1 % space needed after -1 % code that inserts the day of week name % where the day of week index is given by ##4 \fi \fiIf you are writing a language module, you need to define
\DTM
langweekdayname
where lang is the root language label. For example, datetime2-english defines \DTMenglishweekdayname
. This naming scheme is needed in order to work with \DTMweekdayname
provided by datetime2-calc.sty. (Similarly define \DTM
langWeekdayname
for first letter upper case version, \DTM
langshortweekdayname
and \DTM
langshortWeekdayname
for abbreviated versions, if required.)
If the week or month names include non-ASCII characters, there should be an ASCII version of \DTM
langweekdayname
in the file datetime2-lang-ascii.ldf and a UTF-8 version in the file datetime2-lang-utf8.ldf. You might find it easiest to adapt the code from an existing language module. For example, datetime2-french.dtx. This will allow support for multiple file encodings.
You might also want to consider providing a command to use as the separator between the day of week name and the rest of the date. For example, datetime2-en-GB.ldf defines:
\newcommand*{\DTMenGBdowdaysep}{\space}and also provides a key to change this value with
\DTMlangsetup[en-GB]{dowdaysep={
separator code}}
:
\DTMdefkey{en-GB}{dowdaysep}{\renewcommand*{\DTMenGBdowdaysep}{#1}}Another example is with datetime2-romanian which is regionless, so datetime2-romanian.ldf provides:
\newcommand*{\DTMromaniandowdaysep}{\space}and
\DTMdefkey{romanian}{dowdaysep}{\renewcommand*{\DTMromaniandowdaysep}{#1}}
2023-04-14 10:34:05
Permalink: https://www.dickimaw-books.com/faq.php?id=208
Alternative link: https://www.dickimaw-books.com/faq.php?itemlabel=showdowtest
Category: datetime2 package
Topic:
Date/Time Styles