2

I'm labeling one of my axis in a plot as "# of humans":

Style["# of humans", FontFamily -> "Latin Modern Math"]

"#" appears somehow like a square. How can I make it exactly as it appears in this text: "#"?

  • can you provide a complete example showing this? with possibly screen shot and version/os numbers? I just tried your code on its own and on V 13.1 on windows and there was no problem. screen shot Mathematica graphics – Nasser Nov 02 '22 at 16:53
  • oh I see, you mean you want it to be tilted to the right a little? I thought you got an actual square for it. – Nasser Nov 02 '22 at 16:57
  • Are you saying that you get a "#", but it's just a style you don't like, or are you saying there's some sort of error? When you say, "like a square", is it like a red error box or some sort of graphics thing? Is there more to your code than this? – lericr Nov 02 '22 at 16:58
  • @lericr my guess they did get "#" but they wanted the style of it be little different, that of "Latin Mdern Math". I have no idea what "#" should look like in this font. May be link showing that will help. – Nasser Nov 02 '22 at 17:01
  • Is this what you want? screen shot Mathematica graphics – Nasser Nov 02 '22 at 17:03
  • You could just italicize the "#". So create the string "# of humans", and just literally select the # and Command-I (or however you want to perform the action to italicize it). You can do this inside the Style directly, or you can save it for re-use: label = "# of humans" (where the "#" has been italicized). – lericr Nov 02 '22 at 17:21

1 Answers1

3

New answer

I found this symbol in Mathematica. You can use the following.

 Style["\[NumberSign] of humans", FontFamily -> "Latin Modern Math"]

Mathematica graphics


Old answer

ok, you can try

<< MaTeX`
Style[MaTeX["\\text{\# of humans}", Magnification -> 2]]

Mathematica graphics

how can I just use this font for # and use my own font for humans?

You could combine them both. Use Matex only for "#" and everything else use normal Mathematica style

myNiceHash = MaTeX["\\text{\#}", Magnification -> 1.5];
Row[{myNiceHash, Style[" of humans", FontFamily -> "Latin Modern Math"]}]

Mathematica graphics

Compare to

Style["# of humans", FontFamily -> "Latin Modern Math"]

Mathematica graphics

Nasser
  • 143,286
  • 11
  • 154
  • 359
  • @Marteen added. You might want to adjust Magnification of Matex to get same font size as Mathematica. I set it at 1.5 now – Nasser Nov 02 '22 at 17:10
  • @Marteen MaTeX is external package. But very easy to install. Do you have it on your computer? There are instructions how to install it. One pacllet command is all what is needed. But it has prerquists. Check the MaTeX website. You should always have it installed in Mathematica as it is very useful. I use it all the time for labels and such in plots and graphics. see https://github.com/szhorvat/MaTeX – Nasser Nov 02 '22 at 17:13
  • @Marteen see update. This symbol is always in Mathematica actually. – Nasser Nov 02 '22 at 17:25