From dtenenba at fhcrc.org  Tue Mar 20 18:46:07 2012
From: dtenenba at fhcrc.org (Dan Tenenbaum)
Date: Tue, 20 Mar 2012 10:46:07 -0700
Subject: [Rd] issue with Rd2pdf and \Sexpr in Rd files
In-Reply-To: <4F68C13B.7080806@gmail.com>
References: <CAF42j22X+B8aLCEDhY7PzXpPobDcZT80rhNT5DFKFNBa0vkYLg@mail.gmail.com>
	<CAF42j20FGqHq67xPwAbYN2K_AmQKZ3PHwW6BVtQTjZVeLEvyTQ@mail.gmail.com>
	<4F68BC81.20506@gmail.com>
	<CAF42j22icfTTsN6=2ocJw2pVWh4QxoYyFNaZ9BkdNuotLnu6Ng@mail.gmail.com>
	<4F68C13B.7080806@gmail.com>
Message-ID: <CAF42j223UuHwMwQ+tNVt3rEwUA4FB+mR8uQX4yEZjd3bn0C4=Q@mail.gmail.com>

On Tue, Mar 20, 2012 at 10:41 AM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
> On 12-03-20 1:25 PM, Dan Tenenbaum wrote:
>>
>> On Tue, Mar 20, 2012 at 10:21 AM, Duncan Murdoch
>> <murdoch.duncan at gmail.com> ?wrote:
>>>
>>> On 12-03-19 10:27 PM, Dan Tenenbaum wrote:
>>>>
>>>>
>>>> Hello,
>>>>
>>>> Sorry to repeat myself, but I was wondering if anyone had taken a look
>>>> at
>>>> this.
>>>
>>>
>>>
>>> No. ?Could you put together a simple self contained example? ?I don't
>>> have
>>> any BioC packages installed.
>>>
>>
>> I did supply a self-contained example.
>> You do not need any BioC packages installed.
>> All you need is this file:
>>
>>
>> https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/genefu/man/genefu-package.Rd
>> (username: readonly, password: readonly)
>> And this command:
>> R CMD Rd2pdf --no-preview --output=./tmp.pdf --title=test
>> genefu-package.Rd
>
>
> Sorry, I didn't see that.
>

Actually,  I goofed, because that file contains the lines:
Version: \tab \Sexpr{packageDescription("genefu")$Version}\cr
Date: \tab \Sexpr{packageDescription("genefu")$Date}\cr

And those lines require you to have the 'genefu' package installed.
 I changed those lines to more innocuous \Sexprs:

Version: \tab \Sexpr{cat("hello")}\cr
Date: \tab \Sexpr{cat("world")}\cr



>
>> No .tex file is generated.
>
>
> If you use the --no-clean command line option, then the temporary directory
> containing the .tex file will not be deleted. ?It contains your \Sexpr
> expressions wrapped in verbatim environments. ?I suspect this is happening
> because Rd2pdf isn't running the Sexpr evaluation step.

Yes, that's what I think is happening.

>?I'll try to take a
> look and fix it.

Thanks very much!

I added the --no-clean flag and still got no .tex file. Here is my new
error output, looks the same as the original error output.

Thanks,
Dan

Converting Rd files to LaTeX ...
  genefu-package.Rd
Creating pdf output from LaTeX ...
Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet = quiet,  :
  Running 'texi2dvi' on 'Rd2.tex' failed.
LaTeX errors:
/Users/dtenenba/tmp/.Rd2pdf4804/Rd2.tex:39:  ==> Fatal error occurred, no outpu
t PDF file produced!
Output:
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011)
 restricted \write18 enabled.
entering extended mode
(/Users/dtenenba/tmp/.Rd2pdf4804/Rd2.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2011-07-01, ngerman-x-2011-07-01, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, galician, german, ngerman, swissgerman, monogreek, greek, hungarian,
 icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, marathi, or
iya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian, kurmanji,
 lao, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk, pol
ish, portuguese, romanian, russian, sanskrit, serbian, serbianc, slovak, sloven
ian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian, welsh, loaded
.
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/book.cls
Document Class: book 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/bk10.clo))
(/Library/Frameworks/R.framework/Resources/share/texmf/tex/latex/Rd.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/tools/longtable.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/tools/bm.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/alltt.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/tools/verbatim.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/url/url.sty) NOT loading ae
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/t1enc.def))
(/usr/local/texlive/2011/texmf-dist/tex/latex/psnfss/times.sty)
NOT loading lmodern
(/usr/local/texlive/2011/texmf-dist/tex/latex/inconsolata/inconsolata.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/textcomp.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/ts1enc.def))
(/usr/local/texlive/2011/texmf-dist/tex/latex/graphics/keyval.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/graphics/color.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/latexconfig/color.cfg)
(/usr/local/texlive/2011/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)))
(/usr/local/texlive/2011/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/local/texlive/2011/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/local/texlive/2011/texmf-dist/tex/latex/latexconfig/hyperref.cfg))

