You are using UTF-8 and declaring latin1.  It is your use of UTF-8
that will have changed, not R.

On Mon, 31 Oct 2005, Luís Torgo wrote:

Dear R list,

I'm having some problems with font encodings when using R+Sweave+Latex in my
native language: Portuguese.

My environment:
Kubuntu 5.10 Linux
$> uname -a
Linux nassa 2.6.12-9-686 #1 Mon Oct 10 13:25:32 BST 2005 i686 GNU/Linux

R> R.version
        _
platform i486-pc-linux-gnu
arch     i486
os       linux-gnu
system   i486, linux-gnu
status
major    2
minor    1.1
year     2005
month    06
day      20
language R
R> Sys.getlocale()
[1]
"LC_CTYPE=pt_PT.utf-8;LC_NUMERIC=C;LC_TIME=pt_PT.utf-8;LC_COLLATE=pt_PT.utf-8;LC_MONETARY=pt_PT.utf-8;LC_MESSAGES=pt_PT.utf-8;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C"
R> localeToCharset()
[1] "ISO8859-1"


Here is a small example trying to replicate my problems:

File:exp.Rnw
================================
\documentclass[10pt,twoside]{article}
\usepackage[dvips]{graphicx}
\usepackage[portuges]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}

\begin{document}

\section{Introdução}

Isto é uma experiência.

\begin{figure}[b]
\centering
<<echo=false,fig=true,width=10,height=10>>=
barras(1)
@
\caption{Distribuição dos valores percentuais.}
\label{fig:idade}
\end{figure}

\end{document}
=================================

The problem occurs when I Sweave this file using the command:
R> Sweave('exp.Rnw')

The generated exp.tex file gets these contents:
=================================
\documentclass[10pt,twoside]{article}
\usepackage[dvips]{graphicx}
\usepackage[portuges]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{/usr/lib/R/share/texmf/Sweave}
\begin{document}

\section{Introdução}

Isto é uma experiência.

\begin{figure}[b]
\centering
\includegraphics{exp-001}
\caption{Distribuição dos valores percentuais.}
\label{fig:idade}
\end{figure}

\end{document}
=================================

All Portuguese  characters were "spoiled".  So apparently the Sweave function
is "translating" my original font encoding

I suspect that this is a problem related to the recent internationalization
changes in R, as this same file/process was previously (around a year ago I
think) working correctly for me.

I've read several documentation on these internationalization issues in R and
browsed the mailing list. As a result, because initially I didn't have R
working with the pt_PT.utf-8 locale, I've installed the PT language support
package for my OS, expecting that this would solve the "problem".  Apparently
I'm missing something else, so I wonder if someone could give me a hint on
how to solve this.

Thanks,
Luis Torgo

--
Luis Torgo
   FEP/LIACC, University of Porto   Phone : (+351) 22 339 20 93
   Machine Learning Group           Fax   : (+351) 22 339 20 99
   R. de Ceuta, 118, 6o             email : [EMAIL PROTECTED]
   4050-190 PORTO - PORTUGAL        WWW   : http://www.liacc.up.pt/~ltorgo

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


--
Brian D. Ripley,                  [EMAIL PROTECTED]
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
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to