The solution is to include the line
\usepackage{Rd}
in the beginning of the .Rnw file and then use
help_console(topic="mean", format="latex")
For example, put the following in a file, say test.Rnw
and compile to produce documentation about the function mean
. Note that results=tex
ensures that the Latex code produced by R
is actually created like Latex code.
% devtools::install_github('noamross/noamtools', build_vignettes = TRUE)
\documentclass{book}
\usepackage{Rd} % Rstudio will be able to find this .sty file
\begin{document}
<<label=Test, results=tex>>=
library(noamtools)
help_console(topic="mean", format = "latex")
@
\end{document}
Which produces a pdf which looks like this,

Looking here helped me realize that the Rd.sty
file needed to be included. Running the following code
pack <- "ggplot2"
path <- find.package(pack)
system(paste(shQuote(file.path(R.home("bin"), "R")),
"CMD", "Rd2pdf --no-clean", shQuote(path)))
# .Rd2xxxx directory created
# cd .Rd2xxxx
You can look inside the created directory named something like .Rd2xxxx
to find Rd2.tex
which shows what is put in the Latex documentation files which R creates.