How can I make sure, that the document settings of a child document are compatible to the master document?

Today I had a big hassle concerning citation:

If I choose "citation style standard (numerical)" in the master document and "natbib" in the child document I get in the "insert citation window" (in the child document) the options that belong to natbib package (citet, citep, citeauthor etc.). Trying to render the document gives an error: "control sequence undefinded" (obviously, as the \citet is only defined in the natbib package, which I haven't included (in the master, at least)).

Do I have to keep master and child settings in sync manually? Shouldn't the be possible to be done automatically or are there use cases where different settings are useful? I expect a behaviour just like LaTeX, where it is also possible to have subdocuments without any header.

This problem: LyX BibTeX with child-documents not working was obviously caused by the same issue.

2 Answers 2


This might answer your question probably only partly: I have a master document with some child documents. All lyx files have the same document type and use the defaults. To include packages or define macros I have an additional tex file (options.tex) which contains everything that needs to be done in the preamble.

In the preamble of the lyx documents I add an input instruction.


This solution is not perfect, but this enables me to compile the master document (which takes some time as it is 190+ pages) or compile only a child document.


Currently the only option seems to be manually synchronizing the settings, which is error prone. In order to reduce errors, the most reliable workflow I found is:

  • Change settings of the parent document.
  • Close LyX
  • Open the parent document as plaintext document (e.g. with Emacs) and copy the part starting with \begin_header and ending with \end_header.
  • For each child document:
    • Open child document as plain text
    • Overwrite the header with the parent document header.

I have written a script though for automating this process, lyx-header-util.py [gist.github.com] (requires python 3), which reduces the workflow to

  • For each child document run

    lyx-header-util.py copyheaderinplace PARENTFILE.LYX CHILDDOCUMENT.lyx

(backup recommended before doing this; The script overwrites the original files).

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.