@@ -22,18 +22,21 @@ rjournal_article <- function() {
22
22
# Mostly copied from knitr::render_sweave
23
23
base $ knitr $ opts_chunk $ comment <- " #>"
24
24
25
- hook_chunk <- function (x , options ) {
25
+ hook_chunk = function (x , options ) {
26
26
if (knitr ::: output_asis(x , options )) return (x )
27
- paste0 (' \\ begin{example }\n ' , x , ' \\ end{example} ' )
27
+ paste (' \\ begin{Schunk }\n ' , x , ' \\ end{Schunk} ' , sep = ' ' )
28
28
}
29
- hook_input <- function (x , options ) paste0(x , " \n " )
30
- hook_output <- function (x , options ) paste0(x , " \n " )
29
+ hook_input <- function (x , options )
30
+ paste(c(' \\ begin{Sinput}' , knitr ::: hilight_source(x , ' sweave' , options ), ' \\ end{Sinput}' , ' ' ),
31
+ collapse = ' \n ' )
32
+ hook_output <- function (x , options ) paste(' \\ begin{Soutput}\n ' , x , ' \\ end{Soutput}\n ' , sep = ' ' )
31
33
32
34
base $ knitr $ knit_hooks $ chunk <- hook_chunk
33
35
base $ knitr $ knit_hooks $ source <- hook_input
34
36
base $ knitr $ knit_hooks $ output <- hook_output
35
37
base $ knitr $ knit_hooks $ message <- hook_output
36
38
base $ knitr $ knit_hooks $ warning <- hook_output
39
+ base $ knitr $ knit_hooks $ plot <- knitr ::: hook_plot_tex
37
40
38
41
base
39
42
}
0 commit comments