I am working on a LaTeX document where I have a main document and supplementary information (SI). In the SI, I want to maintain the sequence "Figure S1, Figure S2..." for labeling the figures. In the main document, I want to reference these figures from the SI using the \ref{} command, but I'm encountering some issues.
Here's a simplified version of my setup:
main.tex:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\section{Main Document}
\begin{figure}[htbp]
\centering
\includegraphics[width=0.5\textwidth]{example-image-a}
\caption{Example A}
\label{fig:example_a}
\end{figure}
\begin{figure}[htbp]
\centering
\includegraphics[width=0.5\textwidth]{example-image-b}
\caption{Example B}
\label{fig:example_b}
\end{figure}
Text in the main document attempting to call the figures from the Supplementary Information: Figure \ref{fig:example_c} and Figure \ref{fig:example_d}.
\end{document}
support_information.tex:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\section{Supplementary Information}
\begin{figure}[htbp]
\centering
\includegraphics[width=0.5\textwidth]{example-image-c}
\caption{Example C}
\label{fig:example_c}
\end{figure}
\end{document}
It is crucial that the sequence in both documents be distinct: 'Figure 1', 'Figure 2',... for the main document and 'Figure S1', 'Figure S2',... for the Supplementary Information.