在mac上使用不同的latex中文字体并修改字号

发布时间 2023-06-14 10:59:20作者: 摇头晃脑学知识

参考:Mac中使用LaTeX的中文字体出现Package fontspec Error: The font “宋体“ cannot be found.解决方案

修改全文字体:

\setCJKmainfont{STSong}%衬线字体 
\setCJKsansfont{STHeitiSC-Light}%serif是有衬线字体sans serif无衬线字体。 # 试下来好像只有这个有效
\setCJKmonofont{STFangsong}%中文等宽字体

在文中修改部分字体:

{\songti 你好世界!}
{\lishu 你好世界!}
{\heiti 你好世界!}

字号修改:

\newcommand{\chuhao}{\fontsize{42pt}{1.25\baselineskip}\selectfont}     %初号
\newcommand{\xiaochuhao}{\fontsize{36pt}{1.25\baselineskip}\selectfont} %小初号
\newcommand{\yihao}{\fontsize{28pt}{1.25\baselineskip}\selectfont}      %一号
\newcommand{\erhao}{\fontsize{21pt}{1.25\baselineskip}\selectfont}      %二号
\newcommand{\xiaoerhao}{\fontsize{18pt}{1.25\baselineskip}\selectfont}  %小二号
\newcommand{\sanhao}{\fontsize{15.75pt}{1.25\baselineskip}\selectfont}  %三号
\newcommand{\sihao}{\fontsize{14pt}{1.25\baselineskip}\selectfont}%     四号
\newcommand{\xiaosihao}{\fontsize{12pt}{1.25\baselineskip}\selectfont}  %小四号
\newcommand{\wuhao}{\fontsize{10.5pt}{1.25\baselineskip}\selectfont}    %五号
\newcommand{\xiaowuhao}{\fontsize{9pt}{1.25\baselineskip}\selectfont}   %小五号
\newcommand{\liuhao}{\fontsize{7.875pt}{1.25\baselineskip}\selectfont}  %六号
\newcommand{\qihao}{\fontsize{5.25pt}{1.25\baselineskip}\selectfont}    %七号

调整示例:
{\lishu\erhao 这里写上标题}