1

I created my first R package using roxygen2.

I generated the manual with a .pdf extension using the code

pack <- "name_of_your_package"
path <- find.package(pack)
system(paste(shQuote(file.path(R.home("bin"), "R")),"CMD", "Rd2pdf", shQuote(path)))

as suggested here.

My problem is that some lines in the text needs to be cut off in order to fit within the margins of the page.

I am aware that one solution is to use \cr in the documentation. However, this impacts also the formatting of the R Studio help. By contrast, my goal is to cut off some lines in the .pdf, while keeping unchanged the format of the help pages in R studio.

The best solution I could come up with is to generate a .tex file, rather than a .pdf, and manually cut off the lines, but I cannot find a way to do it.

My question is: Are you aware of a way to generate the R manual of a package in latex, or alternatively do you have any better solution?

shazz
  • 387
  • 1
  • 13
  • I didn't completely looked into the page you suggested, but it is almost 8 years old. Have you checked `devtools::document()` if it fits your needs? – drmariod Feb 16 '18 at 06:21
  • 1
    you can use the `\ifelse{latex}{statements for pdf}{statements for html}` clause to generate different layouts for the pdf-Manual and the html-manual-pages that are shown in Rstudio. Note that this clause is a bit tricky since not every RD-environment can be inserted into either of those cases but must be stated outside of the clause. – Tom Feb 16 '18 at 08:07
  • @Tom that works, thank you. – shazz Feb 16 '18 at 16:00

0 Answers0