Bug Tracker RSS feed

I’m currently working on a major new version of the datatool package. This may take a while. Please be patient. (Experimental version available for testing.)

ID 13🔗
Date: 2013-01-07 20:16:28
Status Closed (Fixed)
Category datetime
Version 2.58
Summary name-clash (\ifleapyear / \@modulo) with macros of packages datetime and datenumber

Sign in to subscribe to notifications about this report.

Description

\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

Download (114B)

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

Comments

0 comments.


Add Comment

Name (optional):

Are you human? Please confirm the bug report ID (which can be found at the top of this page) or login if you have an account.

Comment:


You can use the following markup:

Block:

[pre]Displayed verbatim[/pre]
[quote]block quote[/quote]

In line:

[tt]code[/tt]
[file]file/package/class name[/file]
[em]emphasized text[/em]
[b]bold text[/b]
[url]web address[/url] [sup]superscript[/sup]
[sub]subscript[/sub]

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

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

You can use the Preview button to review your message formatting before submitting.

Page permalink: https://www.dickimaw-books.com/bugtracker.php?key=13