# set_parent

From knitr v1.7
0th

Percentile

##### Specify the parent document of child documents

This function extracts the LaTeX preamble of the parent document to use for the child document, so that the child document can be compiled as an individual document.

##### Usage
set_parent(parent)
##### Arguments
parent
path to the parent document (relative to the current child document)
##### Details

When the preamble of the parent document also contains code chunks and inline R code, they will be evaluated as if they were in this child document. For examples, when knitr hooks or other options are set in the preamble of the parent document, it will apply to the child document as well.

##### Value

• The preamble is extracted and stored to be used later when the complete output is written.

##### Note

Obviously this function is only useful when the output format is LaTeX. This function only works when the child document is compiled in a standalone mode using knit() (instead of being called in knit_child()); when the parent document is compiled, this function in the child document will be ignored.

##### References

http://yihui.name/knitr/demo/child/

• set_parent
##### Examples
## can use, e.g. \\Sexpr{set_parent('parent_doc.Rnw')} or

# <<setup-child, include=FALSE>>=

# set_parent('parent_doc.Rnw')

# @
Documentation reproduced from package knitr, version 1.7, License: GPL

### Community examples

Looks like there are no examples yet.