# [R] Adding Latex to text

David Winsemius dwinsemius at comcast.net
Thu Feb 7 02:22:13 CET 2013

```On Feb 6, 2013, at 4:53 PM, Rolf Turner wrote:

>
> Perhaps you want to look at
>
>    ?plotmath
>
>    cheers,
>
>        Rolf Turner

Definitely ...  he _will_ want to look at ?plotmath, but there is a lot on that page and teh parts that explain the parsing of expressions were not at all clear to me in hte beginning. Some of us find it's better to learn from examples and since he has already constructed a perfectly fine one hten here's my effort at making it "work":

library(UsingR)
BagA = c(rep(10,6),rep(20,5), rep(30,4),rep(40,3),rep(50,2),60,70)
BagA
BagB = c(10, 20,rep(30,2),rep(40,3),rep(50,4),rep(60,5),rep(70,6))
BagB

par(mfrow = c(2, 1))
DOTplot(BagA)
abline(v=60,lwd=2,lty=2,col="red")
text(65,3, expression(alpha*"-->"), col=2)
abline(v=50, lwd=2, lty=2, col="blue")
text(57,5, "p-value------->", col="blue")
DOTplot(BagB)
abline(v=60,lwd=2,lty=2,col="red")
text(55,3, expression("<--"*beta), col=2)
par(mfrow = c(1, 1))

>
> On 02/07/2013 11:41 AM, David Arnold wrote:
>> Hi,
>>
>> I'd like to add "alpha" in latex code to my image. Any suggestions?
>>
>> library(UsingR)
>> BagA = c(rep(10,6),rep(20,5), rep(30,4),rep(40,3),rep(50,2),60,70)
>> BagA
>> BagB = c(10, 20,rep(30,2),rep(40,3),rep(50,4),rep(60,5),rep(70,6))
>> BagB
>>
>> par(mfrow = c(2, 1))
>> DOTplot(BagA)
>> abline(v=60,lwd=2,lty=2,col="red")
>> text(65,3, "alpha-->", col=2)
>> abline(v=50, lwd=2, lty=2, col="blue")
>> text(57,5, "p-value------->", col="blue")
>> DOTplot(BagB)
>> abline(v=60,lwd=2,lty=2,col="red")
>> text(55,3, "<--beta", col=2)
>> par(mfrow = c(1, 1))
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help