Thanks Thierry, that indeed was the problem. I am not sure who to advise to correct the documentation in Writing R Extensions though because I was following the instructions there:
"... the encoding may be declared using a comment like %!\VignetteEncoding{UTF-8} If the encoding is UTF-8, this can also be declared using the declaration %!\SweaveUTF8" The same instruction appears in all the versions of WRE that I checked, HTML and PDF, R-release, R-patched and R-devel. I have copied in Duncan and Martin in the expectation they might ensure a correction. David On 31/01/2017 4:10 a.m., Thierry Onkelinx wrote: > Dear David, > > Have you tried removing the exclamation mark in > %!\VignetteEncoding{UTF-8}? I think it should be %\VignetteEncoding{UTF-8} > > Best regards, > > ir. Thierry Onkelinx > Instituut voor natuur- en bosonderzoek / Research Institute for Nature > and Forest > team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance > Kliniekstraat 25 > 1070 Anderlecht > Belgium > > To call in the statistician after the experiment is done may be no > more than asking him to perform a post-mortem examination: he may be > able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher > The plural of anecdote is not data. ~ Roger Brinner > The combination of some data and an aching desire for an answer does > not ensure that a reasonable answer can be extracted from a given body > of data. ~ John Tukey > > 2017-01-29 13:40 GMT+01:00 David Scott <d.sc...@auckland.ac.nz > <mailto:d.sc...@auckland.ac.nz>>: > > I am trying to add a vignette to xtable showing how to incorporate > some Chinese characters following an enquiry from a user. > > I can create the vignette satisfactorily just processing the knitr > file normally, with the resulting pdf displaying Chinese > characters in the R code and also as headings when I produce a > table. However when I try to build the package with the vignette > included, I get: > > * creating vignettes ...Warning: running command > '"C:/PROGRA~1/R/R-33~1.2/bin/x64/Rscript" --vanilla > ERROR > Error: Vignette 'ChineseCharacters.Rnw' is non-ASCII but has no > declared encoding > Execution halted > make: *** [build] Error 1 > > I updated R to 3.3.2 and Rtools to 33 before running the build. > > The vignette starts as follows: > > %\VignetteIndexEntry{xtable Chinese Characters} > %\VignetteDepends{xtable} > %\VignetteKeywords{LaTeX, HTML, table} > %\VignettePackage{xtable} > % !Rnw weave = knitr > % \VignetteEngine{knitr::knitr} > %!\VignetteEncoding{UTF-8} > > %************************************************************************** > \documentclass{ctexart} > \usepackage{longtable} > \usepackage{booktabs} > \usepackage{array} > \usepackage{hyperref} > \usepackage{inputenx} > > The section of the file which is not ASCII is: > > <<preparedata>>= > ### Prepare data > library(knitr) > library(xtable) > > tbl <- data.frame(positivePairs = 0, negativePairs = 0, > avePositiveSpread = NA, > aveNegativeSpread = NA, > PnL = 435, sumPnL = 144358.7) > names(tbl) <- c("ÕýÏò¿ª²Ö", "¸ºÏò¿ª²Ö", "ÕýÏò¿ª²Öƽ¾ù¼Û²î", > "¸ºÏò¿ª²Öƽ¼Û¼Û²î", "µ±ÈÕËðÒæ", "ÀÛ¼ÆËðÒæ") > @ > > I am a bit of a novice at encodings, and know nothing about > Chinese characters so any advice is welcome. > > David Scott > > > > -- > _________________________________________________________________ > David Scott Department of Statistics > The University of Auckland, PB 92019 > Auckland 1142, NEW ZEALAND > Phone: +64 9 923 5055 <tel:%2B64%209%20923%205055>, or +64 9 373 > 7599 ext 85055 <tel:%2B64%209%20373%207599%20ext%2085055> > Email: d.sc...@auckland.ac.nz <mailto:d.sc...@auckland.ac.nz>, > Fax: +64 9 373 7018 <tel:%2B64%209%20373%207018> > > Volunteer Arena Manager: > Orienteering Sprint Final at University of Auckland > World Masters Games 2017 > > ______________________________________________ > R-package-devel@r-project.org > <mailto:R-package-devel@r-project.org> mailing list > https://stat.ethz.ch/mailman/listinfo/r-package-devel > <https://stat.ethz.ch/mailman/listinfo/r-package-devel> > > -- _________________________________________________________________ David Scott Department of Statistics The University of Auckland, PB 92019 Auckland 1142, NEW ZEALAND Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055 Email: d.sc...@auckland.ac.nz, Fax: +64 9 373 7018 Volunteer Arena Manager: Orienteering Sprint Final at University of Auckland World Masters Games 2017 [[alternative HTML version deleted]] ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel