1
$\begingroup$

There are Chinese and Western charcter in a string. Is there a way to set different font for them? For example:

Plot[Sin[x], {x, 5, 10}, AxesLabel -> {"横坐标", "y axis"}, LabelStyle -> Directive[FontFamily -> {"SimSun"}]] 

Plot[Sin[x], {x, 5, 10}, AxesLabel -> {"横坐标", "y axis"}, LabelStyle -> Directive[FontFamily -> {"SimSun"}]]

How to set western font to be Times New Roman? And why there is a rectangle here?

$\endgroup$
3
  • $\begingroup$ Maybe Plot[Sin[x], {x, 5, 10}, AxesLabel -> {Style["横坐标", FontFamily -> "SimHei", Blue, 20], Style["y axis", FontSlant -> Italic, FontFamily -> "Times", Red, 14]}, LabelStyle -> Directive[FontFamily -> {"SimSun"}], PlotHighlighting -> None] $\endgroup$ Commented Sep 19, 2023 at 13:35
  • $\begingroup$ @cvgmt If there is Chinese and western characters in one string? $\endgroup$ Commented Sep 19, 2023 at 13:57
  • 1
    $\begingroup$ Use Mathematica packageMaTeX( set the TeX engine be XeLaTeX) $\endgroup$ Commented Sep 19, 2023 at 14:05

1 Answer 1

2
$\begingroup$

FontFamily does not support a list of fonts to be used as a fallback. The only way to achieve what you are looking for is to break up the text into separate runs using different styles.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.