XeLaTeX+xeCJK中文字体设置

来源:互联网 发布:恒生数据 编辑:程序博客网 时间:2024/05/21 09:18

原文地址:http://blog.csdn.net/archielau/article/details/7960229


注意:一定要保证tex所存格式为UTF8,否则xeCJK汉字不显示。

一、宏包

\documentclass[a4paper,twocolumn]{article} %两列  \usepackage{graphicx}%插图宏集  \usepackage{titletoc}%要调整章节标题在目录页中的格式,可以用titletoc宏包 title of contents  \usepackage{titlesec} %其中 center 可使标题居中,还可设为 raggedleft (居左,默认),  %\usepackage{abstract}摘要分栏的宏包  \usepackage{fontspec, xunicode, xltxtra}  \usepackage{xeCJK}%中文字体  

二、紧接上面,以下是字体和字号设置

xeCJK中可以直接使用系统字体,查看已安装中文字体,命令行输入fc-list :lang=zh-cn

\setmainfont{Times New Roman}<span style="white-space:pre">                         </span>%缺省英文字体 Times New Roman  \setCJKmainfont[ItalicFont={楷体_GB2312}, BoldFont={黑体}]{宋体}<span style="white-space:pre">        </span>%衬线字体 缺省中文字体为  \setCJKsansfont{黑体}<span style="white-space:pre">                               </span>%serif是有衬线字体sans serif无衬线字体。  \setCJKmonofont{仿宋_GB2312}<span style="white-space:pre">                            </span>%中文等宽字体  %-----------------------xeCJK下设置中文字体------------------------------%  \setCJKfamilyfont{song}{SimSun}                             %宋体 song  \newcommand{\song}{\CJKfamily{song}}                        % 宋体   (Windows自带simsun.ttf)  \setCJKfamilyfont{xs}{NSimSun}                              %新宋体 xs  \newcommand{\xs}{\CJKfamily{xs}}  \setCJKfamilyfont{fs}{FangSong_GB2312}                      %仿宋2312 fs  \newcommand{\fs}{\CJKfamily{fs}}                            %仿宋体 (Windows自带simfs.ttf)  \setCJKfamilyfont{kai}{KaiTi_GB2312}                        %楷体2312  kai  \newcommand{\kai}{\CJKfamily{kai}}                            \setCJKfamilyfont{yh}{Microsoft YaHei}                    %微软雅黑 yh  \newcommand{\yh}{\CJKfamily{yh}}  \setCJKfamilyfont{hei}{SimHei}                                    %黑体  hei  \newcommand{\hei}{\CJKfamily{hei}}                          % 黑体   (Windows自带simhei.ttf)  \setCJKfamilyfont{msunicode}{Arial Unicode MS}            %Arial Unicode MS: msunicode  \newcommand{\msunicode}{\CJKfamily{msunicode}}  \setCJKfamilyfont{li}{LiSu}                                            %隶书  li  \newcommand{\li}{\CJKfamily{li}}  \setCJKfamilyfont{yy}{YouYuan}                             %幼圆  yy  \newcommand{\yy}{\CJKfamily{yy}}  \setCJKfamilyfont{xm}{MingLiU}                                        %细明体  xm  \newcommand{\xm}{\CJKfamily{xm}}  \setCJKfamilyfont{xxm}{PMingLiU}                             %新细明体  xxm  \newcommand{\xxm}{\CJKfamily{xxm}}    \setCJKfamilyfont{hwsong}{STSong}                            %华文宋体  hwsong  \newcommand{\hwsong}{\CJKfamily{hwsong}}  \setCJKfamilyfont{hwzs}{STZhongsong}                        %华文中宋  hwzs  \newcommand{\hwzs}{\CJKfamily{hwzs}}  \setCJKfamilyfont{hwfs}{STFangsong}                            %华文仿宋  hwfs  \newcommand{\hwfs}{\CJKfamily{hwfs}}  \setCJKfamilyfont{hwxh}{STXihei}                                %华文细黑  hwxh  \newcommand{\hwxh}{\CJKfamily{hwxh}}  \setCJKfamilyfont{hwl}{STLiti}                                        %华文隶书  hwl  \newcommand{\hwl}{\CJKfamily{hwl}}  \setCJKfamilyfont{hwxw}{STXinwei}                                %华文新魏  hwxw  \newcommand{\hwxw}{\CJKfamily{hwxw}}  \setCJKfamilyfont{hwk}{STKaiti}                                    %华文楷体  hwk  \newcommand{\hwk}{\CJKfamily{hwk}}  \setCJKfamilyfont{hwxk}{STXingkai}                            %华文行楷  hwxk  \newcommand{\hwxk}{\CJKfamily{hwxk}}  \setCJKfamilyfont{hwcy}{STCaiyun}                                 %华文彩云 hwcy  \newcommand{\hwcy}{\CJKfamily{hwcy}}  \setCJKfamilyfont{hwhp}{STHupo}                                 %华文琥珀   hwhp  \newcommand{\hwhp}{\CJKfamily{hwhp}}    \setCJKfamilyfont{fzsong}{Simsun (Founder Extended)}     %方正宋体超大字符集   fzsong  \newcommand{\fzsong}{\CJKfamily{fzsong}}  \setCJKfamilyfont{fzyao}{FZYaoTi}                                    %方正姚体  fzy  \newcommand{\fzyao}{\CJKfamily{fzyao}}  \setCJKfamilyfont{fzshu}{FZShuTi}                                    %方正舒体 fzshu  \newcommand{\fzshu}{\CJKfamily{fzshu}}    \setCJKfamilyfont{asong}{Adobe Song Std}                        %Adobe 宋体  asong  \newcommand{\asong}{\CJKfamily{asong}}  \setCJKfamilyfont{ahei}{Adobe Heiti Std}                            %Adobe 黑体  ahei  \newcommand{\ahei}{\CJKfamily{ahei}}  \setCJKfamilyfont{akai}{Adobe Kaiti Std}                            %Adobe 楷体  akai  \newcommand{\akai}{\CJKfamily{akai}}    %------------------------------设置字体大小------------------------%  \newcommand{\chuhao}{\fontsize{42pt}{\baselineskip}\selectfont}     %初号  \newcommand{\xiaochuhao}{\fontsize{36pt}{\baselineskip}\selectfont} %小初号  \newcommand{\yihao}{\fontsize{28pt}{\baselineskip}\selectfont}      %一号  \newcommand{\erhao}{\fontsize{21pt}{\baselineskip}\selectfont}      %二号  \newcommand{\xiaoerhao}{\fontsize{18pt}{\baselineskip}\selectfont}  %小二号  \newcommand{\sanhao}{\fontsize{15.75pt}{\baselineskip}\selectfont}  %三号  \newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\selectfont}%     四号  \newcommand{\xiaosihao}{\fontsize{12pt}{\baselineskip}\selectfont}  %小四号  \newcommand{\wuhao}{\fontsize{10.5pt}{\baselineskip}\selectfont}    %五号  \newcommand{\xiaowuhao}{\fontsize{9pt}{\baselineskip}\selectfont}   %小五号  \newcommand{\liuhao}{\fontsize{7.875pt}{\baselineskip}\selectfont}  %六号  \newcommand{\qihao}{\fontsize{5.25pt}{\baselineskip}\selectfont}    %七号  %------------------------------标题名称中文化-----------------------------%  \renewcommand\abstractname{\hei 摘\ 要}  \renewcommand\refname{\hei 参考文献}  \renewcommand\figurename{\hei 图}  \renewcommand\tablename{\hei 表}  %------------------------------定理名称中文化-----------------------------%  \newtheorem{dingyi}{\hei 定义~}[section]  \newtheorem{dingli}{\hei 定理~}[section]  \newtheorem{yinli}[dingli]{\hei 引理~}  \newtheorem{tuilun}[dingli]{\hei 推论~}  \newtheorem{mingti}[dingli]{\hei 命题~}  \newtheorem{lizi}{{例}}        \begin{document}  \title{高质量纹理重建中的遮蔽处理}  \author{Archie}  \date{}  %摘要单栏设置  \twocolumn[      \begin{@twocolumnfalse}      \maketitle<span style="white-space:pre">                        </span>%生成标题      \renewcommand{\abstractname} {}<span style="white-space:pre">           </span>%不显示摘要名字      \begin{abstract}      \noindent<span style="white-space:pre">         </span>%摘要无缩进      摘要正文      \end{abstract}      \renewcommand{\abstractname}{摘要}      \end{@twocolumnfalse}  ]    正文        \end{document}