[Rd] Rd and guillemots

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Fri Sep 16 21:34:38 CEST 2005


On 16-Sep-05 Duncan Murdoch wrote:
> On 9/15/2005 7:51 PM, Mark.Bravington at csiro.au wrote:
>> First of all, thanks to those who've set up R to work so smoothly with
>> Miktex-- even a total Latex bunny like me got it to work instantly, so
>> that for the first time I'm able to run my Rd files through the Latex
>> side of RCMD CHECK.
>> 
>> Now the question/buglet. One of my Rd files contains the following:
>> 
>> \code{mlazy( <<objname1>>, <<objname2>>, <<etc>>)}
>> 
>> When I run the file through RCMD (either RCMD CHECK or Rcmd Rd2dvi
>> --pdf) the first << and >> are left alone, but the second and third
>> pairs are converted to single guillemot characters (i.e. European
>> quotation marks). This inconsistency seems a bit odd.
> 
> Yes, this is the tex that gets output:
> 
> \code{mlazy( <{}<objname1>{}>, <<objname2>>, <<etc>>)}
> 
> This seems to happen in Rdconv.pm, around here:
> 
>      ## avoid conversion to guillemots
>      $c =~ s/<</<\{\}</;
>      $c =~ s/>>/>\{\}>/;
> 
> 
> But I don't know enough Perl syntax to tell it to replace all << by 
> <{}<, instead of just the first.  (I would have guessed appending a g 
> would work, but didn't in a quick test, i.e. $c =~ s/<</<\{\}</g;
> didn't 
> work.)
> 
> Duncan Murdoch

Perl is overkill -- by a long way!

echo "{mlazy( <<objname1>>, <<objname2>>, <<etc>>)}" |
  sed 's/<</<{}</g;s/>>/>{}>/g'

{mlazy( <{}<objname1>{}>, <{}<objname2>{}>, <{}<etc>{}>)}

Cheers,
Ted.



--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 16-Sep-05                                       Time: 20:33:40
------------------------------ XFMail ------------------------------



More information about the R-devel mailing list