[Tex/LaTex] How to get LyX to compile child documents selectively

lyx

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?

Best Answer

Problem solved! Thanks to all those who had a look at my question, especially scottkosty who suggested a solution. I solved the problem by including the chapter files directly in the LyX master document using the LyX Insert->File->Child Document menu facilty. I can now select the chapter file(s) to be compiled using the LyX Master Document Output window. The LyX includeonly facility does exactly what I want.

There is one small snag left: The Master Document Output window displays only the first nine (9) characters of the name of the path to a selected file, even when the window is maximized. This poses a challenge if the (sub)directories which contain the included files share a part of the path name: Several files, the paths to which share a part of the path name, can only be distinguished by some sort of counting. I pray and hope that the LyX team considers removing this small snag. Otherwise, LyX is a great document processor.