[R] French accents on characters

Steven McKinney smckinney at bccrc.ca
Wed Aug 4 22:58:04 CEST 2010


In addition to the reply from Duncan Murdoch,

help("text")
and
demo("Hershey")

are very informative in this regard.

Simple example with plot for added text:

plot(1,1)
text(0.8, 0.8, "B\\`ad Fr\\'ench", vfont=c("serif", "plain"))
title(main = "B\u{E0}d Fr\u{E9}nch")




>From the help page for plotmath in package grDevices, see this
example (to which I added two additional entries for
a_grave and a_acute) for added text:

> plot.new(); plot.window(c(0,4), c(15,1))
> text(1, 1, "universal", adj=0); text(2.5, 1,  "\\042")
> text(3, 1, expression(symbol("\042")))
> text(1, 2, "existential", adj=0); text(2.5, 2,  "\\044")
> text(3, 2, expression(symbol("\044")))
> text(1, 3, "suchthat", adj=0); text(2.5, 3,  "\\047")
> text(3, 3, expression(symbol("\047")))
> text(1, 4, "therefore", adj=0); text(2.5, 4,  "\\134")
> text(3, 4, expression(symbol("\134")))
> text(1, 5, "perpendicular", adj=0); text(2.5, 5,  "\\136")
> text(3, 5, expression(symbol("\136")))
> text(1, 6, "circlemultiply", adj=0); text(2.5, 6,  "\\304")
> text(3, 6, expression(symbol("\304")))
> text(1, 7, "circleplus", adj=0); text(2.5, 7,  "\\305")
> text(3, 7, expression(symbol("\305")))
> text(1, 8, "emptyset", adj=0); text(2.5, 8,  "\\306")
> text(3, 8, expression(symbol("\306")))
> text(1, 9, "angle", adj=0); text(2.5, 9,  "\\320")
> text(3, 9, expression(symbol("\320")))
> text(1, 10, "leftangle", adj=0); text(2.5, 10,  "\\341")
> text(3, 10, expression(symbol("\341")))
> text(1, 11, "rightangle", adj=0); text(2.5, 11,  "\\361")
> text(3, 11, expression(symbol("\361")))
> text(1, 12, "a_grave", adj=0); text(2.5, 12,  "\\'a")
> text(3, 12, "\\'a", vfont=c("serif", "plain"))
> text(1, 13, "a_acute", adj=0); text(2.5, 13,  "\\`a")
> text(3, 13, "\\`a", vfont=c("serif", "plain"))
> 

Run 
> demo("Hershey")
and look at the functions defined at the beginning of the demo
for more examples of writing commands to get these accented
letters and other glyphs into plots.


http://www.unicode.org/charts/
has useful information on unicode values for all kinds
of alphabets.  e.g. Click on the "Latin-1 Supplements" link
(URL is:  http://www.unicode.org/charts/PDF/U0080.pdf)
to get a PDF with unicode values as used above
(e.g. \u{E0} for a-aigu).


HTH


Steven McKinney

Statistician
Molecular Oncology and Breast Cancer Program
British Columbia Cancer Research Centre



________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of Jennifer Young [Jennifer.Young at math.mcmaster.ca]
Sent: August 4, 2010 12:40 PM
To: r-help at r-project.org
Subject: [R] French accents on characters

Hello

Could someone please direct me to the correct commands for adding accents
(grave and aigu) to a letter in a plot title, label, or in added text? I'm
sure there's a handy list somewhere, but I've failed in coming up with the
correct search words to find it.

Thank you muchly!
Jen

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list