EVOLUTION-MANAGER
Edit File: hook_document.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: Some potentially useful document hooks</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 hook_movecode {knitr}"><tr><td>hook_movecode {knitr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Some potentially useful document hooks</h2> <h3>Description</h3> <p>A document hook is a function to post-process the output document. </p> <h3>Usage</h3> <pre> hook_movecode(x) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>A character string (the whole output document).</p> </td></tr> </table> <h3>Details</h3> <p><code>hook_movecode()</code> is a document hook to move code chunks out of LaTeX floating environments like <span class="samp">figure</span> and <span class="samp">table</span> when the chunks were actually written inside the floats. This function is primarily designed for LyX: we often insert code chunks into floats to generate figures or tables, but in the final output we do not want the code to float with the environments, so we use regular expressions to find out the floating environments, extract the code chunks and move them out. To disable this behavior, use a comment <code>% knitr_do_not_move</code> in the floating environment. </p> <h3>Value</h3> <p>The post-processed document as a character string. </p> <h3>Note</h3> <p>These functions are hackish. Also note <code>hook_movecode()</code> assumes you to use the default output hooks for LaTeX (not Sweave or listings), and every figure/table environment must have a label. </p> <h3>References</h3> <p><a href="https://yihui.org/knitr/hooks/">https://yihui.org/knitr/hooks/</a> </p> <h3>Examples</h3> <pre> ## Not run: knit_hooks$set(document = hook_movecode) ## End(Not run) # see example 103 at https://github.com/yihui/knitr-examples </pre> <hr /><div style="text-align: center;">[Package <em>knitr</em> version 1.29 <a href="00Index.html">Index</a>]</div> </body></html>