redefine date format in letter environment

Haines Brown haines at histomat.net
Wed Dec 7 15:58:05 CET 2022


On Wed, Dec 07, 2022 at 02:49:45PM +0000, Lars Madsen wrote:
> erh, you defined it right there in \mydate but your not using it in the redefinition of \today.
> 
> So what actually is the problem with the example?

The day  prints as 7, not 07. Sorry I was not clearer 
> 
> 
> Lars Madsen
> Programmør
> 
> Institut for Matematik
> Aarhus Universitet
> 
> person.au.dk/daleif at math<https://person.au.dk/daleif@math>
> 
> ________________________________
> From: texhax <texhax-bounces+daleif=imf.au.dk at tug.org> on behalf of Haines Brown <haines at histomat.net>
> Sent: 07 December 2022 14:30
> To: texhax at tug.org <texhax at tug.org>
> Subject: redefine date format in letter environment
> 
> I want today's date to appear: 2022.21.07 rather than 2022.21.7
> 
> \documentclass[letterpaper,12pt]{letter}
> 
> \usepackage{fontspec}
> \usepackage{libertinus-otf}
> 
> \def\mydate{\leavevmode\hbox{\the\year.\twodigits\month.\twodigits\day}}
> \def\twodigits#1{\ifnum#1<10 0\fi\the#1}
> \renewcommand*\today{\number\year.\number\month.\number\day}
> 
> \begin{document}
> \begin{letter}{}
> 
>   \opening{}
> 
> \end{letter}
> \end{document}
> 
> 
> --
> 
>      Haines Brown
>  /"\
>  \ /  ASCII Ribbon Campaign
>   X    against HTML e-mail
>  / \
> 

-- 

     Haines Brown 
 /"\
 \ /  ASCII Ribbon Campaign
  X    against HTML e-mail 
 / \



More information about the texhax mailing list.