The rnw_hook_set function customizes knitr hooks to control the formatting of code chunks, output, inline values, and plot parameters in .rnw files. It is designed to improve the appearance of compiled LaTeX documents by setting specific knitr hooks.

rnw_hook_set()

Details

This function configures several hooks:

  • chunk: Defines the formatting of chunks via the rnw.chunk.hook function.

  • output: Sets output formatting via the rnw.output.hook function.

  • inline: Formats inline numerical output to three decimal places.

  • crop: Uses hook_pdfcrop to crop figures if crop is set to TRUE in chunk options.

  • par: Controls graphical parameters like margins and text sizes for plots, with a light gray background.

Examples

if (FALSE) { # \dontrun{
  rnw_hook_set() # Set hooks for knitr
} # }