From murray.efford at otago.ac.nz  Wed Apr 28 23:39:31 2010
From: murray.efford at otago.ac.nz (Murray Efford)
Date: Thu, 29 Apr 2010 09:39:31 +1200
Subject: [Rd] Rd2dvi pagination of index  in pdf manual
In-Reply-To: <FB5C77F3-C2E6-4B70-8E63-66D040DAFC4C@cbs.dk>
References: <E67251526203864DABCB7237DAC8EB2D904C8DA81C@MAIL2.registry.otago.ac.nz>
	<alpine.LFD.2.00.1004281316290.14977@gannet.stats.ox.ac.uk>,
	<FB5C77F3-C2E6-4B70-8E63-66D040DAFC4C@cbs.dk>
Message-ID: <E67251526203864DABCB7237DAC8EB2D904C8DA820@MAIL2.registry.otago.ac.nz>

Peter's solution works perfectly. Thanks. Maybe this should be standard.
Murray

________________________________________
From: peter dalgaard [pdalgd at gmail.com]
Sent: Thursday, 29 April 2010 1:06 a.m.
To: Prof Brian Ripley
Cc: Murray Efford; r-devel at r-project.org
Subject: Re: [Rd] Rd2dvi pagination of index  in pdf manual

On Apr 28, 2010, at 2:29 PM, Prof Brian Ripley wrote:

> Hmm, the construction of the PDF is done by pdlatex/hyperref, not by R.  What latex setup is this, and (guessing it is some version of MiKTeX) does it have a texi2dvi.exe?  If so, the conversion from our .tex file to PDF is managed entirely by texi2dvi.exe, and my guess is that it has done too few passes.  You should be able to verify that by using Rd2pdf --no-clean and running texi2dvi yourself on the saved .tex file.  Most likely running pdflatex on the .tex one more time will resolve this, so if you want to check texi2dvi.exe you would need to copy the .tex elsewhere.
>
> (The less likely alternative is that this is managed by tools::texi2dvi and it is doing too few passes.)
>
> If you have not already done so it would be worth checking that your latex setup is fully updated: latex package hyperref is involved and that is updated very frequently (more than weekly).

I'm seeing the same issue with ISwR. It looks like a generic LaTeX issue where we need to wait with the makeindex step until the TOC is in place. An easy fix would be to hand-edit the Rd2dvi script to make an extra pass. E.g. replace

if test "${out_ext}" = pdf; then
  ${R_PDFLATEXCMD} ${R_TEXOPTS} Rd2 || status=1

with

if test "${out_ext}" = pdf; then
  ${R_PDFLATEXCMD} ${R_TEXOPTS} Rd2 &&
  ${R_PDFLATEXCMD} ${R_TEXOPTS} Rd2 || status=1

and similarly for the non-pdf case, if you care.


>
> On Thu, 29 Apr 2010, Murray Efford wrote:
>
>> I construct a pdf package manual in Windows 7 using
>> R CMD Rd2dvi --pdf --no-preview [packagename]
>> Page numbers are listed correctly under 'R topics documented' at the front, but incorrectly (offset by -2 pages) in the Index at the back. Following the hyperlinked page numbers in the Index takes you to the wrong page. 2 pages happens to be the length of the package overview man page inserted (out of alphabetical order) after 'R topics documented'.
>>
>> I'd be grateful for suggestions on what might be causing this and how I might fix it. I'm using R 2.10.1 and Rtools 2.10.1.
>> Murray Efford
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
> --
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

--
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com


[Rd] Rd2dvi pagination of index in pdf manual
Murray Efford