![]() ![]() define the literate programming environment in LyX (literate-scrap.inc) and corresponding layouts.put the LaTeX style files such as Sweave.sty under the texmf tree.To make LyX work with Sweave, we need to take these steps: Later I’ll explain how to connect LyX and R/pgfSweave in this way. R can accept a string in its -e argument, e.g. Instead, I use this way: R -q -e "library(pgfSweave) pgfSweave('yourfile.Rnw')" ![]() I’m not using this approach in LyX, because this requires system admin privilege to install pgfSweave. PgfSweave comes with a command line usage like Sweave: R CMD pgfSweave your-file.Rnw. In pgfSweave, we just set the width and height naturally in the code chunk options like >=. There might be some text editors which can automatically do this tedious task, but the more serious problem is I cannot see the whole picture - in my eyes there are only commands my imagination is limited - it is difficult for me to imagine \section. For example, I hate typing \item in an itemize environment each time I need a new item. In the past, I did not like writing LaTeX documents just because I hate wasting my time on typing the raw commands. (I don’t want to comment more about Microsoft Word here.) LyX is a somewhat WYSIWYG tool based on LaTeX, and on the first time I saw it I decided that Word was completely useless to me from then on. I use command-line tools a lot every day, but I am still “GUI-addicted”. Gregor Gorjanc published an interesting article “Using Sweave with LyX” in R News in 2008, which (I believe) makes it much easier to use Sweave. This works for MikTeX under Windows (Server 2003 / Win7), and TeXLive 2009 under Ubuntu 10.10, MacTeX 2010 under Mac OS R 2.12.0 or 2.11.1 LyX 1.6.x. Take a look at this video if you feel confused. restart LyX as instructed, and you can enjoy pgfSweave in LyX now - either play with my demo (click to download), or DIY: create a new document, change the document class to article (Sweave noweb) from Document –> Settings, switch the environment to Scrap from the top-left drop list, start your Sweave code chunks click the PDF button to compile this document.run source('') in R under Windows or Ubuntu or Mac I tried my best to automatically configure LaTeX, R and LyX.install LyX and R as well as a working LaTeX toolkit such as MikTeX or TeXLive or MacTeX.Take a look at the video in this entry if you don’t understand the title. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |