My issue is to include verbatim output from knitr Sweave code chunks in footnotes. The BVerbatim environment (fancyvrb) gives me the formatting that I want. (NB: one needs to put \VerbatimFootnotes somewhere following the preamble.) With the chunk option results='asis'
the code is delimited with \begin{Sinput} ... \end{Sinput}. Is there a way to ensure that these do not appear, or to omit them? An example is at the end of the post.
If I include the output directly in the footnote, whether with results='asis'
or results='markup'
, the formatting is untidy and the code appears normalsize, even if I have size='footnotesize'
as a chunk option. I can of course admit defeat and include the code directly in a BVerbatim environment, with the concurrent risk that the code that is printed is not guaranteed to be the code that is executed.
\documentclass{article}
\usepackage{fancyvrb}
\begin{document}
\VerbatimFootnotes
<<setup, echo=FALSE>>=
render_listings()
@
<<install-pkg, echo=FALSE, eval=FALSE>>=
repos <- "http://cran.csiro.au"
install.packages('httr', repos=repos)}
@
To install the package {\em httr}, execute
the code in the footnote.\footnote{
\begin{BVerbatim}[baseline=t]
<<install-pkg, eval=FALSE, echo=TRUE, results="asis">>=
@
\end{BVerbatim}
}
\end{document}