I believe this is because R uses sQuote() to print package versions which introduces curly quotes (non-ASCII characters).
> packageVersion('knitr') [1] ‘0.5’ Unfortunately sQuote() was hard-coded in the printing function, so there is no direct way to get rid of the two curly quotes, and you have to use as.character(), or packageDescription('knitr', fields='Version') > getAnywhere(print.numeric_version) A single object matching ‘print.numeric_version’ was found It was found in the following places package:base registered S3 method for print from namespace base namespace:base with value function (x, ...) { y <- as.character(x) if (!length(y)) writeLines(gettext("<0 elements>")) else print(noquote(ifelse(is.na(y), NA_character_, sQuote(y))), ...) invisible(x) } <bytecode: 0x1a26bf8> <environment: namespace:base> Regards, Yihui -- Yihui Xie <xieyi...@gmail.com> Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Sat, Jun 2, 2012 at 8:32 PM, Scott Kostyshak <skost...@princeton.edu> wrote: > From: Yihui Xie [xieyi...@gmail.com] > Sent: Saturday, June 02, 2012 8:04 PM > >>I cannot reproduce the problem. It compiles successfully with TeXLive >>2011 under Ubuntu. Can anyone else reproduce it? > > I am using Ubuntu (64-bit) 12.04 with TeXLive 2011 and pdflatex version: > scott@wws-1j1dnk1:~$ pdflatex --version > pdfTeX 3.1415926-2.3-1.40.12 (TeX Live 2011) > kpathsea version 6.0.1 > >>Does this happen to packageVersion() only? > > Also with packageDescription(). But I've compiled many knitr documents that > have used many packages and functions and this is the first time that I have > this problem. If I wrap packageVersion as follows then it works fine: > as.character(packageVersion('knitr')) > > Can you send me the .tex file that is produced when you export the .lyx file > I sent to latex (pdflatex)? If they are the same and it works for you then > the problem must be my pdflatex. If they are different then the problem is > something else. > > Thanks, > > Scott