Qualche miglioramento al codice:
`\usepackage{datetime}
\usepackage{etoolbox}
\makeatletter
\newcommand\patchmonthname{%
\ifcsname p@monthname\languagename\endcsname % already patched
\else
\ifcsname monthname\languagename\endcsname
\typeout{Patching \string\monthname\languagename}%
\@patchmonthname
\typeout{Patched \string\monthname\languagename}%
\else
\typeout{No original \string\monthname\languagename}%
\fi
\fi}
\begingroup
\@makeother\#
\gdef\@patchmonthname{%
\letcs\@tempa{\string\monthname\languagename}%
\patchcmd\@tempa{\the\@orgargctr}{#1}{}{}%
\patchcmd\@tempa{\the\@orgargctr}{#1}{}{}%
\patchcmd\@tempa{\@orgargctr=#1\relax}{}{}{}%
\patchcmd\@tempa{\@orgargctr}{#1\relax}{}{}%
\global\expandafter\let\csname p@monthname\languagename\endcsname\@tempa}
\endgroup
\@ifpackageloaded{babel}{}{\patchmonthname}
\newcommand*\Monthname[1]{%
\begingroup\edef\x{\endgroup\noexpand\MakeTextUppercase
% Dovrei generare un errore se non è definito?
\csname p@monthname\languagename\endcsname[#1]}\x
}
\apptocmd\select@language{\patchmonthname}{}{}
\makeatother`
1. Non ho ben capito perché definivi [tt]\patchmonthname[/tt] con un argomento che poi non usavi. Il controllo su “multilingual” è ridondante e ti impedisce di usare la macro se non carichi babel.
2. I controlli sono in ordine diverso: non facciamo niente se [tt]\p@monthname
3. Usiamo [tt]\ifcsname…\endcsname[/tt] che è più efficiente.
4. Eliminiamo [tt]\@@patchmonthname[/tt]
5. La riassegnazione finale del significato di [tt]\@tempa[/tt] a [tt]\p@monthname
6. Com’è definito ora [tt]\Monthname[/tt] è meglio, perché il significato di [tt]\x[/tt] sparisce da sé
7. Se babel non è caricato, si esegue [tt]\patchmonthname[/tt] una volta per tutte con l’inglese.
Ciao
Enrico