[Tex/LaTex] Not displaying ‘Figure’ cross reference

captionscross-referencingfloatssubcaption

I'm using ShareLatex and I'm trying to add a cross reference of a figure, but the result of the \ref{fig:sampe} only displays the number of the image and does not follow the format 'Figure 1' for example. I've tried with figure and subfigures and the result is the same.

Currently I'm using the following packages:

\usepackage{caption}
\usepackage{subcaption}
\usepackage{cleveref}

And also added the following lines:

\captionsetup[subfigure]{subrefformat=simple,labelformat=simple}
\renewcommand\thesubfigure{(\alph{subfigure})}

Does anyone knows why is this happening?

I've already checked the following posts this and this.
Thanks in advance.

EDIT: I've added compilable code.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}

\usepackage{caption}
\usepackage{subcaption}

\usepackage[noabbrev,capitalize,nameinlink]{cleveref}
\captionsetup[subfigure]{subrefformat=simple,labelformat=simple}
\renewcommand{\figurename}{Figura}
\renewcommand\thesubfigure{(\alph{subfigure})}


\usepackage[
    backend=biber,
    sorting=none,
    urldate=edtf,
    date=edtf,
    seconds=true
]{biblatex}
\usepackage{url}
\usepackage{float}

\begin{document}

Some text, here it would have to appear the first reference \cref{fig:test1} , here it would have to appear the seconds reference \cref{fig:nav01_welcome}.

\begin{figure}[H] 
\begin{center}
\includegraphics[width=0.5\textwidth]{./images/navigation/nav01_welcome.png}
  \caption{Pantalla de bienvenida}
  \label{fig:test1}
\end{center}
\end{figure}  


\begin{figure}  
    \centering
    \begin{subfigure}[h]{0.48\textwidth}
        \centering
        \includegraphics[width=\textwidth]{./images/navigation/nav01_welcome.png}
        \caption{Arabic numerals}\label{fig:1a}     
        \label{fig:nav01_welcome}
    \end{subfigure}
    \quad
    \begin{subfigure}[h]{0.48\textwidth}
        \centering
        \includegraphics[width=\textwidth]{./images/navigation/nav02_welcome.png}
        \caption{Arabic numerals}\label{fig:1b}
    \end{subfigure}
    \caption{Capital Roman numerals}\label{fig:1}
\end{figure}

\end{document}

Best Answer

All is well if you load the cleveref package last -- and if you use \cref instead of \ref.

Two additional suggestions: Don't provide more than one \label per \caption. And, the three \centering instructions in the second figure environment may be eliminated if you replace \quad with \hfill.

enter image description here

\documentclass[demo,spanish]{article} % remove 'demo' option in real document
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx,babel,caption,subcaption}

\captionsetup[subfigure]{subrefformat=simple,labelformat=simple}
%\renewcommand{\figurename}{Figura}
\renewcommand\thesubfigure{(\alph{subfigure})}

% Load "cleveref" last:
\usepackage[noabbrev,capitalize,nameinlink]{cleveref}

\begin{document}

Here's the first cross-reference: \cref{fig:test}. 

Here's the second cross-reference: \cref{fig:2a}.

\begin{figure}[h]
\centering
   \includegraphics[width=0.5\textwidth]{./images/navigation/nav01_welcome.png}
   \caption{Pantalla de bienvenida}
   \label{fig:test}
\end{figure}  

\begin{figure}[h]
\begin{subfigure}{0.48\textwidth}
    \includegraphics[width=\textwidth]{./images/navigation/nav01_welcome.png}
    \caption{Arabic numerals}\label{fig:2a}     
\end{subfigure}%
\hfill
\begin{subfigure}{0.48\textwidth}
    \includegraphics[width=\textwidth]{./images/navigation/nav02_welcome.png}
    \caption{Arabic numerals}\label{fig:2b}
\end{subfigure}
\caption{Capital Roman numerals}\label{fig:2}
\end{figure}

\end{document}
Related Question