Skip to content

Latex symbols in R (\perp and \parallel)

4 messages · Lorenzo Isella, Dieter Menne, Ben Bolker

#
Dear All,
I am sure this is a one-liner, but I cannot find the R command to
generate the LaTex symbols \perp and \parallel. Consider for instance
the figure
(one can use any kind of data for the plot)

pdf("friction_linear_chain_perpendicular.pdf")

par( mar = c(4.5,5, 2, 1) + 0.1)

plot(data[ ,1], data[
,4],col="blue",lwd=1.5,lty=1,pch=5,ylab=expression(""*beta[n]^{perpendicular}/beta[1]*""),
xlab=expression(""*n*"")
     ,cex.axis=1.4,cex.lab=1.6)
lines(x,beta_perp(as.list(coef(nls.out)), x), col="black", lwd=2)
dev.off()

Greek letters are understood on the spot, but this is not the case for
the perpendicular symbol in LaTex.
Does anyone know where I can find a list of LaTex symbols translated for R?
Many thanks

Lorenzo
#
Lorenzo Isella wrote:
As often, the most helpful "how-to" resource is by Prof. Brian Ripley

http://markmail.org/thread/kauzftprydrhqq5m

if you manage to get around the many lines telling me that I am an idiot.
What works depends on your system. Mine is Windows.

plot(1:5, type="n") 
#http://www.fileformat.info/info/unicode/char/27c2/index.htm
text(1,1, "\u27C2") # does not work for me
#http://www.stat.auckland.ac.nz/~paul/R/CM/AdobeSym.html
text(2,2, "\u22a5") # not for me
text(3,3, "\x5e",font=5) # works for me

Please simplify your examples and make them self-running next time.


Dieter
#
Lorenzo Isella wrote:
I took Dieter Menne's and Brian Ripley's examples, extended them slightly
with Hershey
font analogues, and posted the results at

http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:symbols

I couldn't find the "parallel" symbol in font 5 anywhere.  I tried
to create a table of the contents of font 5 (R code below), but
none of the permutations I tried worked ...

z <- expand.grid(0:16,0:15)
ch <- sapply(z[,1]+16*z[,2],function(x)
             format(as.hexmode(x),zero.print=TRUE))
d <- data.frame(z,ch)
d <- d[c(-1,-272),]
plot(d[,1],d[,2],type="n")
text(d[,1],d[,2],paste("\x",d[,3],sep=""),font=5)
#
Lorenzo Isella wrote:
I took Dieter Menne's and Brian Ripley's examples, extended them slightly
with Hershey
font analogues, and posted the results at

http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:symbols

I couldn't find the "parallel" symbol in font 5 anywhere.  I tried
to create a table of the contents of font 5 (R code below), but
none of the permutations I tried worked ...

z <- expand.grid(0:16,0:15)
ch <- sapply(z[,1]+16*z[,2],function(x)
             format(as.hexmode(x),zero.print=TRUE))
d <- data.frame(z,ch)
d <- d[c(-1,-272),]
plot(d[,1],d[,2],type="n")
text(d[,1],d[,2],paste("\x",d[,3],sep=""),font=5)