8

What should be command for font style "Computer Modern Roman" in Mathematica, as the default font style of LaTeX is "Computer Modern Roman". Tried this

Plot[z^2, {z, 0, 1}, 
PlotLabel -> 
StyleForm[z^y, FontFamily -> "CMUSerif-Italic", 
 FontSlant -> "Plain", FontSize -> 20]]

However when saved as .eps and used in .tex file, the generated figure in .pdf was having font of "Times"

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
zenith
  • 549
  • 1
  • 8
  • 16
  • What have you tried? Have you installed the font for your operating system already? Have you looked up how to change fonts in Mathematica? – Szabolcs Mar 02 '15 at 23:50
  • did not find any suitable example yet. However the tried one is mentioned in edited version of question. – zenith Mar 03 '15 at 00:02

2 Answers2

13

Personally I installed the Latin Modern font for this, which is an OpenType-packaged version of the same font face.

When we set the font in Mathematica using the FontFamily option, we need to use the font name that the operating system uses, not the filename of the font. You can find this by looking at a font chooser dialog in any application.

Example:

Mathematica graphics

The "matex" part is just some package I'm working on to use LaTeX typesetting in Mathematica ;-)
Update: MaTeX is released now.

For this specific font I needed to use the name Latin Modern Roman. Take a look at any font chooser to find out what is the correct name for the font you installed. Note that the same font may show up under different names on different operating systems.

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
  • 1
    Would you mind sharing matex? I'm very interested in that. – xslittlegrass Mar 03 '15 at 04:57
  • @xslittlegrass All in due time :) I need time to clean it up and add error checking. You'll be the first to know. – Szabolcs Mar 03 '15 at 16:58
  • @Szabolcs Thank u for the detailed reply. A curiosity: Why there is need of Latin Modern Roman Package? – zenith Mar 04 '15 at 00:14
  • @zenith There's no need for it. I'm trying to say that you need to use the correct font name. I'm pretty sure CMUSerif-Italic is not the correct font name. Maybe it's the file name, not the font name. So check what is the correct font name and use that. – Szabolcs Mar 04 '15 at 00:40
  • @Sczabolcs Alright. Thank you for the explaination – zenith Mar 04 '15 at 09:37
5

You can install CMU font set here and this answer shows how to change the base font in the stylesheet editor. I did it and it looks fine on my system:

enter image description here

M.R.
  • 31,425
  • 8
  • 90
  • 281