# Hyperlink to supplemental Figure S1 links to Figure 1. How to make a new set of links?

I have supplemental material, which should have its own set of figures, equations, etc. These can be numbered correctly by resetting the figure counter and adding "S" to the label. However, when I do this, the hyperlink to Figure S1 goes to Figure 1.

How can I fix this? A potential workaround would be to set the figure counter to 10 instead of 0 upon starting the supplemental material, then printing S(n-10), but I can't figure out how to do that. I'm using revtex but I'm not sure it makes a difference in this case.

MWE, in which the link to S1 points at Figure 1.

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

\begin{figure}\caption{Main figure}\label{fig:1}\end{figure}

Reference to Figure \ref{fig:1}.
\clearpage

\setcounter{figure}{0}
\renewcommand{\thefigure}{S\arabic{figure}}

\begin{figure}\caption{Supplemental figure}\label{fig:s1}\end{figure}

Reference to Figure \ref{fig:s1}.

\end{document}


If you change hyperref's command as well, the hyperlink to Figure S1 points to the right figure.

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

\begin{figure}\caption{Main figure}\label{fig:1}\end{figure}

Reference to Figure \ref{fig:1}.
\clearpage

\setcounter{figure}{0}
\renewcommand{\thefigure}{S\arabic{figure}}
\renewcommand{\theHfigure}{S\arabic{figure}}

\begin{figure}\caption{Supplemental figure}\label{fig:s1}\end{figure}

Reference to Figure \ref{fig:s1}.

\end{document}