[R] preformatted and '#' in manual pages

Gábor Csárdi csardi at rmki.kfki.hu
Wed Sep 30 09:16:26 CEST 2009


On Tue, Sep 29, 2009 at 6:47 PM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> On 9/29/2009 11:57 AM, Gábor Csárdi wrote:
>>
>> On Tue, Sep 29, 2009 at 5:36 PM, Duncan Murdoch <murdoch at stats.uwo.ca>
>> wrote:
>>>
>>> Gábor Csárdi wrote:
>>>>
>>>> Dear All,
>>>>
>>>> I have the following in a .Rd file:
>>>> ...
>>>>     human readable (not binary) format. The format itself is like
>>>>     the following:
>>>>     \preformatted{
>>>>       \# vertex1name
>>>>       vertex2name [optionalWeight]
>>>>       vertex3name [optionalWeight]
>>>>     }
>>>>     Here, the first vertex of an edge is preceded with a pound sign
>>>> ...
>>>>
>>>> and it is fine with R 2.9.2, but fails on R-devel, when building the
>>>> PDF version of the manual:
>>>> ...
>>>> * checking PDF version of manual ... WARNING
>>>> LaTeX errors when creating PDF version.
>>>> This typically indicates Rd problems.
>>>> LaTeX errors found:
>>>> ! You can't use `macro parameter character #' in vertical mode.
>>>> <argument> ...ike the following: \begin {alltt} ##
>>>>                                                  vertex1name vertex2name
>>>> [...
>>>> l.9051 listed one per line on subsequent lines.}
>>>>
>>>> * checking PDF version of manual without index ... ERROR
>>>>
>>>> To be precise, this is
>>>> * using R version 2.10.0 Under development (unstable) (2009-09-27
>>>> r49847)
>>>>
>>>> Is there a way to escape the '#' for LaTeX?
>>>
>>> I believe the Latex macro you want is \sharp, which isnt an Rd macro, so
>>> you'd need something like
>>> \latex{\sharp}{#}.
>>
>> Duncan,
>>
>> this might solve the issue in Latex (I haven't tried yet), but in R
>> (version 2.9.2) the manual page looks like
>> ...
>>        is like the following:
>>
>>                \latex{\sharp}{#} vertex1name
>>                vertex2name [optionalWeight]
>>                vertex3name [optionalWeight]
>>
>>        Here, the first vertex of an edge is preceded with a pound sign
>> ...
>>
>> which is obviously not what I want.
>
>
> I guess that's still in the \preformatted section, which doesn't act on Rd
> macros.  Sorry about that, my advice assumed you were putting it into text.
>
> Did 2.9.x emit the \sharp in this situation, or did it do something else?
>  We do some rewriting of special characters when writing verbatim text, and
> it looks as though our handling of # has changed.  (I'm just heading out to
> a long meeting, or I'd check myself...)
>
> Duncan Murdoch
>

Yes, that was 2.9.x. This part might be OK for R-devel (I don't know,
I am using the windows build service to check with R-devel, but have
no windows at hand to install the package).

But, anyway, R-devel check fails if there is a '#' in the
\preformatted section in all these situations:
- plain #
- escaped \#
- \latex{\sharp}{#}

Best,
Gabor

-- 
Gabor Csardi <Gabor.Csardi at unil.ch>     UNIL DGM




More information about the R-help mailing list