Bug 14989 - Wishlist: Support more Unicode characters in R CMD Rd2pdf (patch)
Wishlist: Support more Unicode characters in R CMD Rd2pdf (patch)
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Wishlist
R-devel (trunk)
All All
: P5 enhancement
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-12 22:13 UTC by Mikko Korpela
Modified: 2012-07-13 09:00 UTC (History)
0 users

See Also:


Attachments
Patch to implement this wishlist item (2.30 KB, patch)
2012-07-12 22:13 UTC, Mikko Korpela
Details | Diff
Test case (2.38 KB, application/x-gzip)
2012-07-12 22:14 UTC, Mikko Korpela
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikko Korpela 2012-07-12 22:13:48 UTC
Created attachment 1336 [details]
Patch to implement this wishlist item

Overview:
When using R CMD Rd2pdf, it is possible to set environment variable RD2PDF_INPUTENC to value "inputenx" and enjoy better support for UTF-8 characters (see ?Rd2pdf). This enables LaTeX package "inputenx" instead of "inputenc".

Even better support for UTF-8 encoded characters can be had by making R CMD Rd2pdf insert a line to its temporary .tex file: "\input{ix-utf8enc.dfu}". The instructions are found in section 1.2 "Unicode" of the inputenx manual: http://mirror.ctan.org/macros/latex/contrib/oberdiek/inputenx.pdf 

I suggest that R CMD Rd2pdf automatically insert
"\IfFileExists{ix-utf8enc.dfu}{\input{ix-utf8enc.dfu}}{}"
to its temporary .tex file when a combination of inputenx and UTF-8 is detected. The attached small patch does that.

Steps to Reproduce:
1. Unpack attached tarball
2. Run R CMD Rd2pdf on the resulting directory with environment variable RD2PDF_INPUTENC set to value "inputenx"

Actual Results:
An error is produced: "Unicode char X not set up for use with LaTeX". In the example case, X is the character called "LATIN SMALL LETTER E WITH DOT ABOVE".

Expected Results:
A PDF file is produced. After applying the patch, this is achieved.

Build Date & Platform:
R development version r59788 on Ubuntu 10.10 64 bit

Additional Builds and Platforms:
The patch is expected to be valid for all platforms. Only tested on the stated build and platform, though.

Additional Information:
A first version of the patch was posted to the R-devel mailing list. This is a new version in which \IfFileExists is used as requested by Prof. Ripley in https://stat.ethz.ch/pipermail/r-devel/2012-July/064403.html
Comment 1 Mikko Korpela 2012-07-12 22:14:45 UTC
Created attachment 1337 [details]
Test case
Comment 2 Brian Ripley 2012-07-13 09:00:14 UTC
In R-patched and R-devel