In LaTeX, it is common to use \ref{} to refer to specific figures which have been labelled using \label{}. For example:
This referencing will work so long as the compiled file (for example main.tex) also compiles the file which contains the label. This is important for using \input, which is used for separating latex documents into organized files. In the example below, I have put the figure definition into sub_file.tex to simplify main.tex. Since sub_file.tex is included when main.tex is compiled, the reference to fig:frog still functions.
Suppose we had a supporting information document along side our main document. Maybe we had some chart we didn't want to include in the main paper, but still want to include for completeness. In this section, I also redefine a few LaTeX variables so my pages, sections, tables, and figure indicies have the format S1 and S2, instead of 1 and 2.
If I try to reference this figure, in main.tex I get an error saying that si:fig:frog_chart is an undefined label. This is because SI.tex is not compiled when main.tex is compiled. If we want to reference si:fig:frog_chart in main.tex, we will need to target an external reference using the xr package, and set up a script which will compile that external reference when we compile our main document.
The xr package has been added. I have also specified that the external document we will be using labels from is SI.tex, as well. Now we need a way to compile the SI.tex document, and provide the compiled labels to main.tex. This is done with a perl script written in a special latexmkrc file. This file is run whenever you compile anything in LaTeX. The script below will compile the external document and every sub-external document, allowing for the compiled labels to be accessed by main.tex inside the external documents' *.aux files. Those details are not important, just add this file to your LaTeX directory.
Now if I compile main.tex, I will have the proper reference to the SI's figures, with the customized formatting we defined within SI.tex.
This shows that we are successfully able to automatically refer to figures in the Supporting Information, or any other external LaTeX document.
If your Supporting Information section has references, and those references come from the same .bib file, you will get errors saying that some references are "multiply defined". This is because references are created once when main.tex is compiled, and again when SI.tex is compiled. This error can be safely ignored, assuming you've double checked that you don't actually have two of the same reference in your citations.bib file.