7

All I wish to do is to use \today to output in the format "18 november 2013". With the datetime package I can get to "18 November 2013" with:

 \documentclass[11pt,twoside,onecolumn,openany,final]{memoir}

 \usepackage[nodayofweek]{datetime}

 \newdateformat{mydate}{{\THEDAY}{ }\monthname[\THEMONTH] \THEYEAR}

 \begin{document}

 \mydate\today

 \end{document}

but after that point I have been unable to have any success in making a lowercase month name. The closest I have been came by adding in the \MakeLowercase command here:

{{\THEDAY}{ }\monthname\MakeLowercase[\THEMONTH] \THEYEAR}

but that for some reason brings in numerals and ends up like this:

18 November [11] 2013

Again, that still falls short of what I would like it to be. Is there a way to to bring in a lowercase command properly here so that for any given date output by \today the format is

18 november 2013

2 Answers 2

7

As with Datetime capitalize month, you can redefine the language-appropriate definition that extracts the month name:

enter image description here

\documentclass[11pt,twoside,onecolumn,openany,final]{memoir}% http://ctan.org/pkg/memoir
\usepackage[nodayofweek]{datetime}% http://ctan.org/pkg/datetime
\newdateformat{mydate}{{\THEDAY}{ }\monthname[\THEMONTH] \THEYEAR}
\makeatletter
\renewcommand*{\monthnameenglish}[1][\month]{%
  \@orgargctr=#1\relax
  \ifcase\@orgargctr
  \PackageError{datetime}{Invalid Month number \the\@orgargctr}{Month
  numbers should go from 1 (january) to 12 (december)}%
  \or january%
  \or february%
  \or march%
  \or april%
  \or may%
  \or june%
  \or july%
  \or august%
  \or september%
  \or october%
  \or november%
  \or december%
  \else \PackageError{datetime}{Invalid Month number \the\@orgargctr}{%
  Month numbers should go from 1 (january) to 12 (december)}%
  \fi
}
\makeatother
\begin{document}

\mydate\today

\end{document}

The above works since the default english language is chosen. If you're interested in have non-title-case "short month names", you'd have to redefine also \shortmonthnameenglish:

\renewcommand*{\shortmonthnameenglish}[1][\month]{%
  \@orgargctr=#1\relax
  \ifcase\@orgargctr
  \PackageError{datetime}{Invalid Month number \the\@orgargctr}{Month
  numbers should go from 1 (jan) to 12 (dec)}%
  \or jan%
  \or feb%
  \or mar%
  \or apr%
  \or may%
  \or jun%
  \or jul%
  \or aug%
  \or sept%
  \or oct%
  \or nov%
  \or dec%
  \else%
  \PackageError{datetime}%
  {Invalid Month number \the\@orgargctr}%
  {Month numbers should go from 1 (jan) to 12 (dec)}%
\fi
}
4
  • Wow, that was a longer workaround than I expected. Thanks for your help! Nov 18, 2013 at 21:08
  • @JeffMcClenahan: This would be the proper way of doing it.
    – Werner
    Nov 18, 2013 at 21:11
  • @Werner, do you know if there is a command \tomorrow or \yesterday?
    – Sigur
    Nov 18, 2013 at 21:36
  • 1
    @Sigur: See How to implement a \tomorrow in LaTeX. From there I guess you'd be able to define \yesterday.
    – Werner
    Nov 18, 2013 at 21:39
4

Define \Monthname, instead of \monthname.

 \documentclass[11pt,twoside,onecolumn,openany,final]{memoir}
 \newcommand\Monthname[1][EMPTY]{%
  \ifnum1=#1january\else
  \ifnum2=#1february\else
  \ifnum3=#1march\else
  \ifnum4=#1april\else
  \ifnum5=#1may\else
  \ifnum6=#1june\else
  \ifnum7=#1july\else
  \ifnum8=#1august\else
  \ifnum9=#1september\else
  \ifnum10=#1october\else
  \ifnum11=#1november\else
  \ifnum12=#1december\else
  \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
}
 \usepackage[nodayofweek]{datetime}

 \newdateformat{mydate}{{\THEDAY}{ }\Monthname[\THEMONTH] \THEYEAR}

 \begin{document}
\mydate\today

 \end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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