I have been trying to find an Sweave →LATEX → HTML pathway that works via knitr …
I think I can get it to work now, although it’s not as pretty as I’d like. The bottom line is that to get this working you need to
where (of course) $* is the basename of your document (this line is from a Makefile)
## normally also include=FALSE
render_listings()
(An equation)
| (1) |
Some code:
## here’s a comment ...
(x ← 5∧2)
[1] 25
y ← 17
A figure:
set.seed(101)
plot(rnorm(10), rnorm(10))
Inline R expression: the value of x is 25.
Session info:
sessionInfo()
R Under development (unstable) (2012-07-27 r60013)
Platform: i686-pc-linux-gnu (32-bit)
locale:
[1] LC_CTYPE=en_CA.utf8 LC_NUMERIC=C
[3] LC_TIME=en_CA.utf8 LC_COLLATE=en_CA.utf8
[5] LC_MONETARY=en_CA.utf8 LC_MESSAGES=en_CA.utf8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_CA.utf8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets base
other attached packages:
[1] knitr_0.8
loaded via a namespace (and not attached):
[1] digest_0.5.2 evaluate_0.4.2 formatR_0.6 plyr_1.7.1
[5] stringr_0.6 tools_2.16.0
latexml is an alternative conversion program that I haven’t managed to get working equally well …
system(”latexml --dest=’knitr_listings_test.xml’ knitr_listings_test.tex”)
system(”latexmlpost --dest=’knitr_listings_test.xhtml’ knitr_listings_test.xml”)