Package hyperref Message: Driver (autodetected): hpdftex.

(/usr/local/texlive/2011/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/local/texlive/2011/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))

Package hyperref Warning: Option `hyperindex' has already been used,
(hyperref)                setting the option has no effect on input line 356.


Package hyperref Warning: Option `pagebackref' has already been used,
(hyperref)                setting the option has no effect on input line 356.

) (/usr/local/texlive/2011/texmf-dist/tex/latex/base/makeidx.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/inputenc.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/utf8.def
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/t1enc.dfu)
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/ot1enc.dfu)
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/omsenc.dfu)
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/ts1enc.dfu))
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/latin1.def))
Writing index file Rd2.idx
No file Rd2.aux.
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/ts1cmr.fd)
(/usr/local/texlive/2011/texmf-dist/tex/latex/psnfss/t1ptm.fd)
(/usr/local/texlive/2011/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2011/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/utf8.def)
(/usr/local/texlive/2011/texmf-dist/tex/latex/inconsolata/t1fi4.fd)
/Users/dtenenba/tmp/.Rd2pdf4804/Rd2.tex:39: Missing \endgroup inserted.
<inserted text>
                \endgroup
l.39 }

?
/Users/dtenenba/tmp/.Rd2pdf4804/Rd2.tex:39: Emergency stop.
<inserted text>
                \endgroup
l.39 }

/Users/dtenenba/tmp/.Rd2pdf4804/Rd2.tex:39:  ==> Fatal error occurred, no outpu
t PDF file produced!
Transcript written on Rd2.log.
Error in running tools::texi2pdf
You may want to clean up by 'rm -rf .Rd2pdf4804'



