How can knitr keep warning messages inside the box?
问题 I'm writing a tutorial using knitr and I want to show some of the warnings and errors that students might encounter. While I'm capable of nicely displaying the code chunks within the box using the tidy=TRUE option, I don't understand how to handle the display of warnings and errors. For example, if I have the following code: \documentclass{article} \begin{document} <<setupOp, include=FALSE>>= opts_chunk$set(tidy=TRUE, tidy.opts=list(blank=FALSE, width.cutoff=20)) @ <<ErrorTest>>= warning