Re: Detect if document is part of a master file
Thanks, both solutions worked for me, exactly as I needed. I didn't know anything about branches in lyx, looks really useful. For the ERT approach, I had to look up the syntax for \ifx to make it work, this is what did the trick: [ERT] \ifx\iamthemaster\undefined [/ERT] ...put bibliography inset here... [ERT] \fi [/ERT] On 7 September 2013 11:23, Richard Heck wrote: > On 09/07/2013 04:52 AM, Jürgen Spitzmüller wrote: >> >> Marx Gomes van der Linden wrote: >>> >>> My question is: is there any way to include the references at the end >>> of each chapter when they are compiled as stand-alone documents, but >>> to omit them automatically if they are part of the master document >>> (which will have a single bibliography at the end of the whole thing)? >>> What I'm trying to do is to be able to generate proper pdfs for the >>> individual chapters with working references, without having to >>> manually remove every bibliography section before generating the >>> master document. >> >> One way to achieve this is to define a branch (via Document > Settings > >> Branches) which is active in the children and non-active in the master, >> and >> put the "BibTeX Bibliography" inset for each child into that branch. > > > Another uses ERT. First, define some random command in the master, e.g.: > > \newcommand\iamthemaster{Whatever} > > Then, in the children, test for this command's existence: > > [ERT] \ifx\iamthemaster\undefined{ [/ERT] > ...put bibliography inset here... > [ERT] } [/ERT] > > Now the bibliography only gets included when the document is compiled > standalone. > > I have not tried this for a while, but used to use this technique some years > ago. > > Richard >
Re: Detect if document is part of a master file
On 09/07/2013 04:52 AM, Jürgen Spitzmüller wrote: Marx Gomes van der Linden wrote: My question is: is there any way to include the references at the end of each chapter when they are compiled as stand-alone documents, but to omit them automatically if they are part of the master document (which will have a single bibliography at the end of the whole thing)? What I'm trying to do is to be able to generate proper pdfs for the individual chapters with working references, without having to manually remove every bibliography section before generating the master document. One way to achieve this is to define a branch (via Document > Settings > Branches) which is active in the children and non-active in the master, and put the "BibTeX Bibliography" inset for each child into that branch. Another uses ERT. First, define some random command in the master, e.g.: \newcommand\iamthemaster{Whatever} Then, in the children, test for this command's existence: [ERT] \ifx\iamthemaster\undefined{ [/ERT] ...put bibliography inset here... [ERT] } [/ERT] Now the bibliography only gets included when the document is compiled standalone. I have not tried this for a while, but used to use this technique some years ago. Richard
Re: Detect if document is part of a master file
Marx Gomes van der Linden wrote: > My question is: is there any way to include the references at the end > of each chapter when they are compiled as stand-alone documents, but > to omit them automatically if they are part of the master document > (which will have a single bibliography at the end of the whole thing)? > What I'm trying to do is to be able to generate proper pdfs for the > individual chapters with working references, without having to > manually remove every bibliography section before generating the > master document. One way to achieve this is to define a branch (via Document > Settings > Branches) which is active in the children and non-active in the master, and put the "BibTeX Bibliography" inset for each child into that branch. Jürgen
Detect if document is part of a master file
Hello, I am currently writing a long document in Lyx. I use separate files for each chapter, which are joined together as child documents in a master file. My question is: is there any way to include the references at the end of each chapter when they are compiled as stand-alone documents, but to omit them automatically if they are part of the master document (which will have a single bibliography at the end of the whole thing)? What I'm trying to do is to be able to generate proper pdfs for the individual chapters with working references, without having to manually remove every bibliography section before generating the master document. Thanks for any assistance Marx