Debian Codegraph @

man/set_parent.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/utils.R
3 \name{set_parent}
4 \alias{set_parent}
5 \title{Specify the parent document of child documents}
6 \usage{
7 set_parent(parent)
8 }
9 \arguments{
10 \item{parent}{Path to the parent document, relative to the current child
11 document.}
12 }
13 \value{
14 The preamble is extracted and stored to be used later when the
15 complete output is written.
16 }
17 \description{
18 This function extracts the LaTeX preamble of the parent document to use for
19 the child document, so that the child document can be compiled as an
20 individual document.
21 }
22 \details{
23 When the preamble of the parent document also contains code chunks and inline
24 R code, they will be evaluated as if they were in this child document. For
25 examples, when \pkg{knitr} hooks or other options are set in the preamble of
26 the parent document, it will apply to the child document as well.
27 }
28 \note{
29 Obviously this function is only useful when the output format is LaTeX.
30 This function only works when the child document is compiled in a
31 standalone mode using \code{\link{knit}()} (instead of being called in
32 \code{\link{knit_child}()}); when the parent document is compiled, this
33 function in the child document will be ignored.
34 }
35 \examples{
36 ## can use, e.g. \Sexpr{set_parent('parent_doc.Rnw')} or
37
38 # <<setup-child, include=FALSE>>=
39
40 # set_parent('parent_doc.Rnw')
41
42 # @
43 }
44 \references{
45 \url{https://yihui.org/knitr/demo/child/}
46 }