set_header(...)
highlight
, tikz
and framed
, which contain the
necessary commands to be used in the HTML header or LaTeX preamble; note
HTML output does not use the tikz
and framed
components (they
do not make sense to HTML)opts_knit
is set.
tikz
to be a character string: set_header(tikz =
'\usepackage{tikz}')
. Similary, when we highlight R code using the
highlight package (i.e. the chunk option highlight = TRUE
),
knitr will set the highlight
component of the header vector
automatically; if the output type is HTML, this component will be different
-- instead of LaTeX commands, it contains CSS definitions.For power users, all the components can be modified to adapt to a customized
type of output. For instance, we can change highlight
to LaTeX
definitions of the listings package (and modify the output hooks
accordingly), so we can decorate R code using the listings package.
set_header(tikz = "\\usepackage{tikz}")
opts_knit$get("header")
Run the code above in your browser using DataLab