0

I am using my variation of the \fullref command from the question \nameref -- How to display section name AND its number, my one is called \typeref:

\documentclass[12pt,a4paper,english]{abntex2}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}

\usepackage[nameinlink]{cleveref}
\newcommand*{\typeref}[1]{\hyperref[{#1}]{\Cref{#1}}} % One single link
\newcommand*{\fullref}[1]{\hyperref[{#1}]{\Cref{#1}: \nameref{#1}}} % One single link

\begin{document}
\typeref{firstlabel}.

\typeref{secondlabel}.

\typeref{firstlabel,secondlabel}.

\cleardoublepage
\begin{figure}[h]
    \caption{Caption 1}
    \label{firstlabel}
    Figure 1
\end{figure}

\cleardoublepage
\begin{figure}[h]
    \caption{Caption 2}
    \label{secondlabel}
    Figure 2
\end{figure}
\end{document}

Which correctly generated the PDF file:

enter image description here

But when compiling this, hyperref keeps popping the warning every time I compile/recompile the PDF:

Redoing nameref's sectioning
Redoing nameref's label

LaTeX Warning: Hyper reference `firstlabel,secondlabel' on page 1 undefined on
input line 15.

[1{D:/User/Documents/latex/texmfs/data/pdftex/config/pdftex.map}] [2] [3]
[4] [5] (test3.aux)

LaTeX Warning: There were undefined references.

How can I make hyperref stop thinking there are undefined references?

user
  • 4,745

0 Answers0