On 05/29/2014 05:34 PM, Alex Vergara Gil wrote:

    *From:* Richard Heck <mailto:rgh...@lyx.org>
    *Sent:* Thursday, May 29, 2014 3:26 PM

    On 05/29/2014 03:36 PM, Alex Vergara Gil wrote:
    Hello Lyxers
    I wonder why LyX is not available to process little pieces of
    python code within its own framework, like ipython notebook for

    This feature allows us to have beautiful graphics such the one
    produced by matplotlib package. I know there already exists a
    similar binding for R through knitr module, so why not a binding
    for python too??
    Is there a way, like modules or whatever, to achieve the same
    functionality or at least some basic functionality of ipython
    notebook within LyX??
    Can you be more precise about what you want to do? I've never
    heard of ipython notebook.

sudo aptitude install ipython-notebook
ipython notebook

and there you can write even thesis in a web environment with python commands being executed inlined, exporting to pdf and latex too, it is a wonder of our times, so why not letting LyX do this miracle too??

    Sweave works by our having an output format (sweave) for such
    documentsand then our declaring Rscript as a sweave --> LaTeX
    converter, so PDF export (say) goes via Rscript and pdflatex.
    There's a special script in lib/scripts/ that "sets up some things
    for LyX"first, or so it claims. It would be reasonably easy to do
    the same sort of thing for Python, if you wanted to do so. You'd
    just need to set up an appropriate format and then declare an
    appropriate script as a whatever -> latex converter. Then LyX will
    run the script and do as you wish with the embedded python code.

    Of course, as we've discussed on the list with respect to R, there
    are large security issues here, too.


you obviously miss the point here, or I was not very clear! it is not a different format, is a facility to have python scripts running within LyX framework, you have to see ipython notebook to understand what I mean, you will be surprised!! Basically to build graphs, for instance (and only a piece of what can be done), you add the (let's call it) "knitpy" module and then place a knitpy insert, write some python code that produces a matplotlib graphic and then when lyx compiles the document, instead of the code it is shown the graph, it also can be done in the lyx editing window, but thats a more dificult request.

No, that's exactly what I had in mind: Python code inthe document that gets executed at compile timeto create graphsor tables---or delete all your files. ;-) Formats are a LyX-internal method for keeping track of such thingsas what stage of compilation a document is at. The file format wouldn't really be different.


Reply via email to