The following LaTeX document is saved in a file whose path is ~/test.tex
.
\documentclass{article}
\usepackage{amsthm}
\newtheorem{definition}{Definition}
\newtheorem{theorem}[definition]{Theorem}
\usepackage{cleveref}
\begin{document}
\begin{definition}\label{d}
This is a definition.
\end{definition}
\begin{theorem}\label{t}
This is a theorem.
\end{theorem}
Here is a reference to~\cref{t}.
\end{document}
When the following commands are executed at the terminal:
> cd ~
> pdflatex test
> pdflatex test
a PDF file is generated at the path ~/test.pdf
. When opened in a PDF viewer, the file displays as follows:
Notice that the reference to the theorem is displayed as a reference to a definition.
How can I get \cref
to distinguish between the theorem and the definition, while maintaining a continuous, unified numbering schema for theorems definitions?
cleveref
package before the\newtheorem
directives are executed.