About
Shop
LaTeX
Free Software
Books
News
Contact
Blog
News (2017-09-10): New application bib2gls for use with glossaries-extra.sty.

Bug Tracker

ID 13
Status Closed (fixed)
Category datetime
Version 2.58
Interpreter N/A
Summary name-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.

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". (Please ensure the address is valid.) Your details won't be passed on to third parties in line with this site's Privacy Policy.

Comments

If you would like to add a comment regarding this bug report, please fill in the form below, but don't use it for a different bug or feature request, even if it's related. Instead fill out a new bug report or feature request. (If you want to link it to this report, make a note of the ID number at the top of the page.)

Name (Optional)
Comment

You can use the following markup:

[pre]Displayed verbatim[/pre]
[tt]monospace font[/tt]
[url]web address[/url]

which will be converted to:

<pre>Displayed verbatim</pre>
<tt>monospace font</tt>
<a href="web address">
web address</a>

I'm sorry, some spammers have cracked the captcha and genuine comments were being hidden in the midst of spam, so I've replaced the captcha with this test: Please enter the ID number of this report in the confirm ID box below.

Confirm ID: (The number at the top of this page.)

Return to Search Results


The free software provided here (including my class files and packages on CTAN) are funded by my book sales. While I'm keen to remove bugs from my code, book production has to take priority over bug fixes, so please don't expect a rapid response.

Version numbers that end with "b" indicate a beta (prototype) release. Version numbers that end with "a" indicate an alpha (unstable) release.

© 2012 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 Site Map FAQs