>
> Duncan Murdoch
>
>
>>
>> Thanks!
>> Dan
>>
>>
>>> Alternatively, you could take a look at the .tex files generated, and
>>> identify what the problem is.
>>>
>>> Duncan Murdoch
>>>
>>>>
>>>> Because of this problem, reference manuals are not being created for
>>>> many Bioconductor packages (any package where there is a \Sexpr in an
>>>> .Rd file).
>>>>
>>>> Thanks in advance--we appreciate your help very much.
>>>> Dan
>>>>
>>>>
>>>> On Wed, Mar 14, 2012 at 1:13 PM, Dan Tenenbaum<dtenenba at fhcrc.org>
>>>> ?wrote:
>>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> The following command:
>>>>> R CMD Rd2pdf --no-preview --output=./tmp.pdf --title=test
>>>>> genefu-package.Rd
>>>>> run against this file:
>>>>>
>>>>>
>>>>> https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/genefu/man/genefu-package.Rd
>>>>> (username: readonly; password: readonly)
>>>>>
>>>>> produces a very verbose error (see below)
>>>>> with R version 2.15.0 alpha (2012-03-07 r58622).
>>>>>
>>>>> The .Rd file has these lines in it:
>>>>>
>>>>> Version: \tab \Sexpr{packageDescription("genefu")$Version}\cr
>>>>> Date: \tab \Sexpr{packageDescription("genefu")$Date}\cr
>>>>>
>>>>> If I take these lines out, or take out the \Sexpr part, the Rd2pdf
>>>>> command will complete successfully.
>>>>>
>>>>> Is there some other step I need to run to evaluate the \Sexpr tags
>>>>> before running Rd2pdf, or is there an issue that needs to be fixed?
>>>>>
>>>>> Thanks,
>>>>> Dan
>>>>>
>>>>> Error output:
>>>>>
>>>>> Converting Rd files to LaTeX ...
>>>>> ?genefu-package.Rd
>>>>> Creating pdf output from LaTeX ...
>>>>> Error in texi2dvi(file = file, pdf = TRUE, clean = clean, quiet =
>>>>> quiet,
>>>>> ?:
>>>>> ?Running 'texi2dvi' on 'Rd2.tex' failed.
>>>>> Messages:
>>>>> /usr/bin/texi2dvi: pdflatex exited with bad status, quitting.
>>>>> /usr/bin/texi2dvi: see Rd2.log for errors.
>>>>> Output:
>>>>> This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011)
>>>>> ?restricted \write18 enabled.
>>>>> entering extended mode
>>>>> (/Users/dtenenba/dev/bioc_devel/genefu/man/.Rd2pdf62869/Rd2.tex
>>>>> LaTeX2e<2011/06/27>
>>>>> Babel<v3.8m> ? ?and hyphenation patterns for english, dumylang,
>>>>> nohyphenation, ge
>>>>> rman-x-2011-07-01, ngerman-x-2011-07-01, afrikaans, ancientgreek,
>>>>> ibycus,
>>>>> arabi
>>>>> c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian,
>>>>> czech,
>>>>> danis
>>>>> h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic,
>>>>> farsi,
>>>>> finnis
>>>>> h, french, galician, german, ngerman, swissgerman, monogreek, greek,
>>>>> hungarian,
>>>>> ?icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam,
>>>>> marathi, or
>>>>> iya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian,
>>>>> kurmanji,
>>>>> ?lao, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal,
>>>>> nynorsk, pol
>>>>> ish, portuguese, romanian, russian, sanskrit, serbian, serbianc,
>>>>> slovak,
>>>>> sloven
>>>>> ian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian,
>>>>> welsh,
>>>>> loaded
>>>>> .
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/book.cls
>>>>> Document Class: book 2007/10/19 v1.4h Standard LaTeX document class
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/bk10.clo))
>>>>> (/Library/Frameworks/R.framework/Resources/share/texmf/tex/latex/Rd.sty
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/ifthen.sty)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/tools/longtable.sty)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/tools/bm.sty)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/alltt.sty)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/tools/verbatim.sty)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/url/url.sty) NOT loading
>>>>> ae
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/fontenc.sty
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/t1enc.def))
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/psnfss/times.sty)
>>>>> NOT loading lmodern
>>>>>
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/inconsolata/inconsolata.sty
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/textcomp.sty
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/ts1enc.def))
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/graphics/keyval.sty))
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/graphics/color.sty
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/latexconfig/color.cfg)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/pdftex-def/pdftex.def
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)))
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/hyperref/hyperref.sty
>>>>>
>>>>>
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
>>>>>
>>>>>
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/hyperref/pd1enc.def)
>>>>>
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/latexconfig/hyperref.cfg))
>>>>>
>>>>> Package hyperref Message: Driver (autodetected): hpdftex.
>>>>>
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/hyperref/hpdftex.def
>>>>>
>>>>>
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
>>>>>
>>>>> Package hyperref Warning: Option `hyperindex' has already been used,
>>>>> (hyperref) ? ? ? ? ? ? ? ?setting the option has no effect on input
>>>>> line
>>>>> 356.
>>>>>
>>>>>
>>>>> Package hyperref Warning: Option `pagebackref' has already been used,
>>>>> (hyperref) ? ? ? ? ? ? ? ?setting the option has no effect on input
>>>>> line
>>>>> 356.
>>>>>
>>>>> ) (/usr/local/texlive/2011/texmf-dist/tex/latex/base/makeidx.sty)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/inputenc.sty
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/utf8.def
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/t1enc.dfu)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/ot1enc.dfu)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/omsenc.dfu)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/ts1enc.dfu))
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/latin1.def))
>>>>> Writing index file Rd2.idx
>>>>> No file Rd2.aux.
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/ts1cmr.fd)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/psnfss/t1ptm.fd)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/context/base/supp-pdf.mkii
>>>>> [Loading MPS to PDF converter (version 2006.09.02).]
>>>>> ) (/usr/local/texlive/2011/texmf-dist/tex/latex/hyperref/nameref.sty
>>>>>
>>>>>
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/base/utf8.def)
>>>>> (/usr/local/texlive/2011/texmf-dist/tex/latex/inconsolata/t1fi4.fd)
>>>>> /Users/dtenenba/dev/bioc_devel/genefu/man/.Rd2pdf62869/Rd2.tex:39:
>>>>> Missing \end
>>>>> group inserted.
>>>>> <inserted text>
>>>>> ? ? ? ? ? ? ? ?\endgroup
>>>>> l.39 }
>>>>>
>>>>> ?
>>>>> /Users/dtenenba/dev/bioc_devel/genefu/man/.Rd2pdf62869/Rd2.tex:39:
>>>>> Emergency st
>>>>> op.
>>>>> <inserted text>
>>>>> ? ? ? ? ? ? ? ?\endgroup
>>>>> l.39 }
>>>>>
>>>>> /Users/dtenenba/dev/bioc_devel/genefu/man/.Rd2pdf62869/Rd2.tex:39: ?==>
>>>>> ?Fatal e
>>>>> rror occurred, no output PDF file produced!
>>>>> Transcript written on Rd2.log.
>>>>> Error in running tools::texi2pdf
>>>>
>>>>
>>>>
>>>> ______________________________________________
>>>> R-devel at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>>>
>>>
>



[Rd] issue with Rd2pdf and \Sexpr in Rd files
Dan Tenenbaum