0

I really like this question/answer ("patched theorem defintion" in the minimal example) and I wanted to adapt it to my custom dissertation class file. However, I ran into some problems with the package IEEEtrantools, which I "need" to typeset some math.

Originally, the definition of my theorems was placed inside the \AtEndPreamble hook, although I don't remember why, it worked together with IEEEtrantools. But if the above Q/A is applied inside the hook, the patch has no effect. If I put it outside the hook, IEEEtrantools causes errors.

I could try to avoid IEEEtrantools, but I prefer not to. So can you identify what is causing the problem and may offer a solution?

Thank you in advance!

MWE

\documentclass{scrbook}

\usepackage{etoolbox} \usepackage{xpatch} %\RequirePackage{IEEEtrantools} % <==== breaks patched theorem defintion

%% patched theorem defintion ============== \usepackage{thmtools} \usepackage{thm-restate}

\makeatletter \xpatchcmd{\thmt@restatable}% Edit \thmt@restatable {\csname #2@xa\endcsname\ifx@nx#1@nx\else[{#1}]\fi}% Replace this code {\ifthmt@thisistheone\csname #2@xa\endcsname\ifx@nx#1@nx\else[{#1}]\fi\else\csname #2@xa\endcsname\fi}% with this code {}{} % execute code for success/failure instances \makeatother %% ========================================

\AtEndPreamble{
\usepackage{hyperref} \usepackage[sort&compress]{cleveref}

% &lt;=== theorem definition could be moved here and originally was here, but then the patch does not work.

}

\newtheorem{thm}{Theorem}

\begin{document}

\section{Introduction}

\begin{restatable}[\S\ref{SectionNumber}]{thm}{TheoremName} theorem contents \end{restatable}

\section{Some Section} \label{SectionNumber}

\TheoremName*

\end{document}

Simon Dispa
  • 39,141

1 Answers1

1

There is a problem between cleveref and subequations from some time. See the comments of @Toby Cubitt done in

https://tex.stackexchange.com/a/375140/161015

While cleveref code was modified to use its own version of \@addtoreset it seem that still fails when IEEEtrantools is loaded.

A patch might skip the compilation error, for example by making IEEEsubequation slave to equation instead of subequation ( in \cref@addtoreset{IEEEsubequation}{subequation}) but I think it is best to wait for better fix from the developer.

Simon Dispa
  • 39,141