# Conditional Bibliography in LyX Subdocument

I am using LyX to manage a multi-part document (my thesis) and I would like to be able to produce stand alone sub-documents (e.g. a chapter) that include a bibliography, but only when the sub-document is produced on its own. When I produce the full master document, the only bibliography should be at the end.

How can I make the bibliography in a LyX subdocument only show up when the document is used by itself (and not when it is included in the master document)?

-

After experiments using the helpful tips from this post, I found an automatic solution that works:

At the top of the master thesis document add a new TeX command (using Insert>TeX Code) that identifies that we are building the complete thesis:

``````\newcommand{\FULLTHESIS}{} %Id that we are building the complete thesis
``````

Then in each chapter enclose the bibliography (or any other items that should only appear when the chapter is created standalone) between two raw TeX Code blocks as follows:

``````\ifdefined\FULLTHESIS\else  %TeX way of saying if not defined FULL_THESIS
``````

Insert the Bibilography (etc) Here

``````\fi
``````

Note: I could not get some of the more elegant TeX approaches from the post such as `\newif` and the LaTeX macro `\@ifundefined` to work properly in my document under LyX.

-