+ -
当前位置:首页 → 问答吧 → Slackware teTeX + Chinese mini-HOWTO

Slackware teTeX + Chinese mini-HOWTO

时间:2003-12-18

来源:互联网

This is a quick solution to setup CJK for Slackware Linux 9/-current.

(1) Install tetex package

(2) Prepare localized directory tree
# mkdir -p /usr/share/texmf-local/tex/latex/

(3) Download latest CJK, e.g., 4.5.2 from the following link:
ftp://ftp.ffii.org/pub/cjk/

Uncompress the CJK package, then:
# mv cjk-4.5.2/texinput/ /usr/share/texmf-local/tex/latex/CJK

(4) Build tools:
gbkfonts, it requires header file from freetype 1.x
http://learn.tsinghua.edu.cn/homepag.../programs.html
ttf2pk, it is included in contrib/ of freetype 1.x, build it
statically since your system may have freetype2 installed!

(5) Build fonts from TTF fonts:
# cd /usr/share/texmf-local/
# gbkfonts /usr/X11R6/lib/X11/fonts/TTF/simsun.ttc song
# gbkfonts /usr/X11R6/lib/X11/fonts/TTF/simhei.ttc hei
# gbkfonts /usr/X11R6/lib/X11/fonts/TTF/simkai.ttc kai
# gbkfonts /usr/X11R6/lib/X11/fonts/TTF/simfang.ttc fs
# gbkfonts /usr/X11R6/lib/X11/fonts/TTF/fzwbjw.ttc fzweibeis
# gbkfonts /usr/X11R6/lib/X11/fonts/TTF/fzwbfw.ttc fzweibeit

Move generated file in the current directory
(/usr/share/texmf-local) to correct location:
# mv cid-x.map dvipdfm/config/
# mv cjk.map dvips/config/
# cp ../texmf/dvips/config/config.ps dvips/config/
# echo "p +cjk.map" >> dvips/config/config.ps
# mv pdftex.cfg pdftex/config/

(6) Clean up:
# cd tex/latex/CJK/
# rm -rf JIS/ KS/ SJIS/ thai/ CEF/

# /usr/share/texmf/bin/mktexlsr

(7) Change permissions:
# chown -R root:root /usr/share/texmf-local/

(8) Add /usr/local/texmf-local/bin in $PATH:
# vi /etc/profile.d/tetex.csh /etc/profile.d/tetex.sh

作者: terminator   发布时间: 2003-12-18

