[Tex/LaTex] ! LaTeX Error: Command \removefromreset already defined

errorsmacros

There are ready files for preparing Latex document. I used .cls template file and it has below code:

\newcommand{\@removefromreset}[2]{{%
  \expandafter\let\csname c@#1\endcsname\@removefromreset
  \def\@elt##1{%
    \expandafter\ifx\csname c@##1\endcsname\@removefromreset
    \else
      \noexpand\@elt{##1}%
    \fi}%
  \expandafter\xdef\csname cl@#2\endcsname{%
    \csname cl@#2\endcsname}}}

However, when I run my .tex file, an error occurs "! LaTeX Error: Command \removefromreset already defined"

Could you please help?

Best Answer

Since the LaTeX release from 2018/04/01 the \@removefromreset command is part of the LaTeX kernel.

The code by D. Carlisle was in remreset.sty (its author is D. Carlisle) and has been incorporated into the kernel. With any newer LaTeX version since 2018/04/01 there must be a conflict with a copied over code from remreset.sty. remreset is now declared obsolete.

The only way to remove the error is to remove the \newcommand{\@removefromreset}... from the class file.

The loading of remreset is also discouraged: (From remreset.sty):

%... header omitted here

% \LoadClass{book}
% \@removefromreset{footnote}{chapter}

% 2018: package obsoleted as the command is defined in the LaTeX format.

\@ifundefined{@removefromreset}{%
\def\@removefromreset#1#2{{%
  \expandafter\let\csname c@#1\endcsname\@removefromreset
  \def\@elt##1{%
    \expandafter\ifx\csname c@##1\endcsname\@removefromreset
    \else
      \noexpand\@elt{##1}%
    \fi}%
  \expandafter\xdef\csname cl@#2\endcsname{%
    \csname cl@#2\endcsname}}}%
}{%
\PackageWarningNoLine{remreset}
    {The remreset package is obsolete:\MessageBreak
     \noexpand\@removefomresset is defined}%
}