[R] mtext formatting

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Jul 20 18:17:03 CEST 2007


On Fri, 20 Jul 2007, Todd Remund wrote:

> I am trying to create a formatted title using mtext.  Using the format
> function I define the spacing for a specific part of the text then paste
> these together, when I put this in mtext it does not keep the spacing I
> defined. Here is an example.
>
> x <- format(paste("X=", a), width=8)
> y <- format("F=G(x)", width=8)
>
> mtext(text=paste(x, y, sep=""), col="red", font=1)
>
> Does anyone have any suggestions to get the mtext to follow the formatting
> as it does with cat()?

It does for me: you are outputting in a proportionally spaced font which 
may be what is confusing you.  Try family = "mono" to check.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list