Re: [R] Sweave problem on Mac OS when using umlauts and summary()
I just noticed that the question has already been answered on the R-help list before: http://r.789695.n4.nabble.com/Sweave-font-problems-with-Signif-codes-lines-td977346.html Adding the following R line solves the problem: options(useFancyQuotes = FALSE) Mark > > > On Fri, Dec 2, 2011 at 4:08 PM, Mark Heckmann wrote: >> 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. >> 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.
Re: [R] Sweave problem on Mac OS when using umlauts and summary()
This problem comes up so frequently that I have made options(useFancyQuotes=FALSE) by default in my knitr package: http://yihui.github.com/knitr/ You can also use options(useFancyQuotes='TeX'). Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Fri, Dec 2, 2011 at 4:08 PM, Mark Heckmann wrote: > 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. > __ 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.
[R] Sweave problem on Mac OS when using umlauts and summary()
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.