zemlys at gmail.com
2008-Oct-31 09:35 UTC
[Rd] Problems with Sweave and pdf.options(encoding="ISOLatin7") (PR#13234)
Hi, Sweave for some reason does not respect encoding setting in pdf.options. Everything is OK with ps.options. Thus when using non-default encoding for graphs, resulting graphics eps file is correct, but pdf file is not. Workaround is very simple, just use latex->dvips->ps2pdf chain to get the intended pdf document. I tried to find the explanation for this, but I did not find anything. If this is documented behaviour, I am sorry for the disturbance. After Sweaving the file below, pdflatex and latex->dvips->ps2pdf will produce different pdfs. The tex file compiled succesfully in Ubuntu 8.04, and TeXLive 2007. Sincerely yours, Vaidotas Zemlys test.Rnw file: \documentclass[a4paper]{article} \usepackage[utf8x]{inputenc} \usepackage[T1]{fontenc} \title{Problem with pdf.options} \author{Vaidotas Zemlys} \begin{document} \maketitle Note the Lithuanian letters in latex will not display correctly, you need additional package. This does not matter to R, since we use Unicode and pass the correct encoding. \begin{center} <<fig=TRUE,echo=TRUE>>pdf.options(enc="ISOLatin7") ps.options(enc="ISOLatin7") plot(rnorm(100),main="? ????????????????") @ \end{center} \end{document} --please do not edit the information below-- Version: platform = i486-pc-linux-gnu arch = i486 os = linux-gnu system = i486, linux-gnu status = major = 2 minor = 8.0 year = 2008 month = 10 day = 20 svn rev = 46754 language = R version.string = R version 2.8.0 (2008-10-20) Locale: LC_CTYPE=fr_FR.UTF-8 at euro;LC_NUMERIC=C;LC_TIME=fr_FR.UTF-8 at euro;LC_COLLATE=fr_FR.UTF-8 at euro;LC_MONETARY=C;LC_MESSAGES=fr_FR.UTF-8 at euro;LC_PAPER=fr_FR.UTF-8 at euro;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=fr_FR.UTF-8 at euro;LC_IDENTIFICATION=C Search Path: .GlobalEnv, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, package:methods, Autoloads, package:base
Prof Brian Ripley
2008-Nov-19 10:24 UTC
[Rd] (PR#13234) Problems with Sweave and pdf.options(encoding="ISOLatin7")
I can't actually check what happens since the message has been garbled en route to me. Can you please send what you intended using \uxxxx escapes so it is portable. (What I have is what appears to be UTF-8 re-encoded in UTF-8, things like c3 84 3f.) And can you also confirm that the example works correctly directly in pdf()? On Fri, 31 Oct 2008, zemlys at gmail.com wrote:> Hi, > > Sweave for some reason does not respect encoding setting in pdf.options.Rather it uses its own setting. I think you need to set option pdf.encoding="ISOLatin7" on the Sweave call. It would probably be better if Sweave() fetched the default for options$pdf.encoding from pdf.options(), and definitely that this was documented.> Everything is OK with ps.options. Thus when using non-default encoding > for graphs, resulting graphics eps file is correct, but pdf file is > not. Workaround is very simple, just use latex->dvips->ps2pdf chain to > get the intended pdf document. I tried to find the explanation for this, > but I did not find anything. If this is documented behaviour, I am sorry > for the disturbance. > > After Sweaving the file below, pdflatex and latex->dvips->ps2pdf will > produce different pdfs. The tex file compiled succesfully in Ubuntu > 8.04, and TeXLive 2007. > > Sincerely yours, > > Vaidotas Zemlys > > test.Rnw file: > > \documentclass[a4paper]{article} > \usepackage[utf8x]{inputenc} > \usepackage[T1]{fontenc} > > \title{Problem with pdf.options} > \author{Vaidotas Zemlys} > > \begin{document} > \maketitle > > Note the Lithuanian letters in latex will not display correctly, you > need > additional package. This does not matter to R, since we use Unicode and > pass the > correct encoding. > > \begin{center} > <<fig=TRUE,echo=TRUE>>> pdf.options(enc="ISOLatin7") > ps.options(enc="ISOLatin7") > plot(rnorm(100),main="??????????????????") > @ > \end{center} > > \end{document} > > > > > --please do not edit the information below-- > > Version: > platform = i486-pc-linux-gnu > arch = i486 > os = linux-gnu > system = i486, linux-gnu > status > major = 2 > minor = 8.0 > year = 2008 > month = 10 > day = 20 > svn rev = 46754 > language = R > version.string = R version 2.8.0 (2008-10-20) > > Locale: > LC_CTYPE=fr_FR.UTF-8 at euro;LC_NUMERIC=C;LC_TIME=fr_FR.UTF-8 at euro;LC_COLLATE=fr_FR.UTF-8 at euro;LC_MONETARY=C;LC_MESSAGES=fr_FR.UTF-8 at euro;LC_PAPER=fr_FR.UTF-8 at euro;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=fr_FR.UTF-8 at euro;LC_IDENTIFICATION=C > > Search Path: > .GlobalEnv, package:stats, package:graphics, package:grDevices, > package:utils, package:datasets, package:methods, Autoloads, > package:base > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Reasonably Related Threads
- features of save and save.image (unexpected file sizes)
- shared-mime-info (PR#8278)
- r-cran-rjava dependencies on debian jesse, library(rJava) fails when default-jre is missing
- r-cran-rjava dependencies on debian jesse, library(rJava) fails when default-jre is missing
- Using R --gui=GNOME