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?

  • 1
    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

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.

  • 1
    Glad you fixed most of the problem! For the other issue, we cannot fix bugs that we don't know about. I have not seen this bug reported. Can you please post a minimal example in a new ticket at lyx.org/trac . The minimal example is important because I cannot reproduce what you've described. I can always place my cursor in-between the column names and and drag to increase the width of the "Child Document" column. – scottkosty Nov 5 '14 at 17:58
  • Thank you very much (once more) scottkosty for educating me. The problem was not a bug! It was my ignorance! All I need to do is to drag the vertical separator bar between the columns to see the full path names to the included files. Great!!! Now I know. Thanks. – user24098 Nov 5 '14 at 18:35
  • Great. Well in the future please let us know about any bugs you find. We are very interested in fixing them. – scottkosty Nov 5 '14 at 19:10

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.