2

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?

2
  • 2
    Welcome to TeX.SE! The code snippet you showed can't produce that error because it defines \@removefromreset, with an @. Please show us the complete code which produces the error you mention. Commented Jan 3, 2019 at 13:11
  • It looks like somebody copied the remreset.sty code over to the class file.
    – user31729
    Commented Jan 3, 2019 at 15:04

2 Answers 2

2

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}%
}
3
  • I loaded remreset you've defined and erased the lines I've copied. It worked, thanks!!
    – user178777
    Commented Jan 3, 2019 at 19:14
  • @user178777: I have not defined remreset. remreset is obsolete and the macro is contained in the LaTeX kernel for almost one year by now....
    – user31729
    Commented Jan 3, 2019 at 19:30
  • Oh I got it. I comment out only removefromreset lines I've mentioned and so there is no problem.
    – user178777
    Commented Jan 3, 2019 at 20:36
0

If you have access to your .cls and can change things, remove or comment out the "new" definition of \@removefromreset. If you don't have access, then you can capture the original definition of \@removefromreset before you load the class and then restore it afterwards:

\makeatletter
\let\old@removefromreset\@removefromreset % Store \@removefromreset
\let\@removefromreset\relax
\makeatother

\documentclass{<your-class>} % Load your document class

\makeatletter
\let\@removefromreset\old@removefromreset % Restore \@removefromreset
\makeatother

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .