0

For each \autoref that I use on my code to reference images, I get the following error:

Package hyperref
Warning: No autoref name for `{1}{3}' on input line 3

The name varies for each image: {2}{4} and {4}{6}. In the text, instead of showing the reference for the image (e.g. Figure 1) it shows this name formatted (13, 24 and 46).

This is my code structure:

\usepackage{hyperref}
Lorem ipsum \autoref{fig:test}.

\begin{figure}[h]
    \centering
    \includegraphics[width=0.5\textwidth]{test.png}
    \caption{My caption with citation: Test \textit{et al.} (2019) \cite{TEST}}
    \label{fig:test}
\end{figure}

Which outputs: Output of the code

I am using Overleaf. Any suggestions?

3
  • 2
    Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. See minimal working example with bibliography (MWEB).
    – dexteritas
    Dec 10, 2021 at 13:59
  • 1
    Since your code works fine inserted into the simplest of example documents, you should provide a full but minimal example that others can test as is. Presumably there are packages or settings you are not informing us about.
    – daleif
    Dec 10, 2021 at 14:15
  • 1
    It is also possible that there is an error earlier in the document that you ignore (if there is an error then there is a red rectangle with a number in it next to the 'Recompile' button on Overleaf). Errors at some point in the document can cause strange behavior in further parts, and when that earlier error is solved also this problem may go away.
    – Marijn
    Dec 10, 2021 at 14:19

1 Answer 1

1

This works fine for me, except that \cite{TEST} was undefined.

\documentclass{article}
\usepackage{graphicx}
\usepackage{hyperref}
\begin{document}

Lorem ipsum \autoref{fig:test}.

\begin{figure}[h]
    \centering
    \includegraphics[width=0.5\textwidth]{example-image}
    \caption{My caption with citation: Test \textit{et al.} (2019) \protect\cite{TEST}}
    \label{fig:test}
\end{figure}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .