mailing-list for TeXmacs Users

Text archives Help


Re: [TeXmacs] Mathematica plugin on OS X


Chronological Thread 
  • From: Peter Rapcan <address@hidden>
  • To: texmacs-users <address@hidden>
  • Cc: Madhusudan Singh <address@hidden>, address@hidden
  • Subject: Re: [TeXmacs] Mathematica plugin on OS X
  • Date: Thu, 30 Jun 2016 06:51:52 +0200 (CEST)

Replying to my own post:

Strangely, if I run TeXmacs from the Terminal.app (executing /Applications/TeXmacs.app/Contents/MacOS/TeXmacs), the Mathematica plugin works! However, when TeXmacs is launched by clicking via the app icon, the plugin only displays a “busy” message on any computation…

What could be the reason for / solution to this?

Cheers,
Peter.


On 29 Jun 2016, at 06:02, Peter Rapcan <address@hidden> wrote:

Hi Madhusudan,

Thanks for your reply. I am referring to the script you posted to the texmacs-users list on 18.02.2011 which, as you reported back then, partially worked on the Mac OS X 10.6.6 with Mathematica 7.0. The problem you were stuck at at the time is not present anymore (at least not on my system) and I altered your script so that it works with the Mathematica 10 and OS X 10.11 (though breaking functionality on Mac OS X 10.6 and Mathematica prior to v 9).

If someone helps me to get the Mathematica plugin to work properly for me, I am then willing to try to check functionality / make it work properly with Mathematica 8 and 9 too (and perhaps also OS X 10.6) as I have those installed on some of my computers.

It would be great to have a properly working Mathematica plugin on reasonably new versions of OS X (perhaps 10.6.8 or newer), Mathematica (perhaps v6 and newer) and Texmacs, ideally with autodetection of versions. I am willing to do some testing on the systems I have (and even install older ones if necessary) but someone would have to lead / help with an approach to properly detect versions of the software involved (I am not a programmer and I don’t really have the time to learn this stuff from scratch by myself).

I agree the official updates of TeXmacs are seldom, but AFAIK there is always some development in the svn. Developers, could there perhaps be nightly (or some longer-period-based) builds for all the supported platforms that users could use/test between releases without having to set up/learn how to build from svn themselves? With regard to OS X compliance, AFAIK there used to be a cocoa version in development, but I guess it is too time consuming to maintain both QT and cocoa version.

As for journals' support, export to latex works reasonably well, and writing a (physics) paper in TeXmacs vs. TeX is like heaven vs. hell ;-).

Cheers, 
Peter.


On 29 Jun 2016, at 04:34, Madhusudan Singh <address@hidden> wrote:

Not sure which of my scripts this refers to, but it has been years since I used TeXmacs because of the slow updates (especially on Mac), lack of closer compliance to OSX GUI, and the lack of interest from journals to have separate templates for TeXmacs.

On Wed, Jun 29, 2016 at 6:15 AM, Peter Rapčan <address@hidden> wrote:
Anyone?

> On 28 Jun 2016, at 04:14, Peter Rapčan <address@hidden> wrote:
>
> Hello everybody,
>
>
> I tried to get the Mathematica plugin to work on OS X 10.11.5, TeXmacs 1.99.4, with Mathematica 10.0.0.0.
>
>
> First of all, I copied the tm_mathematica.c from Tian-Min Yan to the /Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/plugins/mathematica/src.lazy/ directory.
>
> Then I performed two changes to the file:
> - replaced all occurences of MLDisownString by MLReleaseString
> - replaced all occurences ofMLDisownSymbol by MLReleaseSymbol
> (According to the Wolfram documentation, as of Mathematica 6.0 the former functions have been superseded by the latter functions. I am not sure from which version of Mathematica on, the old functions cannot be used; in any case I could not compile the tm_mathematica.c with the libMLi3.a choice without these changes in the case of  Mathematica 10.0.0.0). I suppose these changes need to be done also if one wanted to use the stock tm_mathematica.c provided in a TeXmacs installation.
>
> The adapted tm_mathematica.c  file is attached.
>
>
> Next, I used the script provided by Singh Madhusudan and made some changes to make it work. The changes I had to make are the following:
> - change the Mathlink_Path variable (Mathematica version 9 or greater contains the architecture specification [in my case MacOSX-x86-64] in the path to the directory where Mathlink resides).
> - change the /usr/lib/ to /usr/local/lib/ since from OS X 10.11 on, the System Integrity Protection is enabled, forbidding to write to the /usr/lib/ directory irrespective of administrator rights.
> - change the compiler commant to use g++ instead of gcc and use the oprion -l$lib_option -stdlib=libstdc++ instead of the -l$lib_option -lstdc++
>
> With these changes, running the script compiled the tm_mathematica.c just fine, with a single warning “tm_mathematica.c:544:46: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long')
>      [-Wformat]
>    printf("\2prompt#\\red In[%1d]:= {}\5\5",InNum++);”
>
> I attach the working script as “tmMMAscript".
>
>
> Next, as TeXmacs did not recognize Mathematica as available in the list of supported sessions, I created a wrapper “math” command that runs the MathKernel  and placed in into /usr/local/bin/. The wrapper is attached. (note that creating a symlink to MathKernel does not work). After doing this, TeXmacs offers the Mathematica session in its list of supported sessions.
>
>
> Upon including a Mathematica session, I was prompted whether I allow tm_mathematica.bin to accept incoming connections, from which I deduce the MathLink is working… well… almost. Unfortunatelly, the session does not return results of computations; instead it shows a “busy…” message (see the attached screenshot).
> <Screen Shot 2016-06-28 at 03.43.48.png>
>


> I looked at the tm_mathematica file provided by TeXmacs, and tried to tweak it (I think the paths are based on some old mathematica version, so I changed the relevant command to
>
> export MATHLINK_PATH="$MATH3/CompilerAdditions"
>
> or
>
> export MATHLINK_PATH="$MATH3/CompilerAdditions/AlternativeLibraries"
> (According to the readme file provided in the AlternativeLibraries directory: “This AlternativeLibraries directory contains a versions of the MathLink
> libraries compiled with -stdlib=libc++ compiler flags.  These libraries exist to link programs that need compatibility with Apple's newer libc++ C++ library.”
> Since I compiled with the -stdlib=libstdc++ option the second choice should be the correct one).
>
> In any case, none of the changes I tried to make to the tm_mathematica file helped to make the plugin work, hence I am stuck with the busy message. Any help to resolve the issue would be greatly appreciated.
>
>
> Cheers,
> -Peter.
> <tmMMAscript><tm_mathematica.c><math>
>

>
>
>> On 31 Oct 2012, at 11:35, Tian-Min Yan <address@hidden> wrote:
>>
>> Hi all,
>>
>> Now I know how to output PS/EPS graphics. According to the manual
>> section "Interfering TeXmacs with other programs", I simply put
>>
>>   fputs("\2ps:", stdout);
>>   fflush(stdout);
>>   system("cat ~/tmp.eps");
>>   fputs("\5{}{}\n\n", stdout);
>>
>> into the code (see the attachment), now the EPS figure shows up. Can we
>> adjust the size and the position of the figure within TeXmacs?
>>
>> Besides, I am wondering if we can display a PNG file, since those
>> rasterized formats have significantly smaller size and the program runs
>> faster. We should be able to choose between different formats to meet
>> different purposes.
>>
>> One more question, can anybody who is familiar with Mathematica figure
>> out why "Export["./tmp.eps", expr]" sometimes outputs figures in the
>> wrong position, as is shown in the attachment where the main part is not
>> at the center? In contrast, PNG file does not have this problem.
>>
>> Best,
>> Tian-Min
>>
>> On Tue, 2012-10-30 at 19:01 +0100, address@hidden
>> wrote:
>>> Hi Tian-Min,
>>>
>>> The plugin worked perfectly for graphics in old times when Mathematica
>>> produced pure postscript graphics (this was in versions <=5).
>>> If you are happy with the old-style Mathematica graphics, in your
>>> mathematica session simply evaluate : Get["Version5`Graphics`"]
>>> and then the plugin will recognize the ps graphics and show them in
>>> TeXmacs (but only for old -or unchanged- graphics functions, old options
>>> etc.)
>>>
>>> It would be nice to benefit from the new mathematica graphics, but that
>>> would require someone to volunteer for improving the plugin in that area.
>>>
>>> Best,
>>> Philippe
>>>
>>>
>>> Tian-Min Yan - address@hidden wrote:
>>>> Hi all,
>>>>
>>>> I am using Mathematica 8. The Mathematica plugin in TeXmacs works
>>>> perfectly with a single _expression_ if it does not contain graphical
>>>> elements. But if we use functions involving plots, the output is
>>>> problematic. Has anybody figured out the implementation of embedded
>>>> figures with the Mathematica plugin?
>>>>
>>>> Best,
>>>> Tian-Min
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>> <texmacs_wrong_position.png><tm_mathematica.c>
>
> _______________________________________________
> Texmacs-dev mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/texmacs-dev








Archive powered by MHonArc 2.6.19.

Top of page