Skip to content

aliascnt will be broken in next kernel release #104

@projekter

Description

@projekter

The upcoming June release will change the way counters are handled in theorems. The ltnews43 explicitly reads

Theorem-like environments like lemmas and definitions often use the same counter for the numbering. This makes it difficult to create suitable prefixes when referencing. We have therefore added a new command \newcounteralias that allows to create an alias of a counter and so to use a counter under another name. The code is based on a similar command from the package aliascnt. The command \newtheorem in LATEX and also in amsthm has been changed to use \newcounteralias.

My understanding of this change is that aliascnt is no longer necessary at all, because the functionality will be provided out-of-the-box. Furthermore, the current prerelease versions (This is LuaHBTeX, Version 1.24.0 (MiKTeX 26.1) (format=lualatex-dev 2026.2.9) 10 FEB 2026 12:58) will error when using the standard aliascnt workflow:

\documentclass{article}

\usepackage{aliascnt,amsthm,hyperref}

\theoremstyle{definition}
\newtheorem{definition}{Definition}

\def\definitionautorefname{definition}
\def\axiomautorefname{axiom}
% old way:
\newaliascnt{axiom}{definition}
\newtheorem{axiom}[axiom]{Axiom} % ! LaTeX Error: Command \c@axiom already defined.
\aliascntresetthe{axiom}
% new way:
% \newtheorem{axiom}[definition]{Axiom}

\begin{document}
   \begin{definition}\label{def}
      Test
   \end{definition}
   \begin{axiom}\label{ax}
      Test
   \end{axiom}
   Go to \autoref{def} -- \autoref{ax}
\end{document}

hyperref is used just to check that indeed, the "old way" still works and produces the correct label. The error message is independent of hyperref. The simpler new way now also works as it should always have. I raise this issue here because eventually, aliascnt should deal with it, though since at the moment, it is a prerelease, one might perhaps also put the ball to firstaid?

How to deal with it? Provided the kernel is new enough, \aliascntresetthe should probably simply \@gobble. With \newaliascnt, it is more difficult. It should perhaps error and tell the user about this new feature to adapt the code. Maybe it could also look ahead and see whether it is directly (apart from spaces) followed by \newtheorem and then rewrite this macro (in this case only issuing a warning, which 99% of all users will ignore), assuming that the standard usage pattern is probably exactly this one, which comes directly from the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions