CJK-Latex 的安装(转)[@more@]
经两天的努力,终在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 /
如 /usr/local/tetex/share/texmf/ttf2pk/ttfonts.map 里没 cyberb@Unicode@ cyberbit.ttf 这一行,请加上
(缺省文件里是已经有的了)
为 /usr/local/tetex/share/texmf/web2c/updmap.cfg 添加一行
//
Map cyberb.map
/
# texhash
(更新配置)
这时cyberb字体该能用了,可用 simple-utf8.tex 测试测试
七 安装中文字体
其实中文字体和unicode字体的安装大同小异,下面介绍 simsun.ttf (鼎鼎大名了,怎么获取就不必多说)的安装,其它类似
# mkdir -p /usr/local/tetex/share/texmf/fonts/tfm/truetype/gbksong
# mkdir -p /usr/local/tetex/share/texmf/pdftex/truetype/gbksong
# cd /usr/local/tetex/share/texmf/fonts/tfm/truetype/gbksong
# ttf2tfm /usr/local/tetex/share/texmf/fonts/truetype/simsun.ttf -P 3 -E 1 -q -w gbksong@/usr/local/tetex/share/texmf/ttf2pk/UGBK@
# mv *.enc /usr/local/tetex/share/texmf/pdftex/truetype/gbksong
# ttf2tfm /usr/local/tetex/share/texmf/fonts/truetype/simsun.ttf -P 3 -E 1 -s 0.167 -q -w gbksongsl@/usr/local/tetex/share/texmf/ttf2pk/UGBK@
# mv *.enc /usr/local/tetex/share/texmf/pdftex/truetype/gbksong
在 /usr/local/tetex/share/texmf/pdftex/config 里建立 gbksong.map 文件,文件每两行格式如下
(有几个gbksong??.enc就有几行)
//
gbksong01 gbksongsl01 //
在 /usr/local/tetex/share/texmf/ttf2pk/ttfonts.map 加入两行
///
gbksong@UGBK@ simsun.ttf Pid = 3 Eid = 1
gbksongsl@UGBK@ simsun.ttf Slant = 0.167 Pid = 3 Eid = 1
//
为 /usr/local/tetex/share/texmf/web2c/updmap.cfg 添加一行
//
Map gbksong.map
/
加个新文件 /usr/local/tetex/share/texmf/tex/latex/CJK/GB/c19song.fd ,内容如下
(其实cyberb字体也要加的,但缺省UTF8目录里已经存在c70song.fd)
///
% This is the file c19song.fd of the CJK package
% for using Asian logographs (Chinese/Japanese/Korean) with LaTeX2e
%
% created by Werner Lemberg
%
% Version 4.5.2 (28-Mar-2003)
deffileversion{4.5.2}
deffiledate{2003/03/28}
ProvidesFile{c19song.fd}[filedatespacefileversion]
% 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
更多的字体可写个脚本让他自动安装
八 感谢
Helmer Aslaksen
“Chinese TeX Using the CJK LaTeX Package, Unicode TrueType fonts and PDFTeX under Windows”
heligb
linuxforum上几篇介绍tetex安装的文章
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8225414/viewspace-940247/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/8225414/viewspace-940247/