Centos中如何配置Texlive2013中文字体的问题:
第一步是下载你需要的字体,我从windows/fonts中拷贝的比较多,你只要复制你需要的字体即可。
注意只要文件扩展名为ttf的文件,ttc的文件不要复制。
windows/fonts中没有simkai.ttf,只有simkai.ttc,这个好办,在网上下一个simkai.ttf即可:
simfang.ttf SIMFANG.TTF simhei.ttf SIMHEI.TTF simkai.ttf SIMKAI.TTF SIMLI.TTF simsun.ttf SIMSUN.TTF SIMYOU.TTF STCAIYUN.TTF STENCIL.TTF STFANGSO.TTF STHUPO.TTF STKAITI.TTF STLITI.TTF STSONG.TTF STXIHEI.TTF STXINGKA.TTF STXINWEI.TTF stzhongs.ttf 华文行楷.ttf 华文琥珀.ttf 华文楷体.ttf 华文细黑.ttf 华文新魏.ttf
以root的身份创建目录/usr/share/fonts/chinese/TrueType,然后将所有的字体文件复制到centos的该字体目录中
cp -rf /d3/SoftWare/cn_font/*.* /usr/share/fonts/chinese/TrueType cd /usr/share/fonts/chinese/TrueType mkfontscale mkfontdir fc-cache -fv
修改一下字体文件的权限,让所有的用户都能使用:
chmod -R 755 /usr/share/fonts/
然后重启电脑,以root身份创建目录iso,安装texlive2013,具体的参见安装说明。
mkdir iso mount -o loop ./texlive20130530.iso ./iso
安装完成之后在~./.bashrc中添加环境变量:
# PATH=/usr/local/texlive/2013/bin/x86_64-linux:$PATH; export PATH MANPATH=/usr/local/texlive/2013/texmf-dist/doc/man:$MANPATH; export MANPATH INFOPATH=/usr/local/texlive/2013/texmf-dist/doc/info:$INFOPATH; export INFOPATH #
修改文件/usr/local/texlive/2013/texmf-dist/tex/latex/ctex/fontset/ctex-xecjk-winfonts.def如下:
% ctex-xecjk-winfonts.def: Windows 的 xeCJK 字体设置,默认为六种中易字体 % vim:ft=tex \setCJKmainfont[BoldFont={SimHei},ItalicFont={KaiTi_GB2312}]{SimSun} \setCJKsansfont{SimHei} \setCJKmonofont{FangSong_GB2312} \setCJKfamilyfont{zhsong}{SimSun} \setCJKfamilyfont{zhhei}{SimHei} \setCJKfamilyfont{zhkai}{KaiTi_GB2312} \setCJKfamilyfont{zhfs}{FangSong_GB2312} \setCJKfamilyfont{zhli}{STLiti} \setCJKfamilyfont{zhyou}{YouYuan} \newcommand*{\songti}{\CJKfamily{zhsong}} % 宋体 \newcommand*{\heiti}{\CJKfamily{zhhei}} % 黑体 \newcommand*{\kaishu}{\CJKfamily{zhkai}} % 楷书 \newcommand*{\fangsong}{\CJKfamily{zhfs}} % 仿宋 \newcommand*{\lishu}{\CJKfamily{zhli}} % 隶书 \newcommand*{\youyuan}{\CJKfamily{zhyou}} % 幼圆 \endinput
下面可以测试一下中文了test.tex:
\documentclass[mathserif]{beamer} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{ctex} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 这是中文! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \end{document}
编译命令如下:
xelatex test xelatex test