# [R] help with knit_hooks

Yihui Xie xie at yihui.name
Thu Jan 10 18:27:58 CET 2013

This is the only public reference at the moment:
http://yihui.name/knitr/hooks (which has explained why your hook does
not work)

Or learn by examples: https://github.com/yihui/knitr-examples (e.g. example 045)

Or in the spirit of "Luke, use the source!", see https://github.com/yihui/knitr

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA

On Thu, Jan 10, 2013 at 6:51 AM, Francesco Sarracino
<f.sarracino at gmail.com> wrote:
> Dear R-listers,
>
> hooks in knitr work?
>
> I am trying to enclose the output of an R command in the Latex verbatim
> environment.
> I defined a hook as follows:
>
> knit_hooks\$set(fsverb = function(x, options) {
>   paste("\\begin(verbatim)\n", x, "\\end(verbatim)\n", sep = "")
> }
>
> then I set a chunk as follows:
>
> <<expl-emp, echo = TRUE, results = 'asis', fsverb = TRUE>>=
> names(data)
> @
>
> but when I compile, I get a message of error saying that the compiler (in R
> studio) is quitting from lines ...
>
> I know that this is my fault because I don't know how to properly use the
> hooks, therefore I am asking if anybody can advice a reference where I can
> understand how the hooks and their options work and  how to set them.
>