Introduction
I'm using a somewhat complex theorem-environment setup which, perhaps, is finally getting me into trouble. I use memoir
, cleveref
and ntheorem
. There is a global thmcounter
that all theorem-like environments share. In addition, all theorem-types have a counterpart for entries related to the main case study (which have a subtly different style). And therein lies my problem.
Problem
I want to convince cleveref
that normal Definitions (Theorems, Lemmas, ...) and case study Definitions (Theorems, Lemmas, ...) are really the same thing. But I don't know how.
One of the ways this manifests itself is cleveref
's cross-reference compression and sorting. It can say "Definitions 1 and 2" rather than "Definition 1 and Definition 2". But only when they have the same type.
Minimal Working Example
Here's a MWE. Some of the packages below may not be involved, but I thought I'd err on the side of completeness. In my real code I have macros to automate most of this, but that shouldn't affect anything.
\documentclass{memoir}
\usepackage {amsmath} %| 1 (keep in this order)
\usepackage [ntheorem] {empheq} %| 2
\usepackage [amsmath,thmmarks] {ntheorem} %| 3
\usepackage {hyperref} %| 4
\usepackage [capitalize,noabbrev] {cleveref} %| 5
\newtheorem{thmcounter}{}[chapter]
\newtheorem {Definition}[thmcounter]{Definition}
\newtheorem{CaseStudyDefinition}[thmcounter]{Definition}
\crefname {Definition}{Definition}{Definitions}
\Crefname {Definition}{Definition}{Definitions}
\crefname{CaseStudyDefinition}{Definition}{Definitions}
\Crefname{CaseStudyDefinition}{Definition}{Definitions}
% same for Theorem, Lemma, Axiom, etc.
\begin{document}
\begin{Definition}[A] \label{def:A} Foo \end{Definition}
\begin{Definition}[B] \label{def:B} Bar \end{Definition}
\begin{CaseStudyDefinition}[C] \label{def:C} FooBar \end{CaseStudyDefinition}
Look at \cref{def:A,def:B}!
Now look at \cref{def:A,def:C}!
\end{document}
As you can see, it doesn't do the right thing by default, which is understandable.
Things I tried
I tried using \crefalias{CaseStudyDefinition}{Definition}
, but that seems to do nothing. I also tried using the aliascnt
package, but that works on counters, of which I use only one. So no luck.
cleveref
modifies the \label
command so an author can supply an optional argument specifying a different theorem-type. And strangely... that works. If I do this:
\begin{CaseStudyDefinition}[C] \label[Definition]{def:C} FooBar \end{CaseStudyDefinition}
then the second sentence is compressed just like the first. But that solution requires a manual fix for every use. I tried several ways of 'implicitly' supplying the optional argument. I tried redefining \label
, for instance, but without success. I'm not sure where to insert my own hack.
I'd appreciate some assistance.