6
$\begingroup$

For the FrameLabel, I have:

Style["\[NumberSign] Humans per city", FontFamily -> "Latin Modern Math"]

How can I make only "Humans" in the label to be italic?

$\endgroup$

3 Answers 3

4
$\begingroup$

Something like this might work:

Row[
  {"\[NumberSign] ", Style["Humans", FontSlant -> Italic], " per city"}, 
  BaseStyle -> {FontFamily -> "Latin Modern Math"}]

If you don't want to insert your own spaces, you can add a spacer argument to Row:

Row[
  {"\[NumberSign]", Style["Humans", FontSlant -> Italic], "per city"}, 
  " ", 
  BaseStyle -> {FontFamily -> "Latin Modern Math"}]
$\endgroup$
1
  • $\begingroup$ Yes. If you want Row to do the spacing you need to provide a spacer. I'll update the answer to demonstrate. $\endgroup$
    – lericr
    Nov 8, 2022 at 16:54
5
$\begingroup$

Select "Humans" and press Ctrl-I (or Command-I on macOS) to format it in italics. This is by far the simplest way.

Note that Latin Modern Math is intended only for math, not text, and does not have an italics version. Your OS will likely fake the italics style by simply slanting letters. Install Latin Modern Roman instead to get proper italics.

Illustration:

enter image description here

$\endgroup$
5
  • 1
    $\begingroup$ Latin Modern is a family of fonts that is mostly visually identical to Computer Modern, TeX's default, but unlike Computer Modern, it is created in a modern format that is usable on all common operating systems. Computer Modern is created in MetaFont, so you won't be able to use it with anything else than TeX. When you get this font for your OS, it will come as many different files, all of which are use by the lmodern package. In math mode, lmodern uses the "Math" variant. In text mode, the "Roman" variant. How these actually show up in Mathematica depends on your system, ... $\endgroup$
    – Szabolcs
    Nov 8, 2022 at 17:01
  • $\begingroup$ ... you'll see different names on macOS / Windows / Linux. $\endgroup$
    – Szabolcs
    Nov 8, 2022 at 17:01
  • 1
    $\begingroup$ I don't know the detailed answer to your second question. Latin Modern Math contains some characters that the Roman version does not and vice versa. I guess there are other differences as well, such as spacing, but I do not know for sure. I suspect that the Math variant has OpenType math support. I suggest you use the fonts as intended for best visual results. If you get weird spacings, just use MaTeX. $\endgroup$
    – Szabolcs
    Nov 8, 2022 at 17:02
  • $\begingroup$ You can try all three to see the differences. I expect only "Latin Modern Roman 10" will look the way you want. The second one sounds like it's small caps, the third I don't know. $\endgroup$
    – Szabolcs
    Nov 8, 2022 at 17:10
  • 1
    $\begingroup$ I am not sure why but the display name of this font will be different on macOS, Windows and Linux. This font has different shapes for different sizes. Small sizes have a thicker stroke for better readability and visual balance. Some OS can automatically pick the right font file for each size, and some others present each size as a different font. BTW this is the official download source: gust.org.pl/projects/e-foundry/latin-modern/download $\endgroup$
    – Szabolcs
    Nov 8, 2022 at 18:21
4
$\begingroup$

As per WReach

Style[
 StringJoin["\[NumberSign] ",
  ToString[Style["Humans", Italic], StandardForm], " per city"],
 FontFamily -> "Latin Modern Math"]

# Humans per city

$\endgroup$

Your Answer

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