[R] Label using equivalent of \mathbb{R}

Martin Maechler maechler at stat.math.ethz.ch
Thu Aug 26 18:41:04 CEST 2004

>>>>> "Simon" == Simon Cullen <cullens at tcd.ie>
>>>>>     on Thu, 26 Aug 2004 15:30:06 +0100 writes:

    Simon> On Thu, 26 Aug 2004 15:24:33 +0200, Trenkler,
    Simon> Dietrich <dtrenkler at nts6.oec.uni-osnabrueck.de>
    Simon> wrote:

    >> [Dietrich Trenkler]
    >> >
    >> plot(rnorm(10),xlab=expression(bold(x)),ylab=expression(bold(y)))

    Simon> Not quite what I am looking for, I'm afraid. \mathbb
    Simon> gives "blackboard" fonts - the capitals with two
    Simon> vertical parallel lines in them that are used for the
    Simon> Reals, Complex numbers etc.

yes (and Dieter confused \mathbb{} with \mathbf{}).

R's builtin plotmath utilities can't do this directly.
A workaround would be similar to what we used to do in LaTeX 2.09
times (before \mathbb{} was standardly available):

      { "I", <negative space>, "R" }

Whereas with (La)TeX, a macro definition was relatively
easy for the above, it might be a bit harder / more ugly with
current R builtins, for one because I don't think ``plotmath''
has a concept of <negative space>.
1)  A really ugly hack would work with  text() -- not quite useful
   if you'd like these in 'xlab' etc.

2)  A potentially much nicer scheme might be to use  "grid" instead of
   oldstyle  "graphics" :  There one could construct a  "grob"
   (graphical object) for the '|R' symbol that one could should be
   pass to other functions -- though it may need some tweaking
   before a function like (pkg lattice's) xyplot() would accept
   a grob for xlab [instead of only a character or expression].

Well, Paul & Deepayan ?

Martin Maechler

More information about the R-help mailing list