1

I would like to get the Latex source for the PDF that is built when executing

R CMD Rd2pdf /path/to/mypackage

for building the R package documentation. It would be very nice if I could get the documentation as a latex document such that I could easily include it in another latex document as an appendix and have a continuous page numbering.

I have only seen the possibility to compile the files one by one from .Rd to .tex: How to create R documentation file (.Rd) in latex?, which points to the function tools::Rd2latex and the question How do I convert Rd files to pdf for a package that I am creating in R? which points to the command

R CMD Rdconv -o x.tex --type=latex man/x.Rd

Both commands only work on single .Rd files. The created files lack the header/definitions. So I would have to sort and include each file manually in the final latex file. It would be nice if there is some way to get the latex document in a simpler way.

esel
  • 901
  • 9
  • 20

1 Answers1

1

You can do:

R CMD Rd2pdf path/to/package/man --no-clean

In addition to the PDF file, this creates a folder containing the auxiliary files, including the tex source file.

Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225
  • This worked very well. I just had to add the Rd.sty file to my folder, add `\usepackage[times,inconsolata]{Rd}` to my latex file and could paste the content between `\begin{document}` and `\end{document}` into the appendix. – esel Aug 12 '20 at 17:59