[Tex/LaTex] \ref does not work


I want to write a paper. There are three Chapters. In the first chapter, I got a Corollary and I labeled it as following:

Corollary 1 \label{cor:1}

In the second chapter, I want to cite the "Corollary 1", I input

Corollary  \ref {cor:1}.

After running pdflatex, it shows the following:

Corollary ??.

without the number "1"

How do I tackle this problem?

Best Answer

This is a MWE on using the \label inside a corollary environment, defined thanks to the amsthm package. Apparently, from the question no environment is used to define the corollary, thus explaining the undesired output of the \ref command.

    This is a corollary
Let's make a reference to corollary~\ref{the-corollary}.

enter image description here

Related Question