Skip to content

Reordering entries in package manual PDF's

7 messages · Aleksi Kallio, Brian Ripley, Duncan Murdoch +1 more

#
Hello,

I have created my own R package and written the documentation in Rd
format for each of the functions plus the package itself.

However now the functions appear in a random order in the generated PDF
and the package documentation entry is placed in between the functions, 
when I would like it to be first, naturally.

Is there an easy way to specify the order of the entries in the
generated documentation?

Browsing through the R manual and mailing list archives did not find
anything. Rd is all I need, so I would not like to start using any of
the more advanced documentation tools.

Thanks for your help!

All the best,
Aleksi

P.S. Cross-posted from R-help, as instructed by one of the subscribers.
#
On 01/12/2010 7:27 AM, Aleksi Kallio wrote:
I think you need to give us more details.  What version of R are you 
using?  How are you producing the PDF?  When I do it in R 2.12.0 using

R CMD Rd2dvi --pdf <mypackage>

I get the pages in alphabetical order, except that the package page 
comes first.

Duncan Murdoch
#
On Wed, 1 Dec 2010, Aleksi Kallio wrote:

            
I have never seen anything else.  Please do as the posting guide asked 
you, and given a reproducible example.

All the package manuals on CRAN have the following order:

foo-package.Rd, if present.
the remaining Rd files in alphabetical order in the current locale.
By the ordering of the names of the Rd files, but your readers will 
find anything other than alphabetical order of main topic unusual and 
maybe puzzling.

You could also call Rd2dvi/Rd2pdf with a list of files.
We do prefer posting in only one place.
#
Hi,
I was actually using an ancient version, 2.5. Updating to a later one moved the package page first.

So now the output I'm getting is "good enough". I would still like to reorder functions so that they appear in a more logical order, so if anyone has ideas, please share!

Thanks!

Cheers,
Aleksi
#
Hi again,

And sorry for the spam.
Newer R versions also add an index page at the end. In my case it is obsolete, so ideas on how to get rid of it are appreciated.

A pointer to an in-depth technical description of the manual generation process would help, as hacking these kinds of things would be probably quite easy. So far I have not been able to Google anything relevant.

Cheers,
Aleksi
#
On 01/12/2010 12:25 PM, Aleksi Kallio wrote:
You could look at R Internals for such a thing, but you wouldn't find 
it.  (That manual tends to cover lower level issues.)

Generally in a case like this you need to go to the source code.  First, 
get a copy, then figure out what happens.  Here are the steps:

1. Download the full source from 
http://cran.r-project.org/src/base/R-2/R-2.12.0.tar.gz (or from a 
mirror), and untar it.

2. We use R CMD Rd2dvi to get the output we want.  Looking in 
src/scripts, you can see that the Rd2dvi script does some argument
cleaning, then runs tools:::..Rd2dvi().

3.  Look in src/library/tools/R for the file containing the source to 
..Rd2dvi(); you'll find it in Rd2dvi.R.

You can also see deparsed versions just by printing the tools:::..Rd2dvi 
function, but they may not be as useful as the original source.

I hope that helps.

Duncan Murdoch
#
On Wed, 2010-12-01 at 19:25 +0200, Aleksi Kallio wrote:
The manual isn't meant to be a manual in the sense of the thing you get
to help you operate your VCR. It is meant more as a reference manual
hence the alphabetical ordering of functions.

If you want to produce something the guides the user through the use of
your package, consider adding a vignette to your package. Details of
vignettes can be found in the Writing R Extensions manual.

G