Re: Rendering math in Leo

2017-10-20 Thread Edward K. Ream
On Friday, October 20, 2017 at 9:05:44 AM UTC-5, Edward K. Ream wrote:

> Leo can already render LaTex math markup using reStructuredText 
.
 
But not very well.

The viewrendered plugin can also render @pyplot nodes, provided you have 
matplotlib installed. Not sure how many people know this ;-)

Rev 897a802 adds some examples of @pyplot nodes to test.leo.  For example, 
here is top-level of the node:
@pyplot matplotlib animate_decay.
Note the @others:

# http://matplotlib.org/1.5.1/examples/animation/animate_decay.html
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation

@others

# global data.
fig, ax = plt.subplots()
line, = ax.plot([], [], lw=2)
ax.grid()
xdata, ydata = [], []
ani = animation.FuncAnimation(
fig, run, data_gen, blit=False, interval=10,
repeat=False, init_func=init)

plt.ion()
# sets interactive mode. Prevents this message:
# QCoreApplication::exec: The event loop is already running
plt.show()

Imo, a comprehensive review of Leo's existing capabilities is in order, not 
just for tips when Leo opens. I have the feeling that some important 
generalizations and simplifications are possible...

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Web help wanted: viewing Joe Orr's Leo view page locally

2017-10-20 Thread Edward K. Ream
On Fri, Oct 20, 2017 at 2:56 AM, vitalije  wrote:

> `npm run build` must be executed in terminal inside project folder.
> Project is what you get by git cloning repository https://github.com/
> kaleguy/leoviewer not leo-examples.
> I haven't tried it, just guessing.
>

​Thanks for this.  I'll try it soon.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Rendering math in Leo

2017-10-20 Thread Edward K. Ream
On Fri, Oct 20, 2017 at 10:24 AM, Terry Brown  wrote:

> On Fri, 20 Oct 2017 07:05:44 -0700 (PDT)
> "Edward K. Ream"  wrote:
>
> > Leo can already render LaTex math markup using reStructuredText
>
> Although I quite like reStructuredText my impression is that it has all
> but lost the competition for market share to markdown.  GitHub,
> obviously, favors markdown.  I suspect Jupyter does too.
> ​
> R-markdown is
> the literate analysis markup of choice for R focused work.  Pandoc
> (backend for at least R-markdown if not others) seems to have more
> markdown extensions for handling citations, math, tables of content,
> etc. than it does reStructuredText extensions.  Maybe Sphinx still
> favors reStructuredText?
>
> The leo_edit_pane view widget currently uses markdown.py to convert
> markdown to HTML for viewing in a QWebkit / QTheOtherHTMLWidget pane.
> Not sure but markdown.py may not handle math.  But an obvious
> alternative is to use pandoc for markdown -> html, which definitely
> supports math.
>

​Thanks for this.  It looks like pandoc, and par​particularly pandoc's
flavor of markdown ,
should do nicely. It requires the tex_math_dollars extension, but
presumably that's not a big deal.

It does look like we need support for pandoc in the rst3 plugin...

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Rendering math in Leo

2017-10-20 Thread Terry Brown
On Fri, 20 Oct 2017 07:05:44 -0700 (PDT)
"Edward K. Ream"  wrote:

> Leo can already render LaTex math markup using reStructuredText 

Although I quite like reStructuredText my impression is that it has all
but lost the competition for market share to markdown.  GitHub,
obviously, favors markdown.  I suspect Jupyter does too.  R-markdown is
the literate analysis markup of choice for R focused work.  Pandoc
(backend for at least R-markdown if not others) seems to have more
markdown extensions for handling citations, math, tables of content,
etc. than it does reStructuredText extensions.  Maybe Sphinx still
favors reStructuredText?

The leo_edit_pane view widget currently uses markdown.py to convert
markdown to HTML for viewing in a QWebkit / QTheOtherHTMLWidget pane.
Not sure but markdown.py may not handle math.  But an obvious
alternative is to use pandoc for markdown -> html, which definitely
supports math.

Cheers -Terry

