[Rd] Awkward escaping with five backslashes within \code{ } in new parse_Rd

Duncan Murdoch murdoch at stats.uwo.ca
Fri Aug 14 15:24:15 CEST 2009


On 8/14/2009 8:37 AM, Peter Ruckdeschel wrote:
> Dear R-devels,
> dear Duncan,
> 
> just to close this thread...
> 
>> Peter Ruckdeschel wrote:
>>> Hi R-devels,
>>>
>>> I noticed that you are working quite actively on the new Rd-parser
>>> and have made it the default renderer in R-2.10.0dev. So I would
>>> like to come back on an issue I have already raised on this list
>>> last November
>>>
>>> ("Two minor escaping issues using \preformatted{....} in Rd format")
>>>
>>> My setting has slightly changed as \preformatted, AFAICS is not
>>> supported within \describe environments, so I have switched to
>>> \code{} ...
>>>
>>> The issue is again the correct typesetting of
>>>
>>>
>>>             \\\\\%
>>>
>>> within a \code{}-tag.
>>>
>>> This sequence occurs within a string (hence valid R code) in the
>>> documentation to my CRAN package SweaveListingUtils.
>>>   
>> 
>> That's not valid R code within a string, because \% is not a valid escape.
>> 
> 
> This was indeed the issue.
> 
> Omitting the fifth backslash respectively solved it.
> 
> 
>> I think this is a case where you are not going to be able to find
>> something that is compatible with both the old and new systems.  If you
>> want to know how to get particular output in the new system, I'd be
>> happy to help:  just tell me exactly what you want.
>>> So far the new parser cannot swallow such sequences
>>> of 5 backslashes followed by a percent sign correctly, but rather
>>> still throws an error;
>>>
>>> as the former parser, it can digest it if I leave a space between the
>>> fourth and fifth backslash, but then also prints this space out what is
>>> not what I want.
>>>
>>> Now admittedly this is not an urgent question, but if you are
>>> working on the parser anyway, you might perhaps try to make my
>>> sequence digestible, too.
>> 
>> I need more information about what you want the output to look like, in
>> text, for example.  
> 
> In an offline mail, I had sent links to the corresponding .Rd files
> directly to Duncan, who then checked that the solution given
> produced parsed code as desired.
> 
>> Because the Rd format is so ornate, I need more than
>> just the particular string:  please send me the surrounding text, what
>> your intentions are, and a large payment in unmarked bills.  Or at least
>> the first two.
> 
> I think I now owe some bills to Duncan ;-)

It's okay.  Yesterday I came across a bug in the handling of backslashes 
in parse_Rd that didn't cause a lot of harm, but certainly caused 
confusing behaviour.

Duncan Murdoch



More information about the R-devel mailing list