[Rd] R_PAPERSIZE and LC_PAPER

Marc Schwartz MSchwartz at mn.rr.com
Fri Apr 21 06:05:39 CEST 2006


On Thu, 2006-04-20 at 20:56 +0100, Prof Brian Ripley wrote:
> On Thu, 20 Apr 2006, Marc Schwartz (via MN) wrote:
> 
> > Roger,
> >
> > Thanks.
> >
> > Yes, this I know. In fact I have a line in my shell script for building
> > R[-patched]:
> >
> >  ./configure R_PAPERSIZE=letter
> >
> >
> > R_PAPERSIZE is document in several places, however R_PAPERSIZE_DEFAULT
> > is not, unless I am going blind in my middle age...  :-)
> 
> It does not exist in any system at present (not even mine): just an idea 
> in my head to represent the default found at configure time.
> 
> In some sense LC_PAPER is set on FC3:
> 
> gannet% locale -ck LC_PAPER
> LC_PAPER
> height=297
> width=210
> paper-codeset="ISO-8859-1"
> 
> and it is unsupported on Solaris 8.  And
> 
> > Sys.getlocale("LC_PAPER")
> [1] "en_GB"
> 
> in the system I am prototyping just now.
> 
> Brian


OK...so as I surmised below, R_PAPERSIZE_DEFAULT is part of the proposed
change. Makes sense.

BTW, on my FC4 system:

$ locale -ck LC_PAPER
LC_PAPER
height=279
width=216
paper-codeset="UTF-8"


However, as I note below LC_ALL is unset:

$ locale -ck LC_ALL
$


Googling seems to be somewhat inconclusive as to the default use of
LC_ALL, but it is clearly used/set in some locales and by some
applications.

However, the official POSIX definition is:

LC_ALL
        This variable shall determine the values for all locale
        categories. The value of the LC_ALL environment variable has
        precedence over any of the other environment variables starting
        with LC_ ( LC_COLLATE , LC_CTYPE , LC_MESSAGES , LC_MONETARY ,
        LC_NUMERIC , LC_TIME ) and the LANG environment variable.
        
Consistent with some comments that I found, it seems to suggest that
LC_ALL can serve as something of an override relative to the other LC_*
variables.

This position would support an argument that if set, it would override
the logic below as a system default, perhaps and unless R_PAPERSIZE is
set in the site or user profile.

Thus, a possible hierarchy of precedence from high to low might be:

R_PAPERSIZE
LC_ALL
LC_PAPER
R_PAPERSIZE_DEFAULT


Thoughts?

Regards,

Marc

> > On Thu, 2006-04-20 at 14:44 -0400, Roger D. Peng wrote:
> >> Papersize can be set at compile time in the 'config.site' file (R_PAPERSIZE).
> >>
> >> -roger
> >>
> >> Marc Schwartz (via MN) wrote:
> >>> 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

<SNIP>



More information about the R-devel mailing list