4

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!

  • 1
    In order to get the references right, you have to compile the document twice with all \include enabled, i.e. comment out \includeonly, compile twice and then start to use \includeonly again. – user31729 Nov 29 '15 at 11:54
  • 1
    why newinclude ? But anyway you need to process the full document first so that latex knows all the cross references, then you can use includeonly on later runs to skip chapters, using the saved information from earlier runs – David Carlisle Nov 29 '15 at 11:55
  • @DavidCarlisle newclude in order to not have page breaks between sections. – space_voyager Nov 29 '15 at 11:56
  • 1
    The suggestion does not work. After compiling twice with includeonly commented out, the references stay (i.e. no ??) for the first compilation after putting back includeonly, but after the second compilation they disappear again. PS. I am using TeXlipse. – space_voyager Nov 29 '15 at 11:58
  • 1
    @space_voyager: Either your setup is wrong (I don't use such editors at all) or you have something in your code that prevents the usage of references. Like David Carlisle, I don't suggest newclude. (Never heard of it before) – user31729 Nov 29 '15 at 12:02
6

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.