Andreas Karlsson <[EMAIL PROTECTED]> writes:
> Dear LyX developers,
> 
> Under the Edit > Math menu in LyX there is an entry Use Computer 
> Algebra System.

...

There is a way to use yacas from R via R package Ryacas [1] so it could 
be  possible to use this in LyX via Sweave (noweb like system using R 
as a  program and LaTeX for documentation). I tried this on my fresh 
Windows box:

1. Installed LyX 1.4.5 and dependencies

2. Installed R 2.5.1 
   http://cran.at.r-project.org/bin/windows/base/R-2.5.1-win32.exe

3. Installed Ryacas package (enables easy install of yacas)
   - started R
   - launched the following code from within R 

   install.packages('Ryacas', dep = TRUE)
   library(Ryacas)
   yacasInstall()

4. Tweaked my preferences file to

# FORMATS SECTION #############################
#

\format "literate" "Rnw" "Sweave"           "" "editor" "editor"
\format "r"        "R"   "R/S code"         "" "editor" "editor"
\format "latex"    "tex" "LaTeX (plain)"    "" "editor" "editor"
\format "pdflatex" "tex" "LaTeX (pdflatex)" "" "editor" "editor"

#
# CONVERTERS SECTION ##########################
#

\converter "literate" "r"        "R CMD Stangle $$i" ""
\converter "literate" "latex"    "R CMD Sweave $$i"  ""
\converter "literate" "pdflatex" "R CMD Sweave $$i"  ""

5. Copied contents of the following links to layouts subdirectory 
in user library (please note that each URL should be one line, but
gmane is limiting me to 80 chars per line)

http://r-ggorjan.svn.sourceforge.net/viewvc/*checkout*/r-ggorjan/
trunk/LyX-Sweave/literate-article.layout

http://r-ggorjan.svn.sourceforge.net/viewvc/*checkout*/r-ggorjan/
trunk/LyX-Sweave/literate-book.layout

http://r-ggorjan.svn.sourceforge.net/viewvc/*checkout*/r-ggorjan/
trunk/LyX-Sweave/literate-report.layout

http://r-ggorjan.svn.sourceforge.net/viewvc/*checkout*/r-ggorjan/
trunk/LyX-Sweave/literate-scrap.inc

6. Added R TeX stuff to search path

- added R subfolder in C:/*/MikTeX/tex/latex 

- copied contents from C:/*/R/R-2.5.1pat/share/texmf to 
  C:/*/MikTeX/tex/latex/R

- updated TeX database (MikTeX Settings --> Refresh FNDB)

- checked if TeX can find Sweave.sty- launch in the command tool 
  the following

findtexmf Sweave.sty

7. Start LyX and reconfigure

8. Created new document

- went to Document --> Settings menu and choose document class that 
  has (Sweave noweb) string beside

- started new environment scrap and typed the following (watchout, 
  you must use SHITF+ENTER for newline)
  
<<myFirstChunk>>=
1+1
@

- saved and previewed PDF to make sure that Sweave is working OK 
  within LyX

- added the following chunk of code to check Ryacas

<<ryacasChunk>>=
library(Ryacas)
exp1 <- yacas(expression(Factor(x^2 - 1)))
Eval(exp1, list(x = 4))
@

Voila!

[1] http://code.google.com/p/ryacas/

Reply via email to