hook_movecode: Some potentially useful document hooks
Description
A document hook is a function to post-process the output
document.
Usage
hook_movecode(x)
hook_rjournal(x)
Arguments
x
a character string (the content of the whole
document output)
Value
The post-processed document as a character string.
Details
hook_movecode() is a document hook to move code
chunks out of LaTeX floating environments like
figure and table 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
% knitr_do_not_move in the floating environment.
hook_rjournal() is a hook designed for the R
Journal; it adds \begin{article} after
\begin{document}, and \end{article}
before \end{document}, because that is how the R
Journal style works, although it is unusual.