# Re: Compiling Root document from child document?

[EMAIL PROTECTED] wrote:

>> bigblop wrote:

>>> If I compile the child separately the references from my .bib file does
>>> not show (only appears as question marks).

> It can be done, but it's a bit more advanced and I'm not sure I remember
> how I did it.

Here is an example how I did it: In the main document, put these two
lines in the preamble:

,---- [master.lyx preamble] .
\usepackage{comment}
\excludecomment{subbib}
'-------------------------'

In the child documents, you have to include the following in the
preamble:

,---- [child.lyx preamble] .
\usepackage{comment}
\includecomment{subbib}
'-------------------------'

In the master document, you can include the bibliography normally. In
the child documents, however, you have to embed it in the 'subbib'
environment (which is created by the package 'comment' and the command
'includecomment'). This has to be done in ERT, not with the
bibliography-dialog:

,---- [child.lyx document] ------.
\begin{subbib}
\bibliographystyle{<bibstyle>}
\bibliography{<bib file>}
\end{subbib}
'--------------------------------'

When you now compile the master document, the 'subbib' environments are
ignored. If you compile a child document, they are included.

Regards,
Dominik.-