LyXGreek letters, R code, and sweave

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
mark_connolly
Posts: 2
Joined: Sun Oct 25, 2009 8:13 pm

Greek letters, R code, and sweave

Post by mark_connolly »

In R command line, I can open a cairo_pdf device and have names in a data frame that begin with Greek letters nicely rendered in the pdf file. When I try the same sort of thing in a Lyx document, the sweave pdf generation fails.

Is there a way to use greek letters within ERT in Lyx?

An example of code that fails (as TeX ERT code) follows. With no greek letters, much the same code works just fine but is not nearly as pretty. In R command line I would sandwich the print(...) command in

Code: Select all

cairo_pdf(file="ksat.pdf")
print(...)
dev.off()
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

and get a nice PDF.

Bad code

Code: Select all

require("lattice")
ksat <- data.frame( cbind( c(2.5, 7.5, 17.5), c(15,10,0), c(2.5,4,0), c(17.5,14,0)))
names(ksat) <- c("depth", "Ψg", "Ψp", "Ψt")
print(
xyplot(-depth~Ψg+Ψp+Ψt,
type="b",
data=ksat,
pch=plotchars,
col=plotcolors,
panel = function(...){
x_off <- 0.0
pos_adj <-c(-0.1,1.2)
text_col <- "darkolivegreen"
panel.abline(h=-2.5, col="grey")
panel.text("A @ -2.5 cm", x=x_off, y=-2.5, adj=pos_adj,
col=text_col)
panel.text("Ks=10cm/hr", x=x_off, y=-5, adj=pos_adj,
col=text_col)
panel.abline(h=-7.5, col="grey")
panel.text("B @ -7.5 cm", x=x_off, y=-7.5, adj=pos_adj,
col=text_col)
panel.text("Ks=5cm/hr", x=x_off, y=-12, adj=pos_adj,
col=text_col)
panel.abline(h=-17.5, col="grey")
panel.text("C @ -17.5", x=x_off, y=-17.5, adj=pos_adj,
col=text_col)
panel.xyplot(...)
},
key=list(
text=list(names(ksat)[2:4]),
points=list(pch=plotchars, col=plotcolors),
x=0.6,y=0.2,corner=c(0,0)
)
)
)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

mark_connolly
Posts: 2
Joined: Sun Oct 25, 2009 8:13 pm

Re: Greek letters, R code, and sweave

Post by mark_connolly »

Hmmm... I think UTF support in Lyx is a scam. After reading about utf8, utf8x, setting document language encoding, etc, and trying a myriad of combinations, nothing seems to work on Linux or Windows. I guess I am stuck spelling things out. Maybe some future version will just work.
Post Reply