> .
>  
> But not very well.
> 
> Enter the following in any body pane, and look at the results in the 
> viewrendered pane. Blank lines are significant in some places:
> 
> @language rst
> 
> \int_{b^a} \, x^2 \, dx: :math:`\int_{b^a} \, x^2 \, dx`
> 
> d/dx \int_{0^x}\,f(u)\,du=f(x): :math:`d/dx \int_{0^x}\,f(u)\,du=f(x)`
> 
> \int_{0^x}: :math:`\int_{0^x}`
> 
> block:
> 
> .. math::
> 
> x + 5 = -3
> 
> \int_{b^a} \, x^2 \, dx
> 
> d / dx \, \left(\int_{0^x} f(u)\,du\right)=f(x)
> 
> d / dx (\int_{0^x} f(u)\,du ) = f(x)
> 
> y_k(\mathbf{x},\mathbf{w}) = p(C_1|\mathbf{x})
> 
> Alignment with  in \\begin{equation}:
> 
> .. math::
> 
> \begin{equation}
> x + 5 = -3 \\
> \int_{b^a} \, x^2 \, dx\\
> d / dx \left(\int_{0^x} f(u)\,du\right)=f(x)\\
> d / dx (\int_{0^x} f(u)\,du) = f(x)\\
> y_k(\mathbf{x},\mathbf{w}) = p(C_1|\mathbf{x})
> \end{equation}
> 
> Inline: :math:`y_k(\mathbf{x},\mathbf{w}) = p(C_1|\mathbf{x})`
> 
> Inline: :math:`(\sum_{t=0}^{N}\,f(t,k))/N`
> 
> The final output will be a vector :math:`Y` with :math:`K` elements, 
> :math:`y_k`, where
> :math:`y_k(\mathbf{x},\mathbf{w}) = p(C_1|\mathbf{x})` is the
> probability that node
> :math:`k` is in class :math:`C_1` and
> :math:`p(C_2|\mathbf{x}) = 1-p(C_1|\mathbf{x})`
> 
> This is kinda cool, but it has serious problems. The first two are
> visual:
> 
> - The rendering is poor for integrals, \int, and sums, \sum.
> 
> - There is no easy control over font size.  It may be possible using
> css for rST.
> 
> Worse, there are at least two serious markup incompatibilities:
> 
> - \frac does not render as in Jupyter or the mathjax viewer 
> .
> 
> - The :math:`` syntax is clumsy.  In contrast, Jupyter
> notebooks use $$.
> 
> *Summary*
> 
> These kinds of incompatibilities will substantially limit the appeal
> of rST :math: markup.
> 
> More generally, Leo is faced with a never-ending task of playing as
> well as possible with existing apps, tools and languages. This task
> requires continuous invention, so it could be called a source of
> pleasure ;-)
> 
> Edward 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Playing well with other apps, tools and languages

2017-10-20 Thread Edward K. Ream
​In another thread I wrote: "Leo can already render LaTex math markup using 
reStructuredText 
.
 
But not very well."

​It may be possible to better render LaTeX ​using the richtext.py plugin. I 
haven't tried it yet.  It would require installing this ckeditor plugin 
, presumably as part of the 
richtext plugin.

More generally, Leo needs to make common tasks easier for the user. This 
goal became clear during my vacation.  It will require considerable work 
behind the scenes. Several tasks come to mind:

- Support all ipython "magics" that are applicable in Leo, perhaps 
including magics defined in ipython plugins. This includes support for 
executing scripts in languages other than python, or for specific versions 
of python.  This should be fairly straightforward.

- Support JavaScript-based tools somehow.  I love python, but the world 
seems to be moving away from it.  For example, Leo should render mathjax 
properly, without relying on buggy intermediate layers such as docutils or 
Qt widgets.

- Better support for moving between Jupyter and Leo.

Your comments, please.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Rendering math in Leo

2017-10-20 Thread Edward K. Ream
Leo can already render LaTex math markup using reStructuredText 
.
 
But not very well.

Enter the following in any body pane, and look at the results in the 
viewrendered pane. Blank lines are significant in some places:

@language rst

\int_{b^a} \, x^2 \, dx: :math:`\int_{b^a} \, x^2 \, dx`

d/dx \int_{0^x}\,f(u)\,du=f(x): :math:`d/dx \int_{0^x}\,f(u)\,du=f(x)`

\int_{0^x}: :math:`\int_{0^x}`

block:

.. math::

x + 5 = -3

\int_{b^a} \, x^2 \, dx

d / dx \, \left(\int_{0^x} f(u)\,du\right)=f(x)

d / dx (\int_{0^x} f(u)\,du ) = f(x)

y_k(\mathbf{x},\mathbf{w}) = p(C_1|\mathbf{x})

Alignment with  in \\begin{equation}:

.. math::

\begin{equation}
x + 5 = -3 \\
\int_{b^a} \, x^2 \, dx\\
d / dx \left(\int_{0^x} f(u)\,du\right)=f(x)\\
d / dx (\int_{0^x} f(u)\,du) = f(x)\\
y_k(\mathbf{x},\mathbf{w}) = p(C_1|\mathbf{x})
\end{equation}

Inline: :math:`y_k(\mathbf{x},\mathbf{w}) = p(C_1|\mathbf{x})`

Inline: :math:`(\sum_{t=0}^{N}\,f(t,k))/N`

The final output will be a vector :math:`Y` with :math:`K` elements, 
:math:`y_k`, where
:math:`y_k(\mathbf{x},\mathbf{w}) = p(C_1|\mathbf{x})` is the probability 
that node
:math:`k` is in class :math:`C_1` and
:math:`p(C_2|\mathbf{x}) = 1-p(C_1|\mathbf{x})`

This is kinda cool, but it has serious problems. The first two are visual:

- The rendering is poor for integrals, \int, and sums, \sum.

- There is no easy control over font size.  It may be possible using css 
for rST.

Worse, there are at least two serious markup incompatibilities:

- \frac does not render as in Jupyter or the mathjax viewer 
.

- The :math:`` syntax is clumsy.  In contrast, Jupyter notebooks 
use $$.

*Summary*

These kinds of incompatibilities will substantially limit the appeal of rST 
:math: markup.

More generally, Leo is faced with a never-ending task of playing as well as 
possible with existing apps, tools and languages. This task requires 
continuous invention, so it could be called a source of pleasure ;-)

Edward 

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Anyone know how to update Leo's pypi index?

2017-10-20 Thread Terry Brown
On Fri, 20 Oct 2017 02:28:53 -0700 (PDT)
lewis  wrote:

> On Friday, October 20, 2017 at 1:31:52 PM UTC+11, Matt Wilkie wrote:
> You're welcome. I'm happy to contribute.
> 
> I think it's worth persisting a bit longer; `pip install thing`
> is the mainstream method and now that PyQt can be installed with pip
> on py3+ the biggest roadblock to a complete `pip install leo` has
> been dealt with.
> 
>  An excellent point Matt. It should not be underestimated.

+1

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Anyone know how to update Leo's pypi index?

2017-10-20 Thread lewis


On Friday, October 20, 2017 at 1:31:52 PM UTC+11, Matt Wilkie wrote:
>
> You're welcome. I'm happy to contribute.
>
> I think it's worth persisting a bit longer; `pip install thing` is the 
> mainstream method and now that PyQt can be installed with pip on py3+ the 
> biggest roadblock to a complete `pip install leo` has been dealt with.
>

 An excellent point Matt. It should not be underestimated.

Regards
Lewis

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Web help wanted: viewing Joe Orr's Leo view page locally

2017-10-20 Thread vitalije
`npm run build` must be executed in terminal inside project folder. Project 
is what you get by git cloning 
repository https://github.com/kaleguy/leoviewer not leo-examples.
I haven't tried it, just guessing. 
Vitalije

On Thursday, October 19, 2017 at 11:29:36 PM UTC+2, Edward K. Ream wrote:
>
>
>
> On Thu, Oct 19, 2017 at 2:48 PM, Joe Orr > 
> wrote:
>
>> You can also get the newest versions from the project repo, run 'npm run 
>> build'
>>
>
> ​This fails for me.  The contents of npm-debug.log is:
>
> 0 info it worked if it ends with ok
> 1 verbose cli [ 'C:\\PROGRA~1\\nodejs\\node.exe',
> 1 verbose cli   'C:\\PROGRA~1\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
> 1 verbose cli   'run',
> 1 verbose cli   'build' ]
> 2 info using npm@2.15.1
> 3 info using node@v4.4.4
> 4 verbose stack Error: ENOENT: no such file or directory, open 
> 'c:\Web\leo-examples\package.json'
> 4 verbose stack at Error (native)
> 5 verbose cwd c:\Web\leo-examples
> 6 error Windows_NT 10.0.15063
> 7 error argv "C:\\PROGRA~1\\nodejs\\node.exe" 
> "C:\\PROGRA~1\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
> 8 error node v4.4.4
> 9 error npm  v2.15.1
> 10 error path c:\Web\leo-examples\package.json
> 11 error code ENOENT
> 12 error errno -4058
> 13 error syscall open
> 14 error enoent ENOENT: no such file or directory, open 
> 'c:\Web\leo-examples\package.json'
> 14 error enoent This is most likely not a problem with npm itself
> 14 error enoent and is related to npm not being able to find a file.
> 15 verbose exit [ -4058, true ]
>
> Edward
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.