I'm having issues getting cleveref to recognize references when using revtex4-2. When compiling, all references give a warning "LaTeX Warning: cref reference format for label type `' undefined on input line ..." and fail to typeset correctly. I've seen cref reference format for label type `' undefined, as well as a number of issues regarding cleveref and appendix sections on this site, but my issue is seems unrelated because switching to revtex4-1 fixes the problem in my case. Here's a MWE
\documentclass[aip]{revtex4-1}
\usepackage{cleveref}
\begin{document}
\section{First section}
\label{sec:first}
Hello
\section{Second section}
Hello \cref{sec:first}
\end{document}
As expected, I have to run pdflatex twice to get the references right, but once I do everything renders correctly. However, if I replace the documentclass with revtex4-2
, then the contents of the "Second section" read "Hello ??". I'm running on Mac OS and I've updated all my packages using Tex Live Utility, so I don't think it's a versioning issue, but rather something in how revtex4-2
is redefining some internal TeX macros. Unfortunately I don't know enough to dig into the details there.
EDIT
One extra piece of information that may be useful to future viewers of this issue: adding the hyperref
option to the list of documentclass options does not resolve this issue. However, avoiding that option and instead explicitly writing \usepackage{hyperref}
(before \usepackage{cleveref}
) does resolve the problem.