[Tex/LaTex] Problem using \includeonly

compilingcross-referencingexternal filesincludesubfiles

I have a problem using the \includeonly command. I have a large document and I wanted to split it up into sections- each section would be in its own file and I would compile only the current chapter that I am working on. The ideal case (please suggest if you know how to do this) would be to have the full document appear in the produced PDF, but only the current section's contents be updated as I do the compilations (such that it does not take a long time to compile everything). Anyhow, I have the following document structure:

\documentclass[twocolumn]{article}

\usepackage{newclude}

\includeonly{11_bayesiandecisionmaking}

\begin{document}

\include*{01_introduction}
\include*{02_probability1}
\include*{03_probability2}
\include*{04_statistics}
\include*{05_RS_FOSM}

\include*{11_bayesiandecisionmaking}

\end{document}

I was promised that using \include the references to equations in other files that are not cited in \includeonly (e.g. 02_probability1) would be maintained so I should not get the (??) missing reference symbols. However, this is what is happening to me right now – only 11_bayesiandecisionmaking contents appear in the compiled PDF and all references to other files that are not "included" are missing (I get (??)). Do you know how to fix this? Even better, do you know how to include all of the chapters in the final PDF but only compile selectively, e.g. only 11_bayesiandecisionmaking? Thanks for helping!

Best Answer

The first run must see all included files to get the aux files of each included one:

\documentclass[twocolumn]{article}
%\includeonly{11_bayesiandecisionmaking}
\begin{document}

\include{01_introduction}
\include{02_probability1}
\include{03_probability2}
\include{04_statistics}
\include{05_RS_FOSM}

\include{11_bayesiandecisionmaking}

\end{document}

Now you can enable the \includeonly. Then it can load all existing aux files.