EVOLUTION-MANAGER
Edit File: set_header.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Set the header information</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for set_header {knitr}"><tr><td>set_header {knitr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Set the header information</h2> <h3>Description</h3> <p>Some output documents may need appropriate header information. For example, for LaTeX output, we need to write <span class="samp">\usepackage{tikz}</span> into the preamble if we use tikz graphics; this function sets the header information to be written into the output. </p> <h3>Usage</h3> <pre> set_header(...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>...</code></td> <td> <p>Header components; currently possible components are <code>highlight</code>, <code>tikz</code> and <code>framed</code>, which contain the necessary commands to be used in the HTML header or LaTeX preamble. Note that HTML output does not use the <code>tikz</code> and <code>framed</code> components, since they do not make sense in the context of HTML.</p> </td></tr> </table> <h3>Details</h3> <p>By default, <span class="pkg">knitr</span> will set up the header automatically. For example, if the tikz device is used, <span class="pkg">knitr</span> will add <span class="samp">\usepackage{tikz}</span> to the LaTeX preamble, and this is done by setting the header component <code>tikz</code> to be a character string: <code>set_header(tikz = '\usepackage{tikz}')</code>. Similary, when we highlight R code using the <span class="pkg">highlight</span> package (i.e. the chunk option <code>highlight = TRUE</code>), <span class="pkg">knitr</span> will set the <code>highlight</code> 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. </p> <p>For power users, all the components can be modified to adapt to a customized type of output. For instance, we can change <code>highlight</code> to LaTeX definitions of the <span class="pkg">listings</span> package (and modify the output hooks accordingly), so we can decorate R code using the <span class="pkg">listings</span> package. </p> <h3>Value</h3> <p>The header vector in <code>opts_knit</code> is set. </p> <h3>Examples</h3> <pre> set_header(tikz = "\\usepackage{tikz}") opts_knit$get("header") </pre> <hr /><div style="text-align: center;">[Package <em>knitr</em> version 1.29 <a href="00Index.html">Index</a>]</div> </body></html>