I have the following Sweave file which gets sweaved correctly.

<<>>=
m <- lm(y1 ~x1, anscombe)
summary(m)
@ 

I include the sweaved .tex file into another .tex file via include.
When I use a single umlaut in the .snw file a warning occurs.
As a result part of the summary output is not contained in the .tex file.

ä
<<>>=
m <- lm(y1 ~x1, anscombe)
summary(m)
@   

You can now run (pdf)latex on 'ch1.tex'
Warnmeldungen:
1: ‘ch1.Snw’ has unknown encoding: assuming Latin-1 
2: ungültige Zeichenkette in Konvertierung der Ausgabe (wrong character in 
conversion of output)

Interestingly, this error does NOT occur, when I omit the summary(m) statement.

ä
<<>>=
m <- lm(y1 ~x1, anscombe)
#summary(m)
@   

You can now run (pdf)latex on 'ch1.tex'
Warnmeldung:
‘ch1.Snw’ has unknown encoding: assuming Latin-1 

I know that I can prevent this by adding a line at the beginning of the .snw 
file:

\usepackage[utf8]{inputenc}

ä
<<>>=
m <- lm(y1 ~x1, anscombe)
summary(m)
@ 

This gets sweaved correctly without warnings:

But this solution is not good as it is not the preamble of the .tex document 
where I add the usepackage line.
This will cause an error when processing the entire document with tex.

How can I achieve the last result in another way?
I tried: 

Sweave('/Users/markheckmann/Desktop/test_sweave/ch1.Snw', encoding="UFT-8")

But this does not work either when the usepackage line is omitted.

I am stuck here. Can anyone help?

TIA 
Mark


––––––––––––––––––––––––––––––––––––
Mark Heckmann
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com











        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to