FC9包含了Texlive2007套件。由于我是用rpm安装的,没有预先安装CJK,用源码安转太麻烦,Baidu了一下,发现
xetex就可以简单地配置
中文,在此总结一下。
1. XetexXeTeX(发音
/ˈziːtɛx/) 是一款使用
Unicode的TeX排版
系统(TeX typesetting engine),支持现代字体
技术如
OpenType和
Apple Advanced Typography。它由Jonathan Kew编写和维护,基于
X11 free software license发布。
Xetex的字体安装相当简单,并且可以使用任何已经安装在系统上的字体,无须重新配置Tex字体.
Xetex可以结合
latex工作,只要在Latex文件中加入一些配置,其他地方不用改变。Xetex的Latex对应命令为xelatex, 已经被加进了TexLive.
2. 查看系统字体输入命令 fc-list 来查看系统安装的字体。可以输入参数如 fc-list :lang=zh来差中文字体。在我的系统下,fc-list的输出中中文字体有
WenQuanYi Bitmap Song:style=BoldAR PL ZenKai Uni,文鼎PL中楷Uni:style=MediumFangsong ti:style=RegularWenQuanYi Bitmap Song:style=RegularAR PL ShanHeiSun Uni,文鼎PL細上海宋Uni,文鼎PL细上海宋Uni:style=Regular在Latex就可以直接利用这些字体。
3. 安装中文字体复制
Windows下的中文字体如 simsun.ttf 等 到目录
/usr/share/fonts/zh_CN/TrueType
然后在此目录下执行以下命令
mkfontscale
mkfontdir
fc-cache
texhash
重新查看系统中文字体fc-list :lang=zh ,输出
WenQuanYi Bitmap Song:style=BoldNSimSun,新宋体:style=RegularSimSun,宋体:style=RegularSimHei,黑体:style=RegularAR PL ZenKai Uni,文鼎PL中楷Uni:style=MediumFangsong ti:style=RegularWenQuanYi Bitmap Song:style=RegularAR PL ShanHeiSun Uni,文鼎PL細上海宋Uni,文鼎PL细上海宋Uni:style=Regular4. xetex使用中文\documentclass[12pt,a4paper]{article}
\def\pgfsysdriver{pgfsys-dvipdfm.def}
\usepackage{fontspec,indentfirst}
\usepackage{xunicode}% provides unicode character macros
\usepackage{xltxtra} % provides some fixes/extras
\usepackage[margin=1.5cm]{geometry}
\usepackage{tikz}
\defaultfontfeatures{Mapping=tex-text} %如果没有它,会有一些 tex 特殊字符无法正常使用,比如连字符。
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt
\newcommand\fontnamekai{
AR PL ZenKai Uni}
\newcommand\fontnamesong{
AR PL ShanHeiSun Uni}
%设置
文档正文字体为宋体
\setmainfont[BoldFont=\fontnamekai]{\fontnamesong}
\newfontinstance\KAI{\fontnamekai}
\newcommand{\kai}[1]{{\KAI #1}}
\renewcommand{\baselinestretch}{1.2}
\begin{document}
\begin{itemize}
\kai
\item
{\Huge 楷体}
{\huge 楷体}
{\LARGE 楷体}
{\Large 楷体}
{\large 楷体}
{\normalsize 楷体}
{\small 楷体}
{\footnotesize 楷体}
{\scriptsize 楷体}
{\tiny 楷体}
\end{itemize}
\end{document}
5. 编译xelatex file.tex