3

I usually create theorem environments in pairs - one uses the ordinary theorem style, the other (whose name starts with a capital letter) uses the "break" style, which inserts a line break before the theorem text. This is very useful for theorems with long texts or long names. cleveref seems to support this well, at least for references to individual theorems. However, \crefrange cannot see that the two theorems have the same type (see below).

I know there is a workaround using aliascnt; however, I would like to involve as few packages as possible for dealing with references, in order to keep things simple and avoid bugs. Also, using aliascnt is a slightly "ugly" solution that involves a lot of code if you use many different theorem types. Can someone provide me with a solution that does not involve aliascnt, but which (preferably) only uses ntheorem and cleveref?

\documentclass{article}

\usepackage{ntheorem,cleveref}

\newtheorem{thm}{Theorem}

\theoremstyle{break}
\newtheorem{Thm}[thm]{Theorem}

\crefname{thm}{theorem}{theorems}

\begin{document}

    \begin{thm}\label{thm:short}
        Theorem with short text.
    \end{thm}

    \begin{Thm}[The well-ordering theorem]\label{thm:long}
        Theorem with long text.
    \end{Thm}

    \cref{thm:short}

    \cref{thm:long}

    \crefrange{thm:short}{thm:long}
\end{document}

enter image description here

8

cleveref provides \crefalias

\crefalias{Thm}{thm}

MWE:

\documentclass{article}

\usepackage{ntheorem,cleveref}

\newtheorem{thm}{Theorem}

\theoremstyle{break}
\newtheorem{Thm}[thm]{Theorem}

\crefname{thm}{theorem}{theorems}
\crefalias{Thm}{thm}

\begin{document}

    \begin{thm}\label{thm:short}
        Theorem with short text.
    \end{thm}

    \begin{Thm}[The well-ordering theorem]\label{thm:long}
        Theorem with long text.
    \end{Thm}

    \cref{thm:short}

    \cref{thm:long}

    \crefrange{thm:short}{thm:long}
\end{document} 

Output

enter image description here

P.S. If you want the endash for conjuction, add the line

\newcommand{\crefrangeconjunction}{--}

in the preamble.

3
  • Bonus question: Why does hyperref break it? (Just inser hyperref between ntheorem and cleveref, where you are usually adviced to put it).
    – Gaussler
    Mar 2 '15 at 12:59
  • 2
    @Gaussler -- that's a really good question. if you haven't done so already, post it as a new question, with a link back to this one. Mar 2 '15 at 13:27
  • I have done so now: tex.stackexchange.com/questions/230951/…
    – Gaussler
    Mar 2 '15 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.