Hi Xu, Thank you for your appreciation. I cannot advance anymore without any help from Lyx gurus. I think I have extracted all the information I can from the help docs. If I get any answer to my questions, I can construct a little bit smarter module but the one we have now is already usable. With some supplementary tricks from the sagetex documentation and through manual executions of the latex-sage-latex chain, it is possible to make a lot of computations.

I was also very agreeably surprised that this module can be used for conversion to HTML from LyX, with figures and all. I attach to this message the module in its actual stage and some instruction for making the conversion chain functional. I hope this would already help some of you. As soon as I have more information, I will try to complete the module file. Best regards, Murat 2011/10/31 Xu Wang <xuwang...@gmail.com> > Dear Murat, > > This is great! I have been waiting for something like this for a long > time. I also like the Sweave-like philosophy of this. It's more transparent > and reproducible. > > I am looking forward to the final release with much excitement. > > Thank you for your work! > > Best, > > Xu > > > On Mon, Oct 31, 2011 at 12:54 PM, Murat Yildizoglu <myi...@gmail.com>wrote: > >> Just another mail to correct a problem with the preceding Lyx file (see >> the new file attached, and the $ signs in ERT boxes, this is connected with >> the problem I describe below) and ask a question about insets again: >> >> What kind of Flex insets can be included in a math mode text? Is this >> possible at all? Especially in displayed equation where one would like to >> include results from SAge computations? >> I cannot write the following in math mode in Lyx, putting the left member >> in a displayed equation and the right member in a sagecode inset that would >> be converted to the expression I give (\sage{integral(x/(x^2+1),x,0,1)) >> \dfrac{\partial^{4}y}{\partial >> x^{4}}=\sage{integral(x/(x^2+1),x,0,1)} >> >> I meet two problems: >> 1/ I cannot insert a Flex:sagecommand inset in a displayed equation, Lyx >> just goes to the next line before inserting it... >> 2/ I cannot type the sagetex instruction (*sage{} ) by hand, because >> "x^2" in the right member must not be interpreted by LyX, since Sage will >> need it for its computation. >> >> I can of course type everything in an ERT, but this cannot be called >> "integration" can it? ;-) >> >> I have reread again the help document on layouts and insets, and I have >> checked the files that come in the layout folder of LyX, but cannot find >> any answer to my question. >> >> Sorry for bothering you again with my problems... I hope that Sage >> integration will interest other people... >> >> Murat >> >> I definitely need the help of a Lyx wizard who understands well the >> insets and their integration in Lyx/Latex... >> >> >> >> 2011/10/31 Murat Yildizoglu <myi...@gmail.com> >> >>> Just to show you the kind of niceties that such an integration can >>> bring, I send you two files. One is the Lyx source and the other one is the >>> final PDF. >>> In Lyx, I just click on the Preview button and wait a little bit to get >>> the final PDF that I show here, with results of the computations done by >>> Sage and converted back to Latex. >>> >>> The module isfar from perfect yet (this is the first module I am >>> creating), a better integration between the Latex output by Sage, and the >>> math mode in LyX would be implemented to have nice equations typeset with >>> equation numbers and what not. You can also see that the output of the >>> integral by Sage is not very beautiful... >>> >>> I will continue to work on this module, but it is already useful for me >>> and eliminates some regrets I feel ;-), since I have dropped Scientific >>> Workplace in favor of LyX. >>> >>> I hope that you will like this new possibilities. >>> >>> Best regards, >>> >>> Murat >>> >>> PS. Sage lives in: http://www.sagemath.org >>> >>> >>> -- >>> Prof. Murat Yildizoglu >>> >>> Université Montesquieu Bordeaux IV >>> GREThA (UMR CNRS 5113) >>> Avenue Léon Duguit >>> 33608 Pessac cedex >>> France >>> >>> yi...@u-bordeaux4.fr >>> >>> http://yildizoglu.info >>> >>> http://www.twitter.com/yildizoglu >>> >>> >> >> >> -- >> Prof. Murat Yildizoglu >> >> Université Montesquieu Bordeaux IV >> GREThA (UMR CNRS 5113) >> Avenue Léon Duguit >> 33608 Pessac cedex >> France >> >> yi...@u-bordeaux4.fr >> >> http://yildizoglu.info >> >> http://www.twitter.com/yildizoglu >> >> > -- Prof. Murat Yildizoglu Université Montesquieu Bordeaux IV GREThA (UMR CNRS 5113) Avenue Léon Duguit 33608 Pessac cedex France yi...@u-bordeaux4.fr h <http://myildi.e-jemed.org/>ttp://yildizoglu.info http://www.twitter.com/yildizoglu

The Sage module allows the use of the open source Sage mathematical platform for computations in Lyx (with results inserted in the final PDF file), in a somewhat similar way for R-project with the Sweave module. To be able to use it, you must have Sage installed on your computer and the "sage" command must be in the path. See : http://www.sagemath.org/ Sage speaks Latex and can interact with it through the sagetex.sty package. See: http://www.sagemath.org/doc/tutorial/sagetex.html#sec-sagetex INSTALLATION 0/ You must have a working Sage system on your computer and the sage command must be on the PATH (open a console and type sage and RETURN key to check it this is the case). 1/Add the sage.module in the layouts folder of your local LyX configuration (depends on the system). Start LyX and reconfigure it. You can now add the Sage module to a new document. This module provides - the environments: sageblock and sagesilent - the commands: \sage (to be used in-line) and \sageplot (as an environment, can be included in a Figure float) and it needs the sagetex.sty package to be available in your local Tex installation. Justfollow the instructions given in the documentation of this package, for example 2/ Add the following sections elements in the preferences file that lives in your personal lyx config folder (depends on the system) # FORMATS SECTION ########################## # \format "pdf10" "pdf" "PDF" "" "\"/Applications/_Editiontextes/Skim.app/Contents/MacOS/Skim\"" "" "document,vector,menu=export" \format "sage" "sage" "Sage" "" "" "" "document" \default_view_format pdf10 # # CONVERTERS SECTION ########################## # \converter "latex" "sage" "latex" "latex" \converter "sage" "pdf10" "compile-pdf-sage.sh $$b" "" 3/ You need a bash file for automatically running the .sage file and get the results in the final pdf file This compile-pdf-sage.sh should be on your path, with the following content: #!/bin/sh /Applications/_Recherche/Sage-4.7-OSX-64bit-10.6.app/Contents/Resources/sage/sage $1.sage pdflatex $1.tex exit 0 Otherwise, You can just convert your Lyx document to Sage and then go to the temporary folder and execute manually (pdf)latex mysagedoc.tex -> generates mysagedoc.sage sage mysagedoc.sage (pdf)latex mysagedoc.tex Remaining problems and questions: 1/ How to setup options for environments? Example: \sageplot[width=12cm]{plot(sin(x), 0, pi), axes=True} -> Bug fix by Richard 2/ How to insert Flex insets in math mode, in displayed equations? $\dfrac{\partial^{4}y}{\partial x^{4}}=\sage{integral(x/(x^2+1),x,0,1)}$ x^2 must not be interpreted by LyX in the second part of the equality, since Sage will need it for its computation. 3/ \sage{} does not automatically switch to the math mode. These insets must be inserted between two $ sign put in ERT boxes. Then, the problem remains for the displayed equations where one would like to include Sage results.

**
sage.module**

*Description:* Binary data