0
$\begingroup$

I am using MaTex on windows and Ubuntu and for labeling, I use the font Latin Modern Roman which is completely consistent with the font generated by MaTex in Ubuntu but it gives different font on Windows?

here is the code and the results I got from Ubuntu18.04 MMA12.1.1 and windows10 MMA12.3:

     plot = Plot[Sin[x], {x, -5, 5}, Frame -> True, PlotRange -> {-1, 1}, 
  LabelStyle -> {FontFamily -> "Latin Modern Roman", Black, 
    FontSize -> 16}, 
  FrameLabel -> (MaTeX[#, 
       Magnification -> 1.5] &) /@ {"\\delta(x) \\ -4 \\ 0\\ 4 ", 
     "\\beta_i(y)"}, Axes -> False, ImageSize -> 300]

from win

enter image description here

from Ubuntu

enter image description here

you can see that on windows the ticks font are different from those numbers ($-4, 0, 4$) generated by MaTex. So, Is there a specific font in the windows that can generate the same font style as Matex?

$\endgroup$
11
  • $\begingroup$ This is covered in the documentation: please go through the tutorial which has a full section on the topic. On Windows, you need to refer to the font by a different name, which I don't recall. (EDIT: The docs say try "LM Roman 12".) You will need to find the correct name yourself by e.g. using a GUI font chooser and noting the name. I don't know why the same font appears under different names in different OSs. $\endgroup$
    – Szabolcs
    May 30 at 13:02
  • $\begingroup$ And of course, you need to actually install this font before you can use it. $\endgroup$
    – Szabolcs
    May 30 at 13:04
  • $\begingroup$ @Szabolcs, I am actually aware of the section in the documentation and try the font you mentioned in the documentation for windows but did not give the desired results, and that why I came here to seek help. I still don't understand how should I find the respective font? may you please elaborate? $\endgroup$ May 30 at 13:48
  • 1
    $\begingroup$ "I did not install any new fonts" Well, then of course that's the problem. If you don't have a font installed on your system (note: you install it for Windows, not for Mathematica) then you can't use it. The documentation page I referred to has a link to where you can download the font, gust.org.pl/projects/e-foundry/latin-modern $\endgroup$
    – Szabolcs
    May 30 at 19:19
  • 1
    $\begingroup$ @Szabolcs, thank you very much, it is working perfectly now $\endgroup$ May 31 at 6:28
0
$\begingroup$

According to @Szabolcs, the font for windows is Latin Modern and we need to install this font on windows which can be installed from this web. Then running this code on windows gives the desired results

  plot = Plot[Sin[x], {x, -5, 5}, Frame -> True, PlotRange -> {-1, 1}, 
  LabelStyle -> {FontFamily -> "LM Roman 12", Black, FontSize -> 22}, 
  FrameLabel -> (MaTeX[#, 
       FontSize -> 22] &) /@ {"\\delta(x) \\ -4 \\ 0\\ 4 ", 
     "\\beta_i(y)"}, Axes -> False, ImageSize -> 300]   

enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ No, it is not correct to say that "the font is LM Roman 12". The font is called Latin Modern. This is the official website for this open-source font: gust.org.pl/projects/e-foundry/latin-modern I do not recommend getting it from other sources, especially not from sources like the one you linked, which often repackage open-source fonts in non-ideal ways. $\endgroup$
    – Szabolcs
    May 31 at 9:13
  • 1
    $\begingroup$ Because of its advanced features, such as the availability of optical sizes, the Latin Modern font will show up under different names on different operating systems. On Windows, the 12 pt optical size version appears to show up as "LM Roman 12". But you show not be googling to download a font with this name. Once again, for future readers, get it from here: gust.org.pl/projects/e-foundry/latin-modern $\endgroup$
    – Szabolcs
    May 31 at 9:15
  • $\begingroup$ thanks @Szabolcs for the explanation, I will modify the link and put the one you mentioned. $\endgroup$ May 31 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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