I am looking to have a document Main.tex that references content in two sub-documents, Doc1.tex and Doc2.tex via \include{} and that can be configured to only compile to PDF the content in a particular one of those documents. Following the discussion in this answer to: Splitting(!) one latex document into two pdf outputs including references , I can get the basics working just fine. But, when I use the endfloat package the functionality falls apart. Below is a minimal working example. It works fine if I:
First compile
Main.texwith the\includeonly{}command commented out.Then re-compile
Main.texremoving the comment from\includeonly{}.
But, as soon as I remove the comment to load the endfloat package, I lose the ability to reference figures in Doc2.tex - instead, the references just appear as ?? in the compiled PDF.
Main.tex
\documentclass{article}
% \usepackage[notablist,nofiglist,nomarkers]{endfloat} %% places all figures and tables at the end.
% \includeonly{Doc1}
\begin{document}
\include{Doc1}
\include{Doc2}
\end{document}
Doc1.tex
As I show in Figure \ref{fig1} in Doc2 ...
Doc2.tex
\begin{figure}
\centering\rule{1cm}{1cm}
\caption{This is a figure}
\label{fig1}
\end{figure}
subfilesbe an alternative? see https://tex.stackexchange.com/a/378163/36296 – samcarter_is_at_topanswers.xyz Aug 08 '17 at 20:41