Skip to Content.
Sympa Menu

texmacs-users - [TeXmacs] howto temacs mathematica

Subject: mailing-list for TeXmacs Users

List archive

[TeXmacs] howto temacs mathematica


Chronological Thread 
  • From: Philippe Joyez<address@hidden>
  • To: address@hidden
  • Subject: [TeXmacs] howto temacs mathematica
  • Date: Mon, 10 Jan 2011 22:49:51 +0100 (CET)

How to run the TeXmacs Mathematica plugin - For Mathematica version 7 on
linux.
Probably valid for v.6 also, and maybe other OSs too.

In order to connect to Mathematica TeXmacs needs an executable
"tm_mathematica.bin" in the hidden user's ".TeXmacs/bin/" directory. This
executable is normally compiled on the fly the first time a Mathematica
session
is opened, however the "makefile.lazy" that control this process makes
assumptions on filepaths that are obsolete for current versions of
mathematica.
Fixing make.lazy in general means to make it smart enough to handle all
possible cases of OS/mathematica version, which is nor easy. On the other
hand,
if the user is able to provide the appropriate file paths on its own, the
simple following script (partly based on
http://savannah.gnu.org/patch/?6079#comment2) does the jobs:

************************************
#! /bin/bash

#first define paths

#here we use the texmacs installed files, but can also be the downloaded
source
Texmacs_math_plugin_files=/usr/local/share/TeXmacs/plugins/mathematica

#Mathematica files from your installation
Mathlink_Path="/usr/local/Wolfram/Mathematica/7.0/SystemFiles/Links/MathLink/De
veloperKit/Linux-x86-64/CompilerAdditions"
#above, replace "Linux-x86-64" to suit your system.
#In this directory we'll use the header mathlink.h and a shared library
libMLxxx.so where xxx depends on the architecture
#for me, the library is "libML64i3.so" :

lib_name=libML64i3.so

#for Linux, normally no editting needed below this line
Texmacs_home=$HOME"/.TeXmacs"

lib_option=${lib_name:3:${#lib_name}-6} #strip "lib" and ".so"

#make the dynamic library accessible at runtime in the usual system library
path (needs admin rights):
sudo ln -s $Mathlink_Path/$lib_name /usr/lib/$lib_name

#make temporary writable copy of souce and use as working directory:
cp -rf $Texmacs_math_plugin_files/src.lazy /tmp/mathem
cd /tmp/mathem

#copy necessary header
cp $Mathlink_Path/mathlink.h mathlink.h

#compile
gcc -o tm_mathematica.bin tm_mathematica.c -l$lib_option -lm -lpthread -lrt

#finally install executable
cp tm_mathematica.bin $Texmacs_home/bin/tm_mathematica.bin
************************************

save it as a text file, adapt as needed for your system, make it executable
and
run it (or execute line by line to check the process). The compilation issues
many warnings, but it's OK.

Now you can start a Mathematica session from within Texmacs, either using the
"insert session" submenu or running a scheme command : (make-session
"mathematica" "default")

Final note: in recent mathematica versions the default graphics output is not
postscript anymore, which is what TeXmacs needs. However you can correct the
problem easily by evaluating (once per mathematica session):

Get["Version5`Graphics`"]


Hope it helps,

Philippe


  • [TeXmacs] howto temacs mathematica, Philippe Joyez, 01/10/2011

Archive powered by MHonArc 2.6.19.

Top of Page