[R] Sweavelistingutil: Encoding problems

Rasmus Pank Roulund rasmus.pank at gmail.com
Thu Sep 3 11:31:50 CEST 2009


Hello,

I am not sure whether this is a bug or lack of R experience.

However, I am using your Sweavelistingutil package, which is very
nice. Obviously I use it to create LaTeX files. These are encoded in
utf8.

However, when I use the Sweavelistingutil is uses some funky
character for "`" and "'" that is not recognized.

Here is an example from my tex-file:

,----
|   Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
`----

When comping this I get the following error:

,----
| ERROR: Package inputenc Error: Unicode char
| \u8:\lst at FillFixed@\lst at EC not set up
`----

There is /no problem/ when I the normal sweave-package.

The relevant part of my preamble looks like this:

,----
| \documentclass[a4paper]{scrartcl}
| \usepackage{scrpage2}
| \usepackage[english,danish]{babel}
| \usepackage[T1]{fontenc}
| \usepackage[utf8]{inputenc}
`----

And the "R-settings" looks like this (basically copied from the viginette):

,----
| %\usepackage[noae]{Sweave}
| \SweaveOpts{keep.source=TRUE}
| % -------------------------------------------------------------------------------
| <<SweaveListingsPreparations, results=tex, echo=FALSE>>=
| require(SweaveListingUtils)
| SweaveListingoptions(intermediate = FALSE)
| SweaveListingPreparations(ae = FALSE)
| setToBeDefinedPkgs(pkgs = c("SweaveListingUtils","distr"),
|                    keywordstyles = c("\\bf\\color{blue}","\\bf\\color{red}"))
| @Hello,

I am not sure whether this is a bug or lack of R experience.

However, I am using your Sweavelistingsutil package, which is very
nice. Obviously I use it to create LaTeX files. These are encoded in
utf8.

However, when I use the Sweavelistingsutil is uses some funky
character for "`" and "'" that is not recongnized.

Here is an example from my tex-file:

,----
|   Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
`----

When comping this I get the following error:

,----
| ERROR: Package inputenc Error: Unicode char
| \u8:\lst at FillFixed@\lst at EC not set up
`----

There is /no problem/ when I the normal sweave-package.

The relevant part of my preamble looks like this:

,----
| \documentclass[a4paper]{scrartcl}
| \usepackage{scrpage2}
| \usepackage[english,danish]{babel}
| \usepackage[T1]{fontenc}
| \usepackage[utf8]{inputenc}
`----

And the "R-settings" looks like this (basically copied from the viginette):

,----
| %\usepackage[noae]{Sweave}
| \SweaveOpts{keep.source=TRUE}
| % -------------------------------------------------------------------------------
| <<SweaveListingsPreparations, results=tex, echo=FALSE>>=
| require(SweaveListingUtils)
| SweaveListingoptions(intermediate = FALSE)
| SweaveListingPreparations(ae = FALSE)
| setToBeDefinedPkgs(pkgs = c("SweaveListingUtils","distr"),
|                    keywordstyles = c("\\bf\\color{blue}","\\bf\\color{red}"))
| @
| % -------------------------------------------------------------------------------
| \lstdefinestyle{TeXstyle}{fancyvrb=true,escapechar=`,language=[LaTeX]TeX,%
|                         basicstyle={\color{black}\small},%
|                         keywordstyle={\bf\color{black}},%
|
commentstyle={\color{Rcommentcolor}\ttfamily\itshape},%
|                         literate={<-}{<-}2{<<-}{<<-}2}
`----

I use TexLive 2008, R 2.9.1 and I have updated all packages. I use
Arch Linux, 32 bit.

Thanks,
Rasmus




More information about the R-help mailing list