###################################################
Move generated file in the current directory
(/usr/share/texmf-local) to correct location:
# mv cid-x.map dvipdfm/config/
# mv cjk.map dvips/config/
# cp ../texmf/dvips/config/config.ps dvips/config/
# echo "p +cjk.map" >> dvips/config/config.ps
# mv pdftex.cfg pdftex/config/
#############################################
1.only "cp cjk.map and updmap --enable Map `pwd`/cjk.map " needed.
all tools will use the type1 fonts by default. other files would be used if you want to support truetype font.
2. cp -r tex /usr/share/texmf-local/ (don't forgot)
3. if needed, you should modify the *.fd files in /usr/share/texmf-local/tex/latex/...(sorry, i forgot it), you can take the pre-existed files in cjk package for example to support Bold in chinese.


may we exchange some ideas about TeX with each other.

作者: gnwd   发布时间: 2003-12-20

TeXLive CD has CJK support built-in since release 7.
Simply enable it when doing setup.

作者: lang2   发布时间: 2003-12-20

> 1.only "cp cjk.map and updmap --enable Map `pwd`/cjk.map " needed.
> all tools will use the type1 fonts by default. other files would be used if you > want to support truetype font.

haven't tried this. gbkfonts generated lots of fonts of afm, tfm, and type1. Frankly speaking, I do not know too much of the fonts.

> 2. cp -r tex /usr/share/texmf-local/ (don't forgot)

not necessary. See my original post, in fact I run the gbkfonts in /usr/share/texmf-local.

> 3. if needed, you should modify the *.fd files in /usr/share/texmf-local/tex/latex/...(sorry, i forgot it), you can take the pre-existed files in cjk package for example to support Bold in chinese.

Not necessary, these are automatically generated by gbkfonts.

> may we exchange some ideas about TeX with each other.

welcome, but do not expect too much from me 'coz I know little about TeX. This mini-HOWTO is just one of my test of TeX.

作者: terminator   发布时间: 2003-12-20

BTW, this solutions does not change anything in the main texmf directory. All the new files and changes are in /usr/local/texmf-local. So it's safe to tar the texmf-loca directory and copy to other machines directly.

作者: terminator   发布时间: 2003-12-20

引用:
最初由 terminator 发表
[/b]
> 3. if needed, you should modify the *.fd files in /usr/share/texmf-local/tex/latex/...(sorry, i forgot it), you can take the pre-existed files in cjk package for example to support Bold in chinese.

Not necessary, these are automatically generated by gbkfonts.

[/b]
no, gbkfonts will yield c19song.fd for you. but you still need change it to support CJKbold.

作者: gnwd   发布时间: 2003-12-22

按上述办法试了一下,但是在/usr/share/texmf-local/中没有发现bin目录,需要自己建立吗?要cp哪些东西进去呢?

作者: windrose   发布时间: 2004-01-30

yes, you need to create the bin directory by yourself, just copy the gbkfonts and ttf2pk binaries into bin. you can copy them to /usr/local/bin as well. they are only required for building gbkfonts from truetype fonts.

作者: terminator   发布时间: 2004-01-30

我的体会:gbkfonts似乎不需要ttf2pk,我下载源码之后make clean && make就能生成可执行的gbkfonts了。但是gbkfonts只能在它的源码目录中运行,在别的目录下指明gbkfonts的路径或者直接cp到其他目录下,运行会出错。运行gbkfonts之后,只要按gnwd的方法做就可以了。

作者: windrose   发布时间: 2004-01-30

you are right, ttf2pk is not required for gbkfonts. I built it because somebody mentioned it can be used for latex to use truetype font directly, but I have not tried it.

作者: terminator   发布时间: 2004-01-31

for the execution error of gbkfonts, I guess you build it with dynamic linking against freefont1. if you build it statically, there's no problem that you execute it anywhere.

作者: terminator   发布时间: 2004-01-31

Where can I download dvipdfmx soure ?

作者: Zodlaic   发布时间: 2004-01-31

Where can I download dvipdfmx soure ?

作者: Zodlaic   发布时间: 2004-01-31

引用:
最初由 Zodlaic 发表
Where can I download dvipdfmx soure ?
http://project.ktug.or.kr/dvipdfmx/

next time, google before you ask

作者: windrose   发布时间: 2004-02-01

前提:按前面terminator的方法安装并设置好CJK

一、下载及安装
下载地址:
http://project.ktug.or.kr/dvipdfmx/snapshot/release/
从中下载当前版本dvipdfmx-20031116.tar.gz。
不建议从 http://project.ktug.or.kr/dvipdfmx/snapshot/current/ 下载最新版(当前是dvipdfmx-20031207.tar.gz),因为其中可能有bug,导致产生pdf文件时有一堆Warnings提示。

下载到的是源代码,需要解开后自行编译。需要注意的是运行configure前要设置两个环境变量:
export CPPFLAGS=-I/usr/share/texmf/include LDFLAGS=-L/usr/share/texmf/lib

configure时也要指定参数:
./configure --bindir=/usr/share/texmf/bin --datadir=/usr/share
make
su -c 'make install' (或 su -c checkinstall,假如你安装了checkinstall)

二、安装后的设置
按上述方法安装之后,dvipdfmx中没有对中文的支持,需要进行适当的设置。

1. 完善CMap目录
dvipdfmx安装时,会在/usr/share/texmf/dvipdfm中建立CMap目录,但其中没有中文的CMap。由于CMap是Acrobat制定的标准,具有通用性,因此可以下载Acrobat的文件。一个简单的方法是借用xpdf中文包中的CMap文件:
ftp://ftp.foolabs.com/pub/xpdf/xpdf-...plified.tar.gz
解压缩后,将其CMap目录下的所有文件cp到 /usr/share/texmf/dvipdfm/CMap/ 即可。

2.设置ttf字体目录
在/usr/share/texmf/web2c/texmf.cnf中,指定了从$TEXMF/fonts/truetype目录中查找truetype字体,因此需要:
mkdir /usr/share/texmf/fonts/truetype
然后把几种中文字体cp或ln到这个目录中,也可以直接修改上述texmf.cnf文件,指定truetype字体的路径。

3.建立ttf2pk目录

mkdir /usr/share/texmf/ttf2pk

ttf2pk是freetype 1中提供的一个工具,使得TeX可以使用truetype字体。
下载: ftp://ftp.freetype.org/freetype/free...contrib.tar.gz
也可以从freetype的其他镜像下载这个文件,解开文件后,我们需要的是 ttf2pk/data/中的文件:
cp ttf2pk/data/* /usr/share/texmf/ttf2pk/

3.修改dvipdfmx.cfg文件
用文本编辑器打开 /usr/share/texmf/dvipdfm/dvipdfmx.cfg,找到一行:
f dvipdfm.map
在它前面加个%注释掉,使之不起作用。

4.运行texhash使系统能找到我们新增的所有文件。

至此,dvipdfmx设置完毕。

作者: windrose   发布时间: 2004-02-23

怎么我用gbkfonts时有好多错误和警告?而且好象陷入了死循环一样,我的系统是Slack9.1,gbkfonts是从清华那个牛人的网站下的。

作者: hallan   发布时间: 2004-03-27

如图:
上传的图像
error3.jpg (74.4 KB, 102 次查看)

作者: hallan   发布时间: 2004-03-27

set locale to C
LANG=C,then try it again

作者: gnwd   发布时间: 2004-03-28

http://pub.uibe.edu.cn/~20031/mywiki...TexFromScratch

作者: wblue   发布时间: 2004-03-29

热门下载

更多