[R] Sweave UFT8 problem

Prof. Dr. Matthias Kohl Matthias.Kohl at stamats.de
Sun Apr 15 11:51:17 CEST 2012


try:
Sweave("sim_pi.Rnw", encoding = "utf8")

Best,
Matthias

On 15.04.2012 11:41, Philippe Grosjean wrote:
> Hello,
>
> Have you tried to put that command in a comment:
>
> %\usepackage[utf8]{inputenc}
>
> I haven't tested it in this particular case, but it works in some other
> situations.
> Best,
>
> Philippe
>
> ..............................................<¡}))><........
> ) ) ) ) )
> ( ( ( ( ( Prof. Philippe Grosjean
> ) ) ) ) )
> ( ( ( ( ( Numerical Ecology of Aquatic Systems
> ) ) ) ) ) Mons University, Belgium
> ( ( ( ( (
> ..............................................................
>
> On 14/04/12 22:37, Mark Heckmann wrote:
>> Hi,
>>
>> I work on MacOS, trying to Sweave an UFT8 document.
>> AFAI remember R 2.14 used to render a warning when the encoding was not
>> declared when using Sweave.
>> With R 2.15 it seems to render an error.
>>
>> Sweave("sim_pi.Rnw")
>> Error: 'sim_pi.Rnw' is not ASCII and does not declare an encoding
>>
>> Declaring an encoding by adding a line like
>>
>> \usepackage[utf8]{inputenc}
>>
>> in the preamble does the job. In my case though the .Rnw document does no
>> have a preamble as it is just one chapter.
>> All chapters are Sweaved separately (due to computation time). Hence I
>> cannot inject the above line as LaTex will cause an error afterwards.
>> (usepackage{} is only allowed in the preamble which only appears once in
>> the main document, not in each chapter).
>>
>> How can I get around this not using the terminal for Sweaving, like e.g.
>> R CMD Sweave --encoding=utf-8 sim_pi.Rnw ?
>>
>> Thanks
>> Mark
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Prof. Dr. Matthias Kohl
www.stamats.de



More information about the R-help mailing list