From ml-it-r-devel at epigenomics.com  Wed Nov 18 14:01:17 2009
From: ml-it-r-devel at epigenomics.com (ml-it-r-devel at epigenomics.com)
Date: Wed, 18 Nov 2009 14:01:17 +0100
Subject: [Rd] Link to pdf documentation from other package ?
In-Reply-To: <4B03E883.1080707@bht-berlin.de>
References: <26405139.post@talk.nabble.com>
	<4B03DD64.6010206@stats.uwo.ca>	<26406675.post@talk.nabble.com>
	<4B03E4E9.1090209@stats.uwo.ca> <4B03E883.1080707@bht-berlin.de>
Message-ID: <4B03F01D.4010400@epigenomics.com>

Ulrike Gr?mping wrote, On 11/18/09 13:28:
> Duncan Murdoch schrieb:
>> Ulrike Groemping wrote:
>>>
>>> Duncan Murdoch-2 wrote:
>>>  
>>>> Ulrike Groemping wrote:
>>>>   
>>>>> Dear developeRs,
>>>>>
>>>>> I have not found anything recent about how to link to a vignette or
>>>>> other
>>>>> documentation from within Rd-files. Is this now possible with the new
>>>>> help
>>>>> system ? For example, I would like to link to the file AlgDesign.pdf
>>>>> provided within the doc directory of package AlgDesign.
>>>>>
>>>>>         
>>>> Yes, you can do it with a \url{} macro.  Use a relative link, acting
>>>> as though the starting page is located in
>>>> /library/AlgDesign/html/*.  So \url{../doc/AlgDesign.pdf}
>>>> should work from the same package,
>>>> \url{../../AlgDesign/doc/AlgDesign.pdf} from elsewhere.  Please let
>>>> me know if this doesn't work, I haven't tested.
>>>>
>>>> Duncan Murdoch
>>>>
>>>>     
>>>
>>> Yes, this works, thanks! Is it also possible to display an
>>> alternative text
>>> instead of the URL itself, like with other links (e.g. show text
>>> "Open pdf"
>>> that operates the link) ?
>>>
>>>   
>>
>> There's no optional text in the \url{} tag, but you could embed it in
>> an \ifelse tag, e.g.
>>
>> \ifelse{html}{\url{ ....  }}{ [open pdf ...] }
>>
>> might work.  Using the \ifelse tag will make your package depend on R
>> >= 2.10.0.
>>
>> Duncan Murdoch
>>>   
> Another thought: the link only works, if the two packages are installed
> in the same library, doesn't it ? Would there be a way to make it work
> independently of this restriction ?

you could use the Sweave like macro to compute the path inside the Rd environments

\Sexpr{file.path(system.file(package="AlgDesign", "doc"), "AlgDesign.pdf")}

described in 'Writing R extensions' 2.11
<http://stat.ethz.ch/R-manual/R-patched/doc/manual/R-exts.html#Dynamic-pages>

> Regards, Ulrike
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 


-- 
Matthias Burger                     Project Manager/ Biostatistician
Epigenomics AG    Kleine Praesidentenstr. 1    10178 Berlin, Germany
phone:+49-30-24345-0                            fax:+49-30-24345-555
http://www.epigenomics.com           matthias.burger at epigenomics.com
--
Epigenomics AG Berlin           Amtsgericht Charlottenburg HRB 75861
Vorstand:                           Geert Nygaard (CEO/Vorsitzender)
                                            Oliver Schacht PhD (CFO)
Aufsichtsrat:   Prof. Dr. Dr. hc. Rolf Krebs (Chairman/Vorsitzender)



[Rd] Link to pdf documentation from other package ?
ml-it-r-devel at epigenomics.com