I want to create a command like "\mês" which returns the atual month in portuguese, like "Agosto".

I'm usually using the command \the\year to show the year, and the \date returns all the date "20/08/2021" and the \month return just the number. I need to create a command to return the month in portuguese.

1 Answer 1


You can't1 have a macro called \mês, with an accented letter, so here's a \mes macro:

  \or Janeiro\or Fevereiro\or Março\or Abril\or Maio\or Junho\or
  Julho\or Agosto\or Setembro\or Outubro\or Novembro\or Dezembro\fi}

It takes the value of \month and branches to one of twelve cases (there's an explanation about the syntax of \ifcase here), and writes the respective month.

[1]: Terms and conditions may apply: you can have a macro called \mês if you are using an Unicode engine like XeTeX or LuaTeX, or if you create the control sequence indirectly with \csname mês\endcsname, but it's usually better to stick to ASCII for macro names.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .