I was asked how to implement a \tomorrow
macro in TeX/LaTeX. While I could come up with a reasonably good solution, working for one document class, I don't see how that could be achieved in a document class agnostic way.
I found advdate, but even though the date arithmetic may be of use, it assumes a specific format for the date (which also is wrong for the locale I reside in).
Does anyone have a reasonably portable solution? Is this even possible?
Best Answer
Here is a prototype in LaTeX3; the data about tomorrow is available in the integer variables
The code follows; the final macro is just an example of how the data can be used, possibly in connection with
datetime
.As you see, leap years are correctly recognized. Only Gregorian calendar, of course.
In order to define a suitable
\tomorrow
command, you can add (before\ExplSyntaxOn
) ababel
versionor a
datetime
version (requires packagedatetime
, of course)This is, of course, overkill if one wants only tomorrow's date. The macros actually allow to compute any date from a given one, given the interval (positive or negative). One might make expandable also the "reverse" from a Julian date to the form "Day/Month/Year", but it would be very slow.