When I attempt to reference an equation using \cref{..}
while also using the package amsmath the references appear as ??
in the outputted pdf. For example
\documentclass[]{article}
\usepackage{graphicx}
\usepackage{cleveref} %for cref
\usepackage{amsmath} %for sub equation numbers and words within equations (\text)
\begin{document}
\section{Introduction}
\begin{equation}\label{eq:solve}
x^2 - 5 x + 6 = 0
\end{equation}
Ref: \ref{eq:solve}
CRef: \cref{eq:solve}
\end{document}
I get the output:
However if the \usepackage{amsmath}
is commented out the \cref
works correctly.
Is it possible to use both together successfully?
Best Answer
I tried to look for other questions with the same problem and found none. So here's an answer: load
cleveref
last.From the documentation:
The problem is that
amsmath
modifies the referencing system, in order to cope with\tag
, for instance. Socleveref
has to hook into the redefined macros, rather than the original ones. By loadingamsmath
aftercleveref
you don't give the package the chance to knowamsmath
is also requested.