From mschwartz at mn.rr.com  Thu Apr 20 20:32:37 2006
From: mschwartz at mn.rr.com (Marc Schwartz (via MN))
Date: Thu, 20 Apr 2006 13:32:37 -0500
Subject: [Rd] R_PAPERSIZE and LC_PAPER
In-Reply-To: <Pine.LNX.4.64.0604201811480.28018@gannet.stats.ox.ac.uk>
References: <Pine.LNX.4.64.0604200758440.14307@gannet.stats.ox.ac.uk>
	<1145548335.4876.17.camel@localhost.localdomain>
	<Pine.LNX.4.64.0604201811480.28018@gannet.stats.ox.ac.uk>
Message-ID: <1145557958.4876.67.camel@localhost.localdomain>

Prof. Ripley,

Happy to help.

So, it sounds like we are thinking along the same lines then.

A couple of follow up questions:

1. Is R_PAPERSIZE_DEFAULT to be the proposed new compile time setting in
2.4.0? Unless I missed it, I did not see it documented anywhere (ie.
R-admin/NEWS for 2.2.1 patched or 2.3.0 devel) and it is not in the
configure related files that I have here.

2. For LC_ALL, it is not set (at least on my FC4 system, have not had
the time yet to go to FC5) in en_US.UTF-8. Is it set in other locales
such that it would be of value?


Thanks also for the pointer to the devel guidelines. I had read through
them at some point in the past, but it has been a while.

Regards,

Marc

On Thu, 2006-04-20 at 18:48 +0100, Prof Brian Ripley wrote:
> Marc,
> 
> Thanks for the comments.  The 2.3.x series is in feature freeze, and 
> although a few features do break though for patch releases, they had 
> better be `badly needed' see 
> http://developer.r-project.org/devel-guidelines.txt).
> 
> So I was thinking of 2.4.0.
> 
> My suggestion was going to be along the lines of
> 
> local({
> papersize <- as.vector(Sys.getenv("R_PAPERSIZE"))
> if(!nchar(papersize)) {
>      lcpaper <- Sys.getlocale("LC_PAPER")
>      if(nchar(lcpaper))
>          papersize <- if(length(grep(, lcpaper)) > 0) "letter" else "a4"
>      else papersize <- as.vector(Sys.getenv("R_PAPERSIZE_DEFAULT"))
> }
> options(papersize = papersize)
> })
> 
> This is unchanged if LC_PAPER is unset.  For those with LC_PAPER set,
> its value takes precedence over the compile-time default.  That's almost 
> exactly equivalent to what happens on Windows (which sets LC_MONETARY for 
> this purpose, as LC_PAPER is not a locale category there).
> 
> Now, one could argue that if LC_PAPER is unset it should default to 
> LC_ALL, but I think is less desirable.
> 
> Of course, at present Sys.getlocale("LC_PAPER") is not supported, so 
> that's part of the TODO.
> 
> Brian
> 
> 
> On Thu, 20 Apr 2006, Marc Schwartz (via MN) wrote:
> 
> > On Thu, 2006-04-20 at 08:09 +0100, Prof Brian Ripley wrote:
> >> R uses the environment variable R_PAPERSIZE to set its papersize, e.g. for
> >> postscript.
> >>
> >> It seems the modern way is to via LC_PAPER, e.g.
> >>
> >> http://mail.nl.linux.org/linux-utf8/2002-05/msg00010.html
> >>
> >> and Googling will show that people expect this to work.
> >>
> >> However, that is not set on my FC3 system, and it would affect people who
> >> use en_US as their locale in, say, Austria.
> >>
> >> Should we be making use of LC_PAPER, or would it just cause further
> >> complications?  (On Windows, the locale name is used to set the default
> >> papersize, but there it is unlikely to be set inappropriately.)
> >
> >
> > Here's my 0.0162 Euros (at current conversion rates):
> >
> > For R 2.4.0, announce that LC_PAPER will become the default environment
> > variable used to set the default R papersize and then not set
> > R_PAPERSIZE by default (ie. in build scripts, etc.)
> >
> > However, If someone sets R_PAPERSIZE in their site or local profile,
> > this will supercede the LC_PAPER setting. This would allow for a R
> > setting that may need to be different than the system default.
> >
> > Doing this for 2.4.0 (as opposed to 2.3.x) would give folks notice and
> > time to consider the impact on their local installations and code, while
> > enabling future users to take advantage of the standard.
> >
> > I think that in general, R should abide by published standards unless
> > there are very compelling reasons not to.
> >
> > HTH,
> >
> > Marc Schwartz
> >
> >
> >
>



[Rd] R_PAPERSIZE and LC_PAPER
Marc Schwartz (via MN