I'm using the tikzscale package to scale my TikZ and PGFPlots graphics. This packages uses several iterations to get the desired dimensions. If I'm activating the externalization and use a label to be able to reference a plot, this results in a warning of multiply-defined labels.
How can I get rid of those warnings?
Use the following minimal not working example
\documentclass{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{tikzscale}
\usepackage{pgfplots}
\usepgfplotslibrary{external}
\tikzexternalize%
\newcommand{\plotref}[1]{\tikzexternaldisable\ref{#1}\tikzexternalenable}
\begin{document}
\begin{figure}[tbp]
\centering
\includegraphics[width=0.5\linewidth]{mnwe.tikz}
\caption{Test figure with reference~(\protect\plotref{leg:test}).}
\label{fig:test}
\end{figure}
\end{document}
and the figure file mnwe.tikz
\begin{tikzpicture}
\begin{axis}
\addplot[
domain = -pi:pi,
samples = 100,
]{sin(deg(x))};
\label{leg:test}
\end{axis}
\end{tikzpicture}
See this question for the protected plotref command.
\pageref. This is imho a bug. – Ulrike Fischer Nov 10 '15 at 10:57