经两天的努力,终在redhat 9上将CJK-latex装上了。我发现,中文网站上虽然有不少介绍如何安装的文章,
但如你依样画葫芦,并不能得到想要得结果。几经折腾,最后参考篇英文的相关文章才能正确的使用中文字体。
以下是我的安装过程
($,#后分别为普通用户,超级用户执行的命令)
一 下载相关软件到用户目录
tetex-texmf-2.0.2.tar.gz (http://www.tug.org/teTeX/)
tetex-src-2.0.2.tar.gz
cjk-4.5.2-doc.tar.gz (http://cjk.ffii.org/)
cjk-4.5.2.tar.gz
freetype-current.tar.gz (http://www.freetype.org)
freetype1-contrib-current.tar.gz
dvipdfmx-20040411.tar.gz (http://project.ktug.or.kr/dvipdfmx/)
二 安装 tetex
$ tar zxvf tetex-src-*.tar.gz
# mkdir -p /usr/local/tetex/share/texmf
# tar zxvf tetex-texmf-*.tar.gz -C /usr/local/tetex/share/texmf/
$ cd tetex-src-*
$ ./configure --prefix=/usr/local/tetex --disable-multiplatform --without-xdvik --without-oxdvik
$ make
# make world
# PATH=/usr/local/tetex/bin:$PATH
# export PATH
(可在/etc/profile中将tetex路径加到PATH中)
这时可写个简单的英文 tex 文件(见附件里的hello.tex),看能不能用 latex 生成 dvi 文件,用 dvipdfm 生成 pdf 文件
三 安装 CJK
# mkdir -p /usr/local/tetex/share/texmf/tex/latex/CJK
# mkdir -p /usr/local/tetex/share/texmf/doc/latex/CJK
$ tar zxvf cjk-*.tar.gz
$ tar zxvf cjk-*-doc.tar.gz
$ cd cjk-*
# cp -R texinput/* /usr/local/tetex/share/texmf/tex/latex/CJK
# cp -R doc /usr/local/tetex/share/texmf/doc/latex/CJK
四 安装 freetype1-contrib
$ tar zxvf freetype-current.tar.gz
$ tar zxvf freetype1-contrib-current.tar.gz -C freetype-current
$ cd freetype-current
$ ./configure
$ make
$ cd freetype1-contrib-current/ttf2pk
$ ./configure --with-kpathsea-lib=/usr/local/tetex/lib --with-kpathsea-include=/usr/local/tetex/include --enable-shared --disable-static --with-kpathsea-dir=/usr/local/tetex --prefix=/usr/local/tetex
$ make
# make install
# mkdir -p /usr/local/tetex/share/texmf/ttf2pk
# cp data/* /usr/local/tetex/share/texmf/ttf2pk
(如需要其它ttf工具,可类似ttf2pk安装,但不需要拷数据.)
五 安装 dvipdfmx
$ tar xzvf dvipdfmx-*.tar.gz
$ cd dvipdf*
$ ./configure --prefix=/usr/local/tetex --with-kpathsea=/usr/local/tetex
$ make
# make install
这时可测试 dvipdfmx 能否生成 pdf
六 安装unicode字体(ftp://ftp.netscape.com/pub/communicator/extras/fonts/windows/Cyberbit.ZIP)
# mkdir -p /usr/local/tetex/share/texmf/fonts/truetype
解压Cyberbit.ZIP ,将 Cyberbit.ttf 重命名 cyberbit.ttf 并拷到/usr/local/tetex/share/texmf/fonts/truetype
# mkdir -p /usr/local/tetex/share/texmf/fonts/tfm/truetype/cyberb
# mkdir -p /usr/local/tetex/share/texmf/pdftex/truetype/cyberb
# cd /usr/local/tetex/share/texmf/fonts/tfm/truetype/cyberb
# ttf2tfm /usr/local/tetex/share/texmf/fonts/truetype/cyberbit.ttf -q -w cyberb@/usr/local/tetex/share/texmf/ttf2pk/Unicode@
# mv *.enc /usr/local/tetex/share/texmf/pdftex/truetype/cyberb
在 /usr/local/tetex/share/texmf/pdftex/config 里建立 cyberb.map 文件,文件每行格式如下
(有几个cyberb??.enc就有几行)
/////////////////////////////
cyberb00
%
% Version 4.5.2 (28-Mar-2003)
\def\fileversion{4.5.2}
\def\filedate{2003/03/28}
\ProvidesFile{c19song.fd}[\filedate\space\fileversion]
% Chinese characters (extension of GB 2312)
%
% character set: GBK
% font encoding: CJK (extended)
\DeclareFontFamily{C19}{song}{}
\DeclareFontShape{C19}{song}{m}{n}{ CJK * gbksong}{}
\DeclareFontShape{C19}{song}{bx}{n}{ CJKb * gbksong}{}
\DeclareFontShape{C19}{song}{m}{it}{ CJK * gbksongsl}{}
\DeclareFontShape{C19}{song}{bx}{it}{ CJKb * gbksongsl}{}
\DeclareFontShape{C19}{song}{m}{sl}{ CJK * gbksongsl}{}
\DeclareFontShape{C19}{song}{bx}{sl}{ CJKb * gbksongsl}{}
\endinput
//////////////////////////////////////////////////////////////
# texhash
更多的字体可写个脚本让他自动安装