Skip to content

Thin spaces

4 messages · Hadley Wickham, Brian Ripley

#
Hi all,

I'm looking at providing some nicer number formatting features for
axes in ggplot2.  One thing I would like to do is use thin spaces to
separate digits, like you can in latex.  I realise I can use unicode
spaces to do this (e.g.
http://www.cs.tut.fi/~jkorpela/chars/spaces.html), but what are the
possible pitfalls.  Is this likely to work on all graphics devices
across all platforms?

Thanks,

Hadley
#
On Sat, 11 Oct 2008, hadley wickham wrote:

            
Unlikely to work on most devices.

They are not supported in postscript() or pdf(): neither of their 
underlying languages support Unicode, so they are restricted to basically 
one human language.

windows(), quartz() and X11() support Unicode, but in the case of X11 the 
fonts are often pretty incomplete so you need to check on the target 
machine.  A quick check on windows() suggests \u2009 is not in the 
commonly used MS fonts (as your reference says).

All it needed was a very simple experiment to answer your question.  Hint: 
try

plot(1:10); text(4, 6, "1\u{2009}2")
#
On Sun, Oct 12, 2008 at 1:01 AM, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:
Thanks for the information.  I realise I could have tried the
experiment you described, but that would have only told me it didn't
work on the mac, and it wouldn't have told me if there was another way
to achieve the same effect.

I guess latex must vary the size of a standard space rather than using
a special unicode space.  This is probably not surprising given that
latex considerably predates unicode.

Thanks again for the help,

Hadley
#
On Sun, 12 Oct 2008, hadley wickham wrote:

            
Yes, latex (more precisely TeX) sets words separately (and when kerning is 
involved, parts of words), with 'space' being converted into glue between 
boxes.  Most other desktop-publishing programs do the same.