I have been trying to get a an Sweave →LATEX → HTML pathway that works via knitr …
(An equation)
![]() | (1) |
Some code:
## here’s a comment ...
(x ← 5∧2)
[1] 25
y ← 17
I prefer the native highlighting (as it comes out in the PDF format) to the render_listings version, but I could live with it …The assignment arrow <- inside the Sinput chunk confuses htlatex — have to hit s three times, once for each of three htlatex passes, to skip over errors — but seems to come out OK in the final document. Is there a fix to Sweavel.sty, or something else, that will make it work?
I have searched for how to use htlatex in error-skipping mode, but everything I can find says “don’t skip errors, fix them” …
A figure:
set.seed(101)
plot(rnorm(10), rnorm(10))
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.7
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
For htlatex: use usepackage{graphicx} and DeclareGraphicsExtension{.pdf} in the preamble of the document.
htlatex [filename] myhtml
Here is the myhtml.cfg file I’m using:
latexml is an alternative conversion program that doesn’t seem to work as well, at the moment …
system(”latexml --dest=’knitr_listings_test.xml’ knitr_listings_test.tex”)
system(”latexmlpost --dest=’knitr_listings_test.xhtml’ knitr_listings_test.xml”)