I use listings and hyperref for a project where I want to skip line numbers on some listings. I'm using a \Suppressnumber-command a \Reactivatenumber-command (from Listings: Skip line number on current line). However, the \Suppressnumber-command produces the following error
pdfTeX warning (ext4): destination with the same identifier (name{lstnumber.-1.\\thelstnumber\040}) has been already used, duplicate ignored
It also produces this warning for all subsequent listings including input and inline listings. For my project it means 60000 lines (out of 63000) in the log. What can I do to fix it?
MWE
\documentclass{article}
\usepackage{listings}
\lstset{language=[Sharp]C,escapeinside={(*@}{@*)}}
\let\origthelstnumber\thelstnumber
\makeatletter
\newcommand*\Suppressnumber{%
\lst@AddToHook{OnNewLine}{%
\let\thelstnumber\relax%
\advance\c@lstnumber-\@ne\relax%
}%
}
\makeatother
\usepackage{hyperref}
\begin{document}
\begin{lstlisting}
public void Main(){
(*@ \Suppressnumber @*)
int i = 0;
}
\end{lstlisting}
\end{document}
destination with the same identifier-warning which just accumulates and produce an insane amount of log. – Zinoex May 20 '17 at 10:36