On 6/25/19 4:24 PM, Jason Sun wrote:
> One of the reason of embedding a terminal to basically ensure the
> jupyter_client is running in the backend. Say I want to write a stats
> book in latex that contains a lot of python and R code. After
> executing one piece of code, I might want to keep all the variables so
> that I can refer it later. Currently, I cannot do this in any special
> latex editor including lyx without compiling the tex file first. I
> could do it in vim or emacs or vscode because they are general purpose
> editors. However, writing latex in them is not a very pleasant
> experience for me personally. 
>
> That is the reason why I came with this idea of building a bridge
> between LyX and Jupyter to combine their powers. I thought about bring
> LyX to jupyter, but it is extremely difficult since Qt has limited
> support for web. Even if we take a step back to use python as a glue,
> we still need to port the whole lyx implementation to Python and use
> PySide2. It is by no means easy. Plus, PySide2 is relatively new. It's
> hard to predict the quality of the ported work.
>
> So the only viable option left, in my opinion, is to bring Jupyter to
> LyX.

I'm not familiar with Jupyter beyond my just-now explorations on the
web, so most of my questions and comments are probably naive. But have
you looked into external templates for LyX? That's another way we have
to interface with external programs. There's also the Preview inset,
which can be used to compile and embed almost anything into LyX.

The problem of persistent variables is maybe more complicated.

Anyway, I don't mean to be discouraging. But it always seems best to
spend a lot of time thinking about design issues before coding too much.
I've learned that the hard way.

Riki



>
> On Tue, Jun 25, 2019 at 4:10 PM Jason Sun <ds...@cornell.edu
> <mailto:ds...@cornell.edu>> wrote:
>
>     So the overall question is: Why not instead figure out how to make LyX
>     work well WITH jupyter notebook?
>
>     One way to make it work well with jupyter notebook is to let it
>     communicate with jupyter_client. CS and Stats community uses
>     Jupyter and Latex a lot, but the two don't work well together. LyX
>     has the advantage of being one of the best Latex editor. It would
>     be kind of cool to let it have jupyter's capabilities. LyX already
>     has knitr support. So it could takes a bit of extra work to extend
>     it to be an interface to jupyter_client or jupyter console. One of
>     the disadvantage of Jupyter Notebook is its latex capabilities. Cf
>     this discussion: https://github.com/jupyter/notebook/issues/1604
>
>     On Tue, Jun 25, 2019 at 3:50 PM Richard Kimberly Heck
>     <rikih...@lyx.org <mailto:rikih...@lyx.org>> wrote:
>
>         On 6/25/19 2:57 PM, Jason Sun wrote:
>         > I have attached a prototype in the screenshots in the
>         attachment. 
>         >
>         > This is what I am trying to achieve - combining the
>         computing power of
>         > jupyter and the latex power of LyX. It is still in early
>         stages. More
>         > testing and further extension could easily be developed.
>         Ideally, one
>         > could do the following few things with this feature
>         >
>         > 1. Edit the ERT box inside a code editor that is embeded in LyX
>         > powered by QScintilla2 with syntax highlighting and clangformat.
>
>         Why is it an advantage to be able to edit the code inside LyX, as
>         opposed to in an external editor of one's own choosing? We
>         have tended
>         to resist embedding things inside LyX that can be done just as
>         well, or
>         better, by an external program devoted to the task. For
>         example, it was
>         once suggested that LyX should have an embedded BibTeX editor.
>         But why?
>         Better, we thought, just to allow databases to be opened in
>         external
>         programs and edited there.
>
>
>         > 2. Copy and paste the code in the ERT or codeListing  in the lyx
>         > editing pane or the code in the embeded code editor  and
>         execute them
>         > in the embeded jupyter-console and get output(plots)
>         displayed in the
>         > console(a separate plot pane) inside LyX.
>
>         Same question, basically.
>
>
>         > I looked at the current 2.4 dev source files, the design for
>         external
>         > editor is a good idea. However, it does not seem to close
>         the external
>         > editor properly. At least I tried on vscode and atom.
>
>         We do not close the external editor ourselves. The user might
>         want to
>         leave it open for some reason. (E.g., there might be other
>         files open in
>         the editor.)
>
>
>         > I also think that the tmp file approach could be internalized.
>
>         Not sure what you mean here.
>
>
>         > The end goal is to enable LyX be stronger if not as strong
>         as jupyter
>         > notebook.
>         So the overall question is: Why not instead figure out how to
>         make LyX
>         work well WITH jupyter notebook?
>
>         Riki
>
>
>
>
>     -- 
>     /*Daqian Sun*/
>     /Tel:607-379-5149
>     /
>     /Department of Mathematics /
>     /Department of Economics/
>     /Cornell University/
>
>
>
> -- 
> /*Daqian Sun*/
> /Tel:607-379-5149
> /
> /Department of Mathematics /
> /Department of Economics/
> /Cornell University/
>

Reply via email to