# Figures referencing problem

I am having a problem with referencing figure with elsevier template when I reference an image I got only the number but not figure 1 for example . Here is the code :

\documentclass[review]{elsarticle}
\DeclareGraphicsExtensions{.pdf,.gif,.jpg}
\usepackage{lineno,hyperref}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath, nccmath}
\usepackage{caption}
\usepackage{lscape}
\usepackage{natbib}
\usepackage{subcaption}
\usepackage{framed} % Framing content
\usepackage{nomencl} % Nomenclature package
\makenomenclature
\setlength{\nomitemsep}{-\parskip} % Baseline skip between items
\modulolinenumbers[5]

\bibliographystyle{elsarticle-num}

\begin{document}
c
c
the \ref{fig:example} blabla
c
c
\begin{figure}[!ht]
\includegraphics[scale=0.21]{name of the figure}
\caption{the name of the figure}
\label{fig:example}
\end{figure}
\end{document}


I got only the 1 blabla

Normally I should get the figure 1 blabla

• Your example is not compilable since the image file is not available, but usually 1 is the correct output. If you want figure 1, use cleveref and \cref. And hyperref should be loaded at the end of the preamble, not right at its start – user31729 Oct 14 '17 at 21:23
• Please take into account that this article might be rejected with figure 1 if being submitted to Elsevier – user31729 Oct 14 '17 at 21:30
• Adding .gif to the list of possible extensions doesn't make GIF files suitable for insertion, as pdftex doesn't support them. – egreg Oct 14 '17 at 21:33
• Off-topic: Instead of using \includegraphics with the scale=... option, it's usually more straightforward to employ the optionwidth=0.8\textwidth (or some other, suitable fraction of \textwidth). – Mico Oct 14 '17 at 21:53

By default, the output of \ref does not yield figure for a figure counter label. This can be improved with cleveref and \cref or a redefinition of \p@figure, for example.

The solutions below show each usage independently:

\documentclass[review,demo]{elsarticle}
\DeclareGraphicsExtensions{.pdf,.jpg}
\usepackage{lineno}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath, nccmath}
\usepackage{caption}
\usepackage{lscape}
\usepackage{natbib}
\usepackage{subcaption}
\usepackage{framed} % Framing content
\usepackage{nomencl} % Nomenclature package

\usepackage{hyperref}

\makenomenclature
\setlength{\nomitemsep}{-\parskip} % Baseline skip between items
\modulolinenumbers[5]

\bibliographystyle{elsarticle-num}

\begin{document}
the \ref{fig:example} or \cref{fig:example} blabla
\begin{figure}[!ht]
\includegraphics[scale=0.21]{name of the figure}
\caption{the name of the figure}
\label{fig:example}
\end{figure}
\end{document}


Solution with \p@figure being changed:

\documentclass[review,demo]{elsarticle}
\DeclareGraphicsExtensions{.pdf,.jpg}
\usepackage{lineno}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath, nccmath}
\usepackage{caption}
\usepackage{lscape}
\usepackage{natbib}
\usepackage{subcaption}
\usepackage{framed} % Framing content
\usepackage{nomencl} % Nomenclature package

\usepackage{hyperref}

\makeatletter
\renewcommand{\p@figure}{\lowercase{\figurename}\ }
\makeatother

\makenomenclature
\setlength{\nomitemsep}{-\parskip} % Baseline skip between items
\modulolinenumbers[5]

\bibliographystyle{elsarticle-num}

\begin{document}
the \ref{fig:example} blabla
\begin{figure}[!ht]
\includegraphics[scale=0.21]{name of the figure}
\caption{the name of the figure}
\label{fig:example}
\end{figure}
\end{document}

• I suggest using cleveref as being the cleaner solution – user31729 Oct 14 '17 at 21:38
• Thanks it works now I have seen some elsevier papers they use fig.1 not figure 1 how can I change it to fig.1 – twimo Oct 14 '17 at 21:55
• @twimo: Remove the noabbrev option from the loading of cleveref. \cref will show fig. then and \Cref will provide Fig. – user31729 Oct 14 '17 at 21:57
• Thanks a lot christian you are a saver and one last thing why will they reject a paper for using figure 1 ? – twimo Oct 14 '17 at 22:03
• @twimo: If my solution fits your needs, consider to accept it please – user31729 Oct 14 '17 at 22:06