Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)?

share|improve this question

2 Answers 2

You can define a Branch for the subdocument only, which then contains the Bibliography. You can learn more about Branches in the Users Guide in section 6.8.

A good starting point to look at how that works is the thesis template which comes bundled with LyX (at least from v2.0 on).

share|improve this answer
    
Thanks for the tip... Branches do seem like a possible starting point, but they apparently still require manually selecting whether or not to include the branch text (e.g. bibilography). What I am looking for is a way to automate this such that without changing the files, the bibliography is included when run stand-alone, but not when it's a subdocument. Seems like there could be a raw LaTeX (aka ERT) solution that sets a flag in the master, and then the sub-document (chapter) could only include the text if the flag is not set. Any ideas how to do so? –  Bryan P Mar 5 '12 at 7:39
up vote 4 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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