redefine date format in letter environment

Lars Madsen daleif at math.au.dk
Wed Dec 7 15:49:45 CET 2022


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?



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
 / \

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20221207/6751cae2/attachment.html>


More information about the texhax mailing list.