I'm sorry not to have any more useful diagnosis, but some great code that Yihui wrote a while back to embed external functions in a chunk with code highlighting doesn't work for me any more ...
https://gist.github.com/1805862runs through knit just fine, but when trying to (pdf)latex it I get:
! Undefined control sequence.
<argument> \hlnormalsizeboxlessthan
l.97 ...nement{\usebox{\hlnormalsizeboxlessthan}-}
{\ }\hlkeyword{function}\h...
Any ideas ... ?
R-unstable (r60013), other attached packages:
[1] formatR_0.6 highlight_0.3.2 parser_0.0-16 Rcpp_0.9.15
[5] codetools_0.2-8 knitr_0.8