I started using MaTeX and it is all wonderful expect for the fact I am unable to use the "Latin Modern Math" , "LM 12" to work for the tickmarks. I get decent results with "Times" but not quite perfect. If Is use any of "Latin Modern Math" , "LM Roman 12", as in

  LabelStyle -> Directive[FontSize -> 20, FontFamily -> "Latin Modern Math", Black]]

it simply reverts to default. Using the known example of the MaTeX tutorial

<< MaTeX`
texStyle = {FontFamily -> "Latin Modern Math", FontSize -> 12};
ContourPlot[x^2 + y^4 == 1, {x, -1.2, 1.2}, {y, -1.2, 1.2}, 
BaseStyle -> texStyle, 
Epilog -> {Arrow[{{0.1, 0.3}, {0.5, 0.80}}], 
Inset[MaTeX["x^2+y^4=1", Magnification -> 2], {0.1, 0.3}, 
Scaled[{0.5, 1}]]}] 

yields this

enter image description here

I stumbled across these posts

Why "Modern Latin Math" font messes my plot?


MaTeX doesn't change fonts on axes?

where mention is made of the possibility to download a new font, yet I am unable to find out, here and the Wolfram documentation, how to add a new font to Mathematica.

Any hint would be much appreciated.

I tried installing the new font in Windows directly (is that the way?), but it appears not too sharp at all. I am also not clear on why it shows as "Latin Modern Roman" in Format/Font, but I need to type "LM Roman 12" in the code...

enter image description here

  • 1
    $\begingroup$ Your last example shows that it works. What exactly is the problem? The font name is different on every OS, as noted in the MaTeX tutorial (please use the built-in documentation, accessible through the Documentation Centre, not the blog post on my website). Why it has a different name on every OS is a mystery to me ... $\endgroup$
    – Szabolcs
    Mar 7, 2020 at 22:18
  • $\begingroup$ @Szabolcs, it does somehow work, but quality is very poor. That is why I was wondering if downloading the font to Windows is the right way, or something else directly in Mathematica was to be done. I read the documentation, that is how I even got to the "LM Roman 12" name. As said though, I can hardly believe the font is supposed to looks so unsharp. $\endgroup$
    – Smerdjakov
    Mar 7, 2020 at 22:30
  • 1
    $\begingroup$ Yes, you have to install the font globally for your operating system. Does it still look bad if you export the figure to PDF? It's hard to tell what's going on from your screenshot because JPEG encoding itself reduces the quality significantly. It looks fine on my machine (macOS) and as I remember, it looked fine last time I tried it on Windows. But Windows's font rendering is does not do well with fonts which were not designed (and hinted) for it. All this should not matter if the figure is exported to PDF or rasterized at printing resolution. $\endgroup$
    – Szabolcs
    Mar 7, 2020 at 22:34
  • $\begingroup$ @Szabolcs, it looks much better indeed when PDF-ed, thanks again loads $\endgroup$
    – Smerdjakov
    Mar 7, 2020 at 22:52
  • $\begingroup$ A not complete installation of LaTeX can lead to poor PDF quality. See here. $\endgroup$
    – vi pa
    Mar 8, 2020 at 9:40


Your Answer

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

Browse other questions tagged or ask your own question.