Main text and supplements in two documents
It’s easier to have the two documents separated with their own bibliography. Then no need to manually split the pdf (and likely lose links).
Using the xr
package, we can specify other documents where to find references (figures, tables, sections).
In the main.tex
document:
\usepackage{xr}
\externaldocument{suppmap}
And in the suppmat.tex
document:
\usepackage{xr}
\externaldocument{main}
On Overleaf, they use a variant where the suppmat.tex
is not compiled but its references can still be used in the main.tex
using:
\usepackage{xr}
\makeatletter
\newcommand*{\addFileDependency}[1]{% argument=file name and extension
\typeout{(#1)}
\@addtofilelist{#1}
\IfFileExists{#1}{}{\typeout{No file #1.}}
}
\makeatother
\newcommand*{\myexternaldocument}[1]{%
\externaldocument{#1}%
\addFileDependency{#1.tex}%
\addFileDependency{#1.aux}%
}
\myexternaldocument{SuppMat}
and a latermkrc
file with:
add_cus_dep( 'tex', 'aux', 0, 'makeexternaldocument' );
sub makeexternaldocument {
if (!($root_filename eq $_[0]))
{
system( "latexmk -cd -pdf \"$_[0]\"" );
}
}