4
\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.

4

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 ??.

enter image description here

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.

| improve this answer | |
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.