[R] Inserting superscripts in free-format text line

Peter Ehlers ehlers at ucalgary.ca
Tue Aug 21 19:39:58 CEST 2012


On 2012-08-21 08:28, Brian Kriegler wrote:
> All of these suggestions are great.  Let me add one other dimension.
>   Suppose I want to add curly quotations, italicize, underline, or bold
> some of the words.  I can get this to work:
>
> plot(-15:15,15:-15, pch=NA)
> text(x=0, y=5,
> expression(bold(This)~is~a~underline(test)^1~of~the~italic(Emergency)~Broadcast~System.))
>
>
>
> I can also get this to work:
>
>
> text(x=0, y=-5, dQuote("This is another test."))
>
> But, I've wrestled getting curly quotes to work within expression().
>
> Any suggestions are greatly appreciated.
>
> -Brian

[....]

Font issues can be system-dependent. The following works for me on Windows.

Insert unicode characters in the appropriate places. For example,
to place double quotes around the word 'Broadcast' in your
example above:

  text(0, 5, expression(....~"\u201c"*Broadcast*"\u201d"~System))

Don't forget the '*' to concatenate the quote symbols with the word.

Peter Ehlers




More information about the R-help mailing list