[R] Encoding of Sweave file error message
murdoch.duncan at gmail.com
Thu Apr 12 14:32:26 CEST 2012
On 12-04-12 12:13 AM, Duncan Mackay wrote:
> At 12:03 12/04/2012, you wrote:
>> I had the same problem! So, as I'm a linux user,
>> I prefer use linux terminal. On terminal I type this to compile
>> R CMD Sweave --encoding=utf-8 myfile.Rnw
>> and the compilation is successful. Try to set the encoding option in Sweave().
>> Walmes Marques Zeviani
>> LEG (Laboratório de Estatística e Geoinformação, 25.450418 S, 49.231759 W)
>> Departamento de Estatística - Universidade Federal do Paraná
>> fone: (+55) 41 3361 3573
>> VoIP: (3361 3600) 1053 1173
>> e-mail:<mailto:walmes at ufpr.br>walmes at ufpr.br
>> twitter: @walmeszeviani
>> linux user number: 531218
> Hi Walmes
> Thank you very much. That appears to be the problem.
> When I typed from the DOS terminal
> R CMD Sweave --encoding=utf-8 ParasiteComb12.Rnw
> it compiled the tex file without any error messages.
> I have not really got into font encoding and
> reading the Sweave manual I thought that what I had done would be sufficient.
> I found an old note which gave a reference to
> but that appears to be specific.
> The ?Sweave and the Sweave manual appear to be
> more specific about the latex side.
> After having a look at iconvlist() and bearing
> in mind Duncan Murdoch's comments about windows I tried
> encoding = "UTF-8")
> from the Rgui command window and compiled without any problems
> When I had a look at the tex file there were a
> few DOS Alt-248 (degree symbol ) within latex
> comments which were added last running R2.14 before updating
That doesn't sound like UTF-8 encoding, it sounds like Latin-1. So
declaring it to be UTF-8 will eventually cause you some problems, when
you put some of those characters in a place that LaTeX processes. You
can avoid the problem by putting this line in your Rnw file:
as the ?Sweave help page says. Or, just delete those non-ASCII
characters. There's a function in the tools package to detect them:
> Removing them and re running without the encoding
> argument brought things back to normal.
> I tried as a test
> but that appears not to work
> All I have to do now is to put the extra argument
> into my text editors clip library for Sweave for
> next time when I cannot solve things.
> Its been a long week !
> Duncan Mackay
> Department of Agronomy and Soil Science
> University of New England
> ARMIDALE NSW 2351
> Email home: mackay at northnet.com.au
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help