\cref and intertwined numbering of proposition, definition, lemma, etc

\cref and intertwined numbering of proposition, definition, lemma, etc

I used

\newtheorem{definition}{Definition}[section]
\newtheorem{proposition}[definition]{Proposition}

so that the numbering goes on as if proposition and definition are "the same object". But the problem is if I use \cref{...some proposition name...}, then the output is not "proposition 2.7", but "definition 2.7".

How can I fix this problem?

答案1

Here's an excerpt from p. 25 of the user guide of the cleveref package [yellow highlighting added]:

在此处输入图片描述

Assuming you use the amsthm package, the following code lets you achieve your cross-referencing objectives:

\documentclass{article} % or some other suitable document class
\usepackage{amsthm}
\usepackage{cleveref} 
% Place all \newtheorem declarations _after_ cleveref is loaded:
\newtheorem{definition}{Definition}[section]
\newtheorem{proposition}[definition]{Proposition}

\begin{document}
\setcounter{section}{2}  % just for this example
\begin{definition}\label{def:1} Hello. \end{definition}
\begin{proposition}\label{prop:1} World. \end{proposition}

\noindent    % Create some cross-references:
As \cref{def:1,prop:1} argue, \dots
\end{document}

相关内容