Categories
Mathematica

Mathematica and greek letters (v10 and above)

As already described in Mathematica and greek letters (v7 and v8), if you use greek language for text, Mathematica handles greek letters as special characters, because greek letters are important to mathematical expressions. The workaround described in the above article solved the issue of greek letter bad rendering in text to old versions of Mathematica. From v.10 and above due to an alteration of the config file system in Mathematica you have to follow the solution of this article.

So when you use greek characters in strings on Linux, in Graphics or Graphics3D objects the font used is not the custom one you specify. The result is a really awful rendering of greek fonts.The new configuration of Mathematica stores the font mapping of special characters to a FontMap.tr file. I found the solution with the help of mathematica.stackexchange.com. The extra steps we need to configure Mathematica not to use special font for greek are needed because the new FontMap.tr file is compressed with an internal algorithm of Mathematica:

Let’s say your installation of mathematica on linux is in /usr/local :

  • Go to the directory /usr/local/Wolfram/Mathematica/<Version number>/SystemFiles/FrontEnd/TextResources/
  • The file to be customized is FontMap.tr. Make a backup of the file.
  • Inside the file there is a string CompressedData[“Lots of weird characters“].
  • Copy the “Lots of weird characters”. Inside a running Mathematica kernel define map1=Uncompress[“Lots of weird characters”];
  • As you can see the uncompressed structure of map1 contains the mapping of different fonts with specific unicode characters. Greek letters are mapped to map1[[3]]. You have to declare map1[[3,2]]={}, to define an empty mapping for greek letters. Notice you can also remove other characters from the structure, if you want Mathematica not to treat them special on font mapping.
  • Now you can recompress map1 with: Compress[map1]
  • The resulting “Lots of weird characters” are to be replacing the corresponding text in FontMap.tr.
  • Restart Mathematica, and you are done!

Now the font use in mathematica for greek texts and all the Style settings work fine. as you can see on the picture below:Mathematica unicode greek rendering

Leave a Reply

Your email address will not be published. Required fields are marked *