jerichoblog

linux and windows tips, mathematics, and some recipes

Monday, May 15, 2006

Remote Mathematica use for Linux / Cygwin

Unless you can afford to shell out the long green for a Mathematica licence, you may be in the situation where you have to be physically present at a University computer in order to use it. The other possibility is to remotely log-in via ssh and the X Window system. If you choose the latter path, it is crucial that you have the appropriate fonts installed on your computer, otherwise Mathematica will present you with goobledegook instead of mathematics.

I'm assuming here that you are using Linux or Cygwin. I don't know how this works for native Windows, but would be happy for any enlightenment. As a root user, carry out the following commands:
  • The first step is to download the Mathematica fonts from the Mathematica web site.
  • Create a Mathematica subdirectory of /usr/lib/X11/fonts
  • Copy the downloaded files to /usr/lib/X11/fonts/Mathematica
  • Untar the files (with tar zxvf filename, for each downloaded file called filename).
  • Make sure the permissions are set correctly on the files. You may have to run chmod -R 750 /usr/lib/X11/fonts/Mathematica. Essentially, just make sure that the new font files have the same permissions and ownership as all other font files on your system.
This is where the instructions for Cygwin and Linux vary. For Cygwin, enter the following lines into your .xinitrc file as an ordinary user (the file will be in your home directory):
xset fp+ /usr/lib/X11/fonts/Mathematica/BDF
xset fp+ /usr/lib/X11/fonts/Mathematica/Type1
xset fp+ /usr/lib/X11/fonts/Mathematica/PCF
xset fp rehash
You will then have to restart X for the changes to take effect (or, if you are impatient, you can enter the above lines into your command shell for an immediate change).

Troubleshooting: You may find that the font paths are set correctly when you enter the above commands (check by typing xset q), but aren't set properly when you restart Cygwin. This is probably because you aren't starting X from the startx command, and hence .xinitrc is being bypassed. You'll have to modify a different file. If you're using the fvwm window manager, place the above commands in the .xinitrc-fvwm file instead. If you use the XWin window manager, add the lines to your .bash_profile (this is a set of commands which is run for every login shell). If you use many window managers, it may be more efficient to keep the above lines in a separate file (e.g. ~/.mathemata-fontset) and then run this file from each of the startup files.

The above technique will work with Linux too, but is somewhat non-standard. The standard approach for Linux would be to enter the font paths into your XF86Config file (or your xorg.conf file if you use xorg). Just add the following lines to the "Files" section of /etc/X11/XF86Config (or the appropriate configuration file on your system):
FontPath "/usr/lib/X11/fonts/Mathematica/BDF"
FontPath "/usr/lib/X11/fonts/Mathematica/Type1"
FontPath "/usr/lib/X11/fonts/Mathematica/PCF"
That's it!

0 Comments:

Post a Comment

<< Home