# \Cref not working

\documentclass[Afour,sageh,times]{sagej}

\usepackage[english]{babel}
\usepackage{cleveref}

\begin{document}

\section{Introduction}
\label{sec:Introduction}

\Cref{sec:discussion}

\section{Discussion}
\label{sec:discussion}

\end{document}


The above minimal example doesn't work as when I use \Cref, it doesn't work and prints only ??. Can anybody please help me out with this error.

Thanks.

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Have you tried compiling a second and third time? – Seamus May 24 '16 at 17:00
• And you remembered to compile at least twice? – daleif May 24 '16 at 17:01
• Compiled like 10 times but still din't work. – gokussj9 May 24 '16 at 17:02
• Does it work with \documentclass{article}? I do not have sagej, can you give a link? – samcarter_is_at_topanswers.xyz May 24 '16 at 17:04
• – gokussj9 May 24 '16 at 17:09

The sagej document class sets \setcounter{secnumdepth}{-2}. This means that absolutely no sectioning headers are numbered anywhere in the document. Therefore, both \section{Introduction} and \section{Discussion} produce unnumbered sectioning headers.
LaTeX's cross-referencing mechanism works by associating each \label instruction with the most recently incremented counter variable. Since your MWE contains no counters that are incrementef, \Cref cannot possibly generate a valid cross-reference. That's why you get ??.
If you want numbered section-level headers, set \setcounter{secnumdepth}{1} somewhere in your preamble. Do be aware, though, that this change quite likely defeats the design choices of the sagej document class and, as such, may not be viewed favorably by editors.
• Incidentally, the issue is not confined to the macros of the cleveref package. Do verify for yourself that \ref doesn't work either in your MWE. – Mico May 24 '16 at 17:25