2

I am unable to render maths notation inside a knitr chunk in Lyx although it renders fine using \Sexpr or in an ERT box while using Lyx 2.0.5 and knitr 1.1

The following code was adapted from the manual:

<<cars-demo,dev='svg',fig.width=4,fig.height=2.8,out.width='.45\\textwidth',message=TRUE,cache=TRUE>>=
fit=lm(dist~speed,data=cars) # linear regression
par(mar=c(4, 4, 1, .1), mgp=c(2,1,0))
with(cars,plot(speed,dist,panel.last=abline(fit)))
text(10,100,'$\alpha_{1}$+$\beta^{2}$')

The plot is fine but the text notation appears exactly as: $\alpha_{1}$+$\beta^{2}$

I cannot run tikz for some reason so the original dev = tikz had to be converted to svg.

Thanks in advance. Great combination Lyx and knitr.

4

0 回答 0