8
$\begingroup$

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"

$\endgroup$
2
  • $\begingroup$ What have you tried? Have you installed the font for your operating system already? Have you looked up how to change fonts in Mathematica? $\endgroup$
    – Szabolcs
    Mar 2, 2015 at 23:50
  • $\begingroup$ did not find any suitable example yet. However the tried one is mentioned in edited version of question. $\endgroup$
    – zenith
    Mar 3, 2015 at 0:02

2 Answers 2

13
$\begingroup$

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.

$\endgroup$
5
  • 1
    $\begingroup$ Would you mind sharing matex? I'm very interested in that. $\endgroup$ Mar 3, 2015 at 4:57
  • $\begingroup$ @xslittlegrass All in due time :) I need time to clean it up and add error checking. You'll be the first to know. $\endgroup$
    – Szabolcs
    Mar 3, 2015 at 16:58
  • $\begingroup$ @Szabolcs Thank u for the detailed reply. A curiosity: Why there is need of Latin Modern Roman Package? $\endgroup$
    – zenith
    Mar 4, 2015 at 0:14
  • $\begingroup$ @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. $\endgroup$
    – Szabolcs
    Mar 4, 2015 at 0:40
  • $\begingroup$ @Sczabolcs Alright. Thank you for the explaination $\endgroup$
    – zenith
    Mar 4, 2015 at 9:37
5
$\begingroup$

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

$\endgroup$
2
  • $\begingroup$ @M Thank you. For Mac systems?? $\endgroup$
    – zenith
    Mar 4, 2015 at 0:19
  • $\begingroup$ yes, this is on a Mac running yosemite $\endgroup$
    – M.R.
    Mar 4, 2015 at 0:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.