Latest news 2019-11-04: The giveaway of two signed copies of “Quack, quack, quack. Give my hat back!” has closed and the winning entrants have been selected. Thank you to everyone who took part.

Bug Tracker

ID13
StatusClosed (Fixed)
Categorydatetime
Version2.58
Summaryname-clash (\ifleapyear / \@modulo) with macros of packages datetime and datenumber

Report

\documentclass{minimal}
\usepackage{datenumber,datetime}
\setstartyear{1991}
\begin{document}
\end{document}
Hello, the minimal exmple above delivers a bunch of errors:
| ! You can't use `the character 8' after \advance.
| <inserted text> 8
|                  038
| l.3 \setstartyear{1991}
|                        
| ? 
| 
| ! LaTeX Error: Missing \begin{document}.
| 
| See the LaTeX manual or LaTeX Companion for explanation.
| Type  H <return>  for immediate help.
|  ...                                              
|                                                   
| l.3 \setstartyear{1991}
|                        
| ? 
| Missing character: There is no 0 in font nullfont!
| Missing character: There is no 3 in font nullfont!
| Missing character: There is no 8 in font nullfont!
| Missing character: There is no b in font nullfont!
| Missing character: There is no y in font nullfont!
| Missing character: There is no - in font nullfont!
| ! Missing number, treated as zero.
| <to be read again> 
|                     \global 
|  l.3 \setstartyear{1991}
|                         
|  ? 
According to the log-file
Package: datenumber 2001/08/06v0.02
and
Package: datetime 2010/09/21 v2.58 Date Time Package
were in use.

Within the package datenumber everything is defined in terms of \def .

Thus within the example below - right before calling the package datenumber - I locally redefined \def to also \show the meaning of the command in question before defining it:

\documentclass{minimal}
\usepackage{datetime}
\begingroup
\let\olddef=\def
\def\def#1{\show#1\olddef#1}%
\usepackage{datenumber}
\endgroup
\begin{document}
\end{document}

This way I found out that there are name-clashes with names of the packages datenumber and datetime.

E.g., the control-sequences \ifleapyear and \@modulo were alredy defined by datetime and the package datenumber silently overrode them.

In package datenumber \ifleapyear (and \ifvaliddate) seems to be a macro. Macro-names should not begin with \if... in order to avoid confusion with real \if..-condition-switches defined in terms of \newif.

I suggest either of the packages to stick to its own namespace and to use \newcommand instead of \def in order to avoid such things.

Namespace "XY" could, e.g., be implemented like this:

\newcommand\XYname{}%
\long\def\XYname#1#{\romannumeral\XYinnername{#1}}%
\newcommand\XYinnername[2]{%
  \expandafter\XYexchange\expandafter{\csname XY#2\endcsname}{0 #1}%
}%
\newcommand\XYexchange[2]{#2#1}%
\newcommand\XY{XY}
[...]
% defining macros within the namespace:
\XYname\newcommand*{mymacro}[2]{definition-text}
\XYname\global\long\def{myothermacro}#1#2{definition-text}
% calling macros from within the namespace:
\XYname{mymacro}{Arg1}{Arg2}
\XYname{myothermacro}{Arg1}{Arg2}
\csname\XY mymacro\endcsname{Arg1}{Arg2}
\csname\XY myothermacro\endcsname{Arg1}{Arg2}
\XYmymacro{Arg1}{Arg2}
\XYmyothermacro{Arg1}{Arg2}
\csname XYmymacro\endcsname{Arg1}{Arg2}
\csname XYmyothermacro\endcsname{Arg1}{Arg2}

Sincerely

Ulrich

MWE

\documentclass{minimal}
\usepackage{datenumber,datetime}
\setstartyear{1991}
\begin{document}
\end{document}

Evaluation

datetime v2.59 now defines \ifDTleapyear. To ensure backward-compatibility, if \ifleapyear hasn't been defined, it's defined to be \ifDTleapyear. The \@modulo command is defined in fmtcount rather than datetime. This will be fixed in future versions of fmtcount. To cover the overlap between releases of the datetime and fmtcount, datetime uses \@FCmodulo instead of \@modulo, but there's a check to see if \@FCmodulo has been defined after loading fmtcount. If it hasn't then \@FCmodulo is set to \@modulo.

There's nothing I can do about datenumber's use of \def. You'll have to raise the issue with datenumber's maintainer. LaTeX3 should hopefully solve the problem of namespaces.

Add comment.

Watch This Report

If you would like to be notified whenever updates are made to this report, please fill in your email address in the box below and click on "Notify Me of Changes" button. (Please ensure the address is valid.) Your details won't be passed on to third parties in line with this site's Privacy Policy.

If you supply your name, it will be used in the email greeting, which provides a more personal message, otherwise you'll just get a generic greeting. If you have previously supplied your name when signing up for notifications, you don't need to resupply it unless you want to change it.

If you have previously subscribed to notifications for this report, you can unsubscribe by clicking on the "Stop Notification" button.

The "Confirm Bug ID" field helps to protect against spambots. Please enter the bug ID (which you can find at the top of this page).

(Optional.)
E mail:
Confirm E mail:
Confirm Bug ID:

To unsubscribe from all notifications use the notifications page.

Comment

You can append a comment to the report using the form below. Comments are checked first before being added. Any spam or offensive content will be removed first according to this site's Terms of Website Use. Please bear in mind that I develop and maintain free software in my spare time. If you want commerical level support then you can hire a TeX consultant.

The "Confirm Bug ID" field helps to protect against spambots. Please enter the bug ID (which you can find at the top of this page).

(Optional. If provided, it will be shown with the comment.)
Confirm Bug ID:

You can use the following markup:

[pre]Displayed verbatim[/pre]
[tt]monospace text[/tt]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url]

Ordered list:
[ol]
[li]first item[/li]
[li]second item[/li]
[/ol]

Unordered list:
[ul]
[li]first item[/li]
[li]second item[/li]
[/ul]

Click on the Preview button to preview the message.

Return to list.

© 2019 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs