Getting Mathematica fonts to work with pdfLaTeX

I’m busy with writing some stuff and sometimes using Mathematica is simpler and quicker than using GnuPlot + Inkscape. But getting the fonts to work with LaTex / pdfLaTeX …

!!! WTF !!!

Now after several hours, it’s dark now, and browsing through millions of pages on Wolfram’s Mathematica support database I’ve come up with something. All the posts were pretty old. Either it works out of the box with the latest 8.0 release, or people have just given up going that road (to madness).

Assumptions: linux + TeXLive (pdfLaTeX) on openSUSE 11.3

Here’s the package I’ve put together. It includes these files. I’ve added some information, which you’ll be able to read below as well, and a test case to see if things work as intended. Don’t forget to extract it with ‘full path’ (7z x FILENAME), or you’ll get error messages.

— howto —

Execute these steps as root:

  • copy ‘texmf/dvips/config/’ to ‘/usr/share/texmf/fonts/map/dvips/wolfram/’ – create the folders if missing
  • copy ‘texmf/pdftex/config/’ to ‘/usr/share/texmf/fonts/map/pdftex/wolfram/’
  • rename .pfb to .pfa in these files
  • copy all subfolders from ‘texmf/fonts’ (afm/wolfram …) to the corresponding folders in ‘/usr/share/texmf/fonts’
  • ‘cp -r afm/wolfram/ /usr/share/texmf/fonts/afm/’ etc.
  • copy ‘texmf/tex/latex/wolfram’ to ‘/usr/share/texmf/tex/latex’
  • run ‘texconfig rehash’ to let texlive know about the new files
  • run ‘updmap-sys –enable’
  • run ‘updmap-sys –enable’

Result: updated ‘/var/lib/texmf/fonts/map/dvips/updmap/’

Let ghostscript know about the fonts (to convert .eps to .pdf files for pdfLaTeX):

  • add to $HOME/.profile :
  • GS_FONTPATH=/usr/share/texmf/fonts/type1/wolfram
  • export GS_FONTPATH

Now you can:

  • use .eps files created with mathematica 4.2.0 as includes usign LaTeX
  • use ‘wrisym.sty’ to use mathematica symbols directly in LaTeX
  • dvips/dvipdf will correctly translate dvi files showing all the goodness
  • convert .eps files to .pdf files with ‘epspdf’ for usage with pdfLaTeX
  • view .eps files with ‘ghostview’ with correct symbols

To make to mathematica fonts globally available (KDE, openOffice etc.):

  • Create a file e.g. ’08-mathematica-texlive.conf’ in ‘/etc/fonts/conf.avail’
  • Create a symlink to it in ‘/etc/fonts/conf.d’
  • install ‘t1lib’ – I found this vital info here
  • go to ‘/usr/share/texmf/fonts/type1/wolfram’ and run ‘type1afm *.pfa’
  • Run ‘fonts-config’ to update the system
  • probably restart your session or openOffice at least

The mathematica fonts should now show up in KDE’s font installer as system wide fonts. This works with openOffice and scribus. Inkscape shows them in the font list, but doesn’t use them :-( If you want/need to do some postprocessing, you can also export .svg files with Mathematica. Currently Inkscape can import them, but loses all the font goodness. However, Scribus imports them nicely. Just use that or export as .svg again and use Inkscape. All text will be converted to paths though.

If you’re using windoze, it might work the same way. For converting .eps to .pdf files using Acrobat Distiller, just add the type1 font folder to its config. Works with 6.0 at least.

I’ve had ENOUGH for the day. Maybe someone will find this helpful.

tested with: openSUSE 11.3 (texlive 2009), openSUSE 11.4 (texlive 2010)


This entry was posted in Software. and tagged , , , , , , . Bookmark the permalink.

One Response to Getting Mathematica fonts to work with pdfLaTeX

  1. Matt says:

    Nice, thanks! This helped point me in the right direction. One thing that didn’t work for me was enabling both map files. If I did that, then pdflatex would complain that there were duplicated font entries. Disabling the dvips map silenced the warnings. I don’t use ghostscript, so I just ignored that section as well.

Comments are closed.