Subject: mailing-list for TeXmacs Users
List archive
From : "David E. Miller" <address@hidden>- To: Bill Eaton <address@hidden>, address@hidden
- Subject: Re: [TeXmacs] Sympy plugin
- Date: Wed, 15 May 2013 03:02:49 -0400
- Authentication-results: smtp02.embarq.synacor.com smtp.user=address@hidden; auth=pass (LOGIN)
- X_cmae_category: 0,0 Undefined,Undefined
Hi Bill:
First, what is the version of TeXmacs and what is the operating system? I have a project that is a VirtualBox GNU/Linux virtual machine that features TeXmacs as a core program and it has a recent version. I also have a MS Windows (7 Pro) version that is also recent. I can't find a sympy plugin in either version in the distribution file tree as installed. Second, since this is a Python module, I would first try to use the existing Python plugin and fire up a Python session in a TeXmacs doc and load your sympy module and see how the Python plugin handles the some stress tests you can try. If the results are normal, then I would take a hard look at the TeXmacs help docs on plugins to get an idea of these work in general. Then, I would recommend that you try to merely copy the existing Python plugin and rename the copy so you can play with it. The main Python plugin file (/usr/lib/texmacs/TeXmacs/bin/tm_python) merely waits for raw input, processes that input and executes the processed code and then the output is then tweaked within this same loop (# Main session loop. it is a while 1 loop as I recall near the bottom of the file) and then this tweaked output is displayed as it returned to TeXmacs. So there is a lot going on in this loop. Each of these plugins are different. In general there exists one or more files written in the language that is native or related to the program of the plugin. There are are also some Scheme files involved. In the case of Maxima it is a little complicated. There are Lisp files that take the Maxima output and process it to get the nice display you see in Maxima TeXmacs session output. TeXmacs provides a framework for developing a plugin, but each plugin author has to put code together within that framework that gets the job done in a way that is in general unique. In your case it might simply be a matter of modifying the tm_python file main loop and/or by adding some functions to that file called from within the main while loop to get done what is needed. Look at the functions: def texmacs_out(out_str): """Feed data back to TeXmacs. Output results back to TeXmacs, with the DATA_BEGIN, DATA_END control characters.""" data_begin() os.sys.stdout.write(out_str) data_end() os.sys.stdout.flush() def compose_output(data): """Do some parsing on the output according to its type.""" if isinstance(data, str): return 'verbatim:'+data.strip() if isinstance(data, int): return 'verbatim: %d' % data if isinstance(data, float): return 'verbatim: %f' % data if isinstance(data, unicode): data2=r'' for c in data: if c not in string.printable: data2+='\\x%x' % ord(c) else: data2+=c data="data2 return 'verbatim: %s' % str(data) in the file tm_python. For your information I have thrown everything but the kitchen sink at this Python plugin and is has so far worked without any issues including loading and using numpy, scipy, scitools, matplotlib, etc. I have also used the Oct2Py module which is an Python interface to GNU Octave and that works without any known issue. I close by commenting that these plugins when they are supported well and maintained are really great. The Maxima plugin is really good. However, some are not supported and maintained as well as others, and you just have to try those that you are interested in and see how each works and then try to figure out in some cases on your own how to fix any bugs and make modifications. I like Python myself, and I have not tried sympy, but I can say without much hesitation that Maxima really is hard to beat. Lots of words. Hope this helps. Best wishes, David Miller On 5/15/2013 12:34 AM, Bill Eaton wrote:
|
- [TeXmacs] Sympy plugin, Bill Eaton, 04/27/2013
- <Possible follow-up(s)>
- Re: [TeXmacs] Sympy plugin, Bill Eaton, 04/27/2013
- Re: [TeXmacs] Sympy plugin, Bill Eaton, 05/15/2013
- Re: [TeXmacs] Sympy plugin, David E. Miller, 05/15/2013
- Re: [TeXmacs] Sympy plugin, A . G . Grozin, 05/15/2013
- RE: [TeXmacs] Sympy plugin, Bill Eaton, 05/15/2013
- Re: [TeXmacs] Sympy plugin, David E. Miller, 05/15/2013
- RE: [TeXmacs] Sympy plugin, Bill Eaton, 05/15/2013
- Re: [TeXmacs] Sympy plugin, A . G . Grozin, 05/16/2013
- Re: [TeXmacs] Sympy plugin, tisimst, 05/16/2013
- Re: [TeXmacs] Sympy plugin, François Poulain, 05/17/2013
- Re: [TeXmacs] Sympy plugin, David E. Miller, 05/18/2013
- [TeXmacs] TeXmacs Sympy plugin LaTeX Output Issue Solved, David E. Miller, 05/18/2013
- RE: [TeXmacs] TeXmacs Sympy plugin LaTeX Output Issue Solved, Bill Eaton, 05/20/2013
- Re: [TeXmacs] Sympy plugin, David E. Miller, 05/15/2013
- RE: [TeXmacs] Sympy plugin, Bill Eaton, 05/15/2013
- Re: [TeXmacs] Sympy plugin, A . G . Grozin, 05/15/2013
- Re: [TeXmacs] Sympy plugin, David E. Miller, 05/15/2013
- Re: [TeXmacs] Sympy plugin, Bill Eaton, 05/15/2013
Archive powered by MHonArc 2.6.19.