I thought about this long and hard. It is possible to extend Lyx's
functionality beyond the document processer. With the help you pybind 11
and Qt5, I think is it possible to implement some of the IDE features(think
RStudio) in LyX. This would be extremely helpful in writing scientific
document. Currently, my workflow is to write code in VS Code/Emacs and copy
and paste everything back and forth between LyX and code editor.

* It is not terribly cumbersome. But if we can development LyX into
something like RStudio, it would definitely save some time.

* Because LyX has support for knitr. Provided the script editor QtWidget
and console Widget has been implemented, it won't be very hard to build a
communication mechanism between the IDE portion and the LyX main
buffer&main view portion. This is a little bit like Jupyter Console (think
IPython), but with much better Latex support.

My rough idea:

* I think the GUI and UI design part it not so hard. We could just create
another ViewSource-like class that inherit DockView but with editable text
field. As for console portion, there are quite a few example QtConsole, are
we could develop our own wheel. I remember in my undergrad OS class. the
first project was to implement a terminal-ish stuff. As far as I am
concerned it is not terribly difficult as long as the signals child
processes are handled right.

* The major work should be in the building a python repl inside LyX. I
think LyX has its own Python for some of the scripting procedures, but it
is not ideal to use this one. The better solution, IMO, is to enable
loading the Python Interpreter the user assigned. This gives a larger
flexibility for various reasons (say, some user might want to use
TensorFlow. This would be greatly helpful).

* with pybind11, it is not really hard to open up a python interpreter
inside c++ applications. The developers of pybind11 gave various examples
on how to do it. Moreover, pybind11 is a header only library, which makes
it easy to be built into other applications.


These are my thoughts so far. Would be nice to hear some of your ideas on
this.


Jason Sun
Cornell University

Reply via email to