3

I'm using the cleverref package. This is how I use it (and it works perfectly):

\begin{proposition}[Lalala]\label{lol}
Hahahah
\end{proposition}

It follows directly from \Cref{lol} 

I'm using the following codes in the preamble:

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{prop}[theorem]{Proposition}
\newtheorem{proposition}[theorem]{Proposition}

The enviroment \begin{prop} ... \end{prop} works perfectly too. But if I use \Cref{} with a proposition created with \begin{prop} it does not work. The document shows the symbol "???"

Can I fix this problem? I would like to define enviroments with the corresponding shortcuts like thm, prop, defi, etc.

3
  • 5
    Possible duplicate of Using cleveref with newenvironment May 18, 2016 at 7:39
  • 1
    Could you add an MWE (a compilable document showing your problem)?
    – ienissei
    May 18, 2016 at 8:12
  • @JérômeDequeker and other would-be voters for closure - This posting is not a duplicate, since it uses the basic \newtheorem mechanism rather than any kind of custom-designed mechanism.
    – Mico
    May 18, 2016 at 8:55

1 Answer 1

2

Since you have two environments (proposition and prop) that have the same name ("Proposition") and share a common counter, I will assume that they should also be cross-referenced (with cleveref's macros) using the same prefix label, say, "Proposition". This may be accomplished via an instruction such as

\crefalias{prop}{proposition}

A full MWE (minimum working example):

\documentclass{book}

\usepackage{amsthm} % if you prefer, use "ntheorem" instead of "amsthm"
\usepackage{cleveref}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{prop}[theorem]{Proposition}
\crefalias{prop}{proposition} % <-- new

\begin{document}
\setcounter{chapter}{1} % just for this example

\begin{proposition}[Hahaha]\label{hah}
Hahaha
\end{proposition}

\begin{prop}[Hohoho]\label{hoh}
Hohoho
\end{prop}

\noindent
It follows directly from \Cref{hoh,hah} that \dots
\end{document} 

This example produces

It follows directly from Propositions 1.1 and 1.2 that ...

(Observe that the arguments of \Cref need not be entered by ascending numerical value; cleveref takes care of the sorting by default.)

You must log in to answer this question.

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