I am working with datenumber package with spanish option, \usepackage[spanish]{datenumber} and I want to define a command similar to \datemonthname, but each month with the first 3 letters, I mean

enero=ene, febrero=feb, marzo=mar, mayo=may,



The first three (or more characters) of a string can be extracted with \StrLeft{somestring}{3} from the xstring package.

I wrapped a macro named \dateshortmonthname with one optional argument around \StrLeft{\datemonthname}{#1} where #1 defaults to 3 if not specified otherwise (or not at all).



\usepackage{pgffor} % only for demo



\foreach \x in {1,...,12} {%
Current month: \datemonthname~ -- short is \dateshortmonthname


enter image description here

Note The datenumber package is quite old and no changes have been made to it since about 15 years.

  • “This should be expandable, in my point of view.” I'm not sure what you mean by that, but that's not expandable. – Manuel May 22 '15 at 21:54
  • @Manuel: Right, it isn't. I will remove the statement. Thanks for complaining – user31729 May 22 '15 at 22:00

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.