Thanks again! This was a very useful discussion. At the moment, I am using a simple solution for displaying the TeX and spending my time on the real task using SymPy, and I am very happy with the way it is going.
On Monday, December 9, 2019 at 7:41:52 PM UTC+1, Aaron Meurer wrote: > > If you're referring to the documentation, that is not SymPy Live, > except for the popup that appears on the bottom right. The docs use > Sphinx (the sources are in the sympy/sympy repo). They use the Sphinx > mathjax extension. MathJax is itself a Javascript library, so it only > exists on the webpage. The code that writes the HTML files just writes > the LaTeX into those files, and MathJax renders it in the browser. > > SymPy Live is a website at live.sympy.org, and it is also included in > the docs in the bottom right. > > The examples in the docs do not use MathJax, but rather just show the > output directly from Python. That way if you copy and paste the > example in a terminal, the output will look exactly the same. The page > you mentioned shows Unicode output so that it is easier to read. If > you don't have the right fonts installed, it can render poorly. We are > looking for better ways to solve this > (https://github.com/sympy/sympy/issues/15700), but for now, I > recommend installing DejaVu Sans Mono. The only MathJax used in the > tutorial is the math in the text surrounding the examples, which is > not computed from SymPy. > > For your own computation, I recommend using the Jupyter notebook using > Jupyter Lab. That will automatically render SymPy output using > MathJax, and it has other nice features as well, like the ones you > described from MATLAB. > > Aaron Meurer > > On Mon, Dec 9, 2019 at 3:56 AM Thomas Ligon <[email protected] > <javascript:>> wrote: > > > > Thanks, this is helpful. > > > > When I search > > https://github.com/sympy/sympy-live > > I can only find it in > > https://github.com/sympy/sympy-live/tree/master/templates/base.html > > so I can't confirm your remark > >> > >> What SymPy Live does is return the LaTeX string of expression using the > LaTeX printer (accessible through the latex() function), and then passes > that to MathJax > > > > > > It looks to me like the tutorial web page, which might be Jupyter, does > this. > > > > In the SymPy tutorial, the first examples in > > https://docs.sympy.org/latest/tutorial/intro.html > > print nicely, but, starting with "The Power of Symbolic Computation" and > the example > > diff(sin(x)*exp(x), x) > > the output is no longer nicely formatted, but looks like "Unicode" > formatting. Here, you can also see that the output is no longer centered. > In addition, the examples do not include print statements, so it looks like > the lines in the examples that don't contain ">>>" were not created by the > example itself. When I look at the source of the web page for the tutorial, > I can see that it contains URLs for live.sympy.org, and also for MathJax. > My conclusion: The use of MathJax is not in the SymPy Live code, but in the > code of the tutorial web page. > > Finally, it looks to me like what I need is not to understand how SymPy > Live formats the output, but how the tutorial formats it. If I need > immediate formatting in my project, I should probably use Jupyter > notebooks. > > In comparison, I have done a lot with MATLAB Symbolic Math Toolbox, and > now I am just starting to use Python and SymPy. In MATLAB, I got the best > formatting using MATLAB "live scripts", whÃch are a kind of notebook. > However, the output was never good enough for publication, so I used it for > calculations and searching for a solution, and the created my publication > documents in another system. > > > > On Monday, December 9, 2019 at 12:22:59 AM UTC+1, Aaron Meurer wrote: > >> > >> The SymPy Live source code is at https://github.com/sympy/sympy-live > >> > >> Aaron Meurer > >> > >> On Sun, Dec 8, 2019 at 2:04 PM Thomas Ligon <[email protected]> > wrote: > >> > > >> > Hi Aaron, > >> > > >> > this answers a question I had, except that I can't see MathJax called > anywhere. A search for mathjax in SymPy gives me 4 occurrences in > printing.py and 2 in latex.py, but none that call MathJax. Can/should I > search the code of Live? > >> > > >> > On Friday, May 25, 2012 at 10:29:27 PM UTC+2, Aaron Meurer wrote: > >> >> > >> >> What SymPy Live does is return the LaTeX string of expression using > >> >> the LaTeX printer (accessible through the latex() function), and > then > >> >> passes that to MathJax, which converts it to a printed expression. > >> >> Any string output is passed to MathJax, so even if you just enter a > >> >> string, it will be parsed as LaTeX. > >> >> > >> >> If you want to know how the LaTeX printer works, see > sympy/printing/latex.py. > >> >> > >> >> Aaron Meurer > >> >> > >> >> On Fri, May 25, 2012 at 10:36 AM, Matthew Rocklin <[email protected]> > wrote: > >> >> > Hi Duncan, > >> >> > > >> >> > To the best of my knowledge SymPy is unable to parse LaTeX. We are > however > >> >> > able to generate it; this is what you're seeing on live.sympy.org. > > >> >> > > >> >> > You can look at our latex printing by downloading our source and > checking > >> >> > out the sympy/sympy/printing/latex.py file. > >> >> > > >> >> > I think it would be awesome to have a latex parser for SymPy. This > might be > >> >> > challenging though. > >> >> > > >> >> > -Matt > >> >> > > >> >> > > >> >> > On Fri, May 25, 2012 at 11:19 AM, Duncan Steele > >> >> > <[email protected]> wrote: > >> >> >> > >> >> >> Hello, I am new to sympy, and I am really impressed by the web > demo at > >> >> >> live.sympy.org. I am trying to replicate that shell's ability > to > >> >> >> understand latex maths notation, and I have been unsuccessful. I > have > >> >> >> combed through both sympy and sympy-live without understanding > how > >> >> >> live.sympy.org parses latex maths. > >> >> >> > >> >> >> There seems to be some API function that the web shell calls to > parse > >> >> >> the string I type in, e.g. 'X = \sum_i x_i = X '. What is it? > >> >> >> > >> >> >> Thanks, > >> >> >> > >> >> >> -- > >> >> >> You received this message because you are subscribed to the > Google Groups > >> >> >> "sympy" group. > >> >> >> To post to this group, send email to [email protected]. > >> >> >> To unsubscribe from this group, send email to > >> >> >> [email protected]. > >> >> >> For more options, visit this group at > >> >> >> http://groups.google.com/group/sympy?hl=en. > >> >> >> > >> >> > > >> >> > -- > >> >> > You received this message because you are subscribed to the Google > Groups > >> >> > "sympy" group. > >> >> > To post to this group, send email to [email protected]. > >> >> > To unsubscribe from this group, send email to > >> >> > [email protected]. > >> >> > For more options, visit this group at > >> >> > http://groups.google.com/group/sympy?hl=en. > >> > > >> > -- > >> > You received this message because you are subscribed to the Google > Groups "sympy" group. > >> > To unsubscribe from this group and stop receiving emails from it, > send an email to [email protected]. > >> > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/0d02f196-67e0-4acb-a1b3-9f0f300a24bd%40googlegroups.com. > > > > > > -- > > You received this message because you are subscribed to the Google > Groups "sympy" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected] <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/af299d33-6eba-4c11-b6e1-ad50f8b90df1%40googlegroups.com. > > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/b69e4e49-66bd-4986-a218-9e5ed1fc6a45%40googlegroups.com.
