LaTeX forum ⇒ GeneralUppercase months in “datetime”

LaTeX specific issues not fitting into one of the other forums of this category.
comandos
Posts: 3
Joined: Sat Dec 15, 2018 3:46 pm

Uppercase months in “datetime”

Postby comandos » Mon Aug 19, 2019 1:45 pm

Greetings,
I’m trying to type out the current month + year both in uppercase.
My current solution works like this:
1) Using “datetime” I call for the current month+year then
2) To make them uppercase I use “a custom” macro that replaces “month name” with my uppercase version

Here is a basic example of calling month and year together:
  1. \documentclass[a4paper,12pt]{article}
  2. \usepackage[slovene]{babel}
  3. \usepackage[utf8]{inputenc}
  4.  
  5. \usepackage{datetime}
  6. \newdateformat{monthyeardate}{%
  7. \monthname[\THEMONTH] \THEYEAR}
  8.  
  9. \begin{document}
  10.  
  11. \MakeUppercase{\monthyeardate\today} %not working :/
  12. \monthyeardate\today
  13.  
  14. \end{document}

And here is the custom macro I use:
  1. %%%%%%%%%month’s uppercase %%%%%%%%%
  2.  
  3. \makeatletter
  4. \renewcommand*{\monthnameslovene}[1][\month]{%
  5. \@orgargctr=#1\relax
  6. \ifcase\@orgargctr
  7. \PackageError{datetime}%
  8. {Invalid Month number \the\@orgargctr}%
  9. {Month numbers should go from 1 (JANUAR) to 12 (DECEMBER)}%
  10. \or JANUAR \or FEBRUAR \or MAREC \or APRIL \or MAJ \or JUNIJ \or JULIJ %
  11. \or AVGUST \or SEPTEMBER \or OKTOBER \or NOVEMBER \or DECEMBER %
  12. \else
  13. \PackageError{datetime}%
  14. {Invalid Month number \the\@orgargctr}%
  15. {Month numbers should go from 1 (JANUAR) to 12 (DECEMBER)}%
  16. \fi
  17. }%
  18. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Together they work but is there a better way/correct way of achieving the desired effect?
Best regards

Return to “General”

Who is online

Users browsing this forum: Google [Bot] and 7 guests