# How can I get LyX to compile child documents selectively?

I am writing a book using LyX. The book is divided into parts which contain chapters. The book publisher, whose LyX layout file I am using, requires the references to be listed by chapters. I am, as a consequence of this requirement, using the chapterbib package which does what is required by the publisher. To use the chapterbib package successfully, I have to insert the chapter files into my tree of LyX files using the LaTeX \include command via the Insert->File->Child Document menu in LyX. However, the \include command cannot be used within a file which has been included in the master file using the \include command. So I am forced to use the LaTeX \input command to insert the parts files into the master file; and the \include command to insert the chapter files into the parts files.

The Master Document Output window in LyX sees only the names of the parts files which I have inserted into the master document using the \input command. The LaTeX \includeonly command, which LyX relies on to compile files selectively, works only if the files selected for compiling are included using the \include command. This feature does not give me the option of getting LyX to compile only those chapters that I am working on. Does someone have an idea of how I could get LyX to compile my chapter files selectively, from the master file, without resorting to commenting them out at the points at which I include them? Is there a means by which I could have LyX's Master Document Output window see the chapter files which I have included in the parts files?

• Can you post a minimal example? Would using LyX branches (see Help > User Guide for more information) solve your problem? – scottkosty Nov 2 '14 at 13:25
• Thanks scottkosty. Using branches may help but I suspect it may complicate things a little: I may ultimately require as many branches as I have chapters. A new idea has occurred to me which may help solve my problem. I'll post it once it has proved its worth. Thanks. – user24098 Nov 3 '14 at 10:49