On 6/14/19 1:10 PM, Jason Sun wrote: > With the help of the reticulate package and knitr package, we are able > to now embed python and R code in lyx in a reproducible manner. But > the problem is that we have to compile the file every time we need to > see the execution result of the python/R code. In jupyter notebook, > this is not necessary and we can run the code chunks independently. > > > So the question is whether its possible to implement a similar > functionality in future lyx versions? Briefly, the feature could be > abstracted in the following manner: > > 1. Create a procedure to copy the code in the ERT/code chunks, open a > new subprocess, in which runs the python/R REPL and paste the code > into a subprocess. > 2. Run the code. > 3. Return the result in the a panel/window. > 4. Closed the subprocess. > > Is something like this possible?
I would have thought that preview insets could be used to do this. Use Insert> Preview to create such an inset, and then put whatever you want previewed into it. Note that this is completely general: Anything you can put into LyX can be put into a preview inset, and it should be updated whenever the contents is. Probably another way to do this would be to use external templates. Riki