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$
    – cvgmt
    Sep 19, 2023 at 13:35
  • $\begingroup$ @cvgmt If there is Chinese and western characters in one string? $\endgroup$
    – Y. zeng
    Sep 19, 2023 at 13:57
  • 1
    $\begingroup$ Use Mathematica packageMaTeX( set the TeX engine be XeLaTeX) $\endgroup$
    – cvgmt
    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$

Your Answer

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

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