[Tex/LaTex] package autonum needs the obsolete etex package

autonume-tex

With an up to date TL 2015, the following minimal example:

% \RequirePackage{etex}
\documentclass{article}

\usepackage{l3keys2e}
\usepackage{titlesec}
\usepackage{adjustbox}
\usepackage{footmisc}
\usepackage{booktabs}
\usepackage{mathtools}
\usepackage{microtype}
\usepackage{enumitem}
\usepackage{bookmark}
\usepackage{glossaries}
\usepackage{autonum}

\begin{document}
\end{document}

is non working:

Package etex Warning: Extended allocation already in use.
(etex)                etex.sty code will not be used.
(etex)                To force etex package to load, add
(etex)                \RequirePackage{etex}
(etex)                at the start of the document.

)
! Undefined control sequence.
l.905 \globcount
                \ettl@for@nested
? 
! Undefined control sequence.
l.905 \globcount\ettl@for@nested

?

because of the autonum package. But, it becomes working as soon as:

  • either one of the packages before autonum is removed (not relevant in my case: I need these packages),
  • or autonum is loaded before the other packages (not relevant in my case: I also need the cleveref package which is required to be loaded as the last one, with two exceptions: hypdvips and… autonum),
  • or the etex package is loaded, as suggested in the above warning (but this package is nowadays considered as obsolete).

Do you understand what's going on? Is it safe to use etex though it is obsolete?

Best Answer

The autonum package loads etextools, a package I don't recommend using and that has been declared “dead” by its author, as far as I remember.

For strange reasons, after loading etex, the package has a declaration \globcount\ettl@for@nested which could have been \newcount from the beginning.

Workaround: define \globcount to be \newcount before loading autonum.

\documentclass{article}

\usepackage{l3keys2e}
\usepackage{titlesec}
\usepackage{adjustbox}
\usepackage{footmisc}
\usepackage{booktabs}
\usepackage{mathtools}
\usepackage{microtype}
\usepackage{enumitem}
\usepackage{bookmark}
\usepackage{glossaries}

%\expandafter\def\csname ver@etex.sty\endcsname{3000/12/31}
\let\globcount\newcount
\usepackage{autonum}

\begin{document}
\end{document}

Uncomment the line starting with % if you also want to get rid of the warning about etex.

Related Question