TeXLive 2007中文配置指南

OOo,TeX,KO,ABI,GIMP,Picasa,ProE,QCAD,Inkscape,Kicad,Eagle
yulewang
帖子: 154
注册时间: 2006-08-12 22:00

TeXLive 2007中文配置指南

#1

帖子 yulewang » 2007-04-21 19:18

那麼多時間不來這裡,忘了貼這個東西.....

另外這裡的置頂貼都可以撤下來了,基本上都過時了.

http://mailboxpublic.googlepages.com/te ... inesehowto
-------------
很多人看不到,就把内容也直接贴在这里
=======================================================================
TeXLive 2007 CJK Chinese HowTO

Yue Wang

Attention:

In TeXLive 2007, there is no need to use CJK package anymore, XeTeX is good enough to handle Chinese and Open/TrueType fonts. and the key problem of XeTeX, i.e. the font switching problem, is tend to be fixed in the next release of XeTeX. But many old documents are written using macropackages/styles based on CJK or CCT, some of them are still widely used today, so, in some cases it is essential to install these fonts.


Install TeXLive
_________________
First, install TeXLive.

wget ftp://ftp.tsinghua.edu.cn/mirror/CTAN/s ... 12.iso.zip
unzip texlive2007-live-20070212.iso.zip
mount -o loop texlive2007-live-20070212.iso /mnt
cd /mnt
sudo ./install-tl

press I to install.

Setup System Path
_________________
Set the path. Take debian GNU/Linux as example, modify your /etc/environment like this and make a reboot:

PATH="/usr/local/texlive/2007/bin/i386-linux:/usr/local/matlab/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games"
LANG="en_US.UTF-8"
LANGUAGE="en_US.UTF-8"

Copy The Files Needed
_________________
make a dir called font, copy the font here.
mkdir ~/font
cd ~/font
cp /media/sda/windows/Fonts/simhei.ttf .

copy all the files needed.
sudo apt-get install fontforge
cp /usr/local/texlive/2007/texmf-dist/source/latex/CJK/utils/subfonts/* ~/font/
cp /usr/local/texlive/2007/texmf/fonts/sfd/*.sfd ~/font/

ExpandStroke The Font(Not Essential)
_________________________
before you use fontforge to make the fonts, you can also expandstroke it provided that yo have a very fast computer. Although it is not a good idea to expandstroke the Heiti, we still take it as an exaple. create the stroke.pe like below and run "time fontforge -script stroke.pe simhei.ttf simheinew.ttf" it takes me 46 minutes to perform the task.

Open($1)
SelectAll()
foreach
CorrectDirection()
ExpandStroke(10, 0, 0, 0, 1)
Simplify()
endloop
Generate($2)


Generate Font
______________
Then, make the font. It is a good way to test how fast your computer is Smile it takes me 3 minutes to generate the fonts[Core Duo 2]. If you strok the font, don't forget to overwrite simhei.ttf.
time fontforge -script subfonts.pe simhei.ttf hei Unicode.sfd

create a file name makemap like this:

for i in *.tfm
do
cat >> hei.map << EOF
${i%.tfm} ${i%.tfm} < ${i%.tfm}.pfb
EOF
done


Make map file:
chmod +x makemap
./makemap

create a file name c70hei.fd for CJK package:

% This is c70hei.fd for CJK package.
% created by Edward G.J. Lee
% modify by Yue Wang
\ProvidesFile{c70hei.fd}
\DeclareFontFamily{C70}{hei}{\hyphenchar \font\m@ne}
\DeclareFontShape{C70}{hei}{m}{n}{<-> CJK * hei}{}
\DeclareFontShape{C70}{hei}{bx}{n}{<-> CJKb * hei}{\CJKbold}
\endinput


Copy Fonts into TEXMF
_________________
create the local directory to save the font
cd ~/.texlive2007
cd texmf-var
mkdir -p fonts/map/dvips/CJK
mkdir -p fonts/tfm/CJK/hei
mkdir -p fonts/type1/CJK/hei
mkdir -p tex/latex/CJK/UTF8
cp ~/font/hei.map fonts/map/dvips/CJK/
cp ~/font/*.tfm fonts/tfm/CJK/hei
cp ~/font/*.pfb fonts/type1/CJK/hei
cp ~/font/c70hei.fd tex/latex/CJK/UTF8


Update The System and Test
_____________________
Just run:
texhash
updmap --enable Map hei.map


create a test file to test your work.

\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{hei}
你好!
\end{CJK}
\end{document}


latex test.tex
xdvi test.dvi
dvipdfm test.dvi
xpdf test.pdf
pdflatex test.pdf
......



Virtual GBK Font(Not Essential)
________________________

The main goal of virtual fonts is to make one font for various encoding systems. We still take simhei as an example to tell the reader how to create one UTF8 font for UTF8 and GBK encodings.

first, Let's suggest that you have finished the task of creating a utf8 heiti font for LaTeX and you are still in the ~/font directory with all the fonts and scripts undeleted. you also copy all the utf8 fonts into your ~/.texlive2007 directory and they are working with no problem.

run these commands. if you do not delete something , *.tfm and uni2sfd.pl are still in your ~/font dir.
perl uni2sfd.pl hei UGBK.sfd gbkhei gbk
mkdir ~/.texlive2007/texmf-var/fonts/tfm/CJK/gbkhei
mv gbkhei*.tfm ~/.texlive2007/texmf-var/fonts/tfm/CJK/gbkhei
mkdir ~/.texlive2007/texmf-var/fonts/vf
mv gbkhei*.vf ~/.texlive2007/texmf-var/fonts/vf
mkdir ~/.texlive2007/texmf-var/tex/latex/CJK/GBK

create a file named c19hei.fd just like the c70hei.fd in
~/.texlive2007/texmf-var/tex/latex/CJK/GBK

% This is c19hei.fd for CJK package.
% created by Edward G.J. Lee
\ProvidesFile{c19hei.fd}
\DeclareFontFamily{C19}{hei}{\hyphenchar \font\m@ne}
\DeclareFontShape{C19}{hei}{m}{n}{<-> CJK * gbkhei}{}
\DeclareFontShape{C19}{hei}{bx}{n}{<-> CJKb * gbkhei}{\CJKbold}
\endinput


make a test file in *GBK* encoding like this:

\documentclass{article}
\usepackage{CJK}
\begin{document}
\begin{CJK}{GBK}{hei}
你好
\end{CJK}
\end{document}


if you are lucky, you will get the good outputs without problem (no texhash or updmap needed)

Use ttf directedly in pdftex/dvipdfmx[not recommended]
----------------------------------------------------
Well, our pdflatex/dvipdfmx can also use ttf directedly.
create ~/.texlive2007/texmf-var/fonts/map/dvipdfm/cid-x.map

gbkhei@UGBK@ UniGB-UCS2-H :0:simhei.ttf
hei@Unicode@ unicode :0:simhei.ttf

move the font simhei.ttf to the truetype directory:
mkdir ~/.texlive2007/texmf-var/fonts/truetype
cp simhei.tff ~/.texlive2007/texmf-var/fonts/truetype


create the map generating file makemap-enc

for i in hei*.tfm
do
cat >> hei-enc.map << EOF
${i%.tfm} < ${i%.tfm}.enc < simhei.ttf
EOF
done

generate the map:
chmod +x makemap-enc
./makemap-enc

copy all the file needed
cp hei-enc.map ~/.texlive2007/texmf-var/fonts/map/pdftex/CJK/
mkdir -p ~/.texlive2007/texmf-var/fonts/enc/CJK/hei
cp hei*.enc ~/.texlive2007/texmf-var/fonts/enc/CJK/hei

copy the adobe font:
sudo mkdir ~/.texlive2007/texmf-var/fonts/cmap
sudo apt-get install cmap-adobe-*
cp -a /usr/share/fonts/cmap/* ~/.texlive2007/texmf-var/fonts/cmap



test that it works:

The UTF8 encoding test file:

\pdfoutput=1
\pdfmapfile{=hei-enc.map}
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{hei}
你好
\end{CJK}
\end{document}

The GBK encoding test file(save it in gbk first!):

\pdfoutput=1
\pdfmapfile{=hei-enc.map}
\documentclass{article}
\usepackage{CJK}
\begin{document}
\begin{CJK}{GBK}{hei}
你好
\end{CJK}
\end{document}

Install Ctex macro package
-----------------------------------------

There are two versions of ctex macro package, one for GBK and one for UTF-8.
First, be sure to install all the chinese fonts using simsun.ttf(If you use
simsun.ttc, break it) simhei.ttf, simli.ttf, simkai.ttf, simfang.ttf,
simyou.ttf just follow the example of simhei before.

then, copy all the macropackages in Liangzi's CTeXLive-2005
sudo mount -o loop CTeXLive2005 /mnt
cp -a /mnt/2005/texmf-local/tex/latex/ctex ~/.texlive2007/texmf-var/tex/latex
cp -a /mnt/2005/texmf-local/tex/latex/ctexutf8
~/.texlive2007/texmf-var/tex/latex
cp -a /mnt/2005/texmf-local/tex/latex/ccmap ~/.texlive2007/texmf-var/tex/latex

modify all the fd files there.
for those fd file in ctexutf8 directory, use song,fang ... instead of unisong,
unifang, unisongsl,unifangsl....., for those fd files in ctex directory, use
gbksong instead of gbksongsl, gbkfang instead of gbkfangsl....
And dont use \CJKbold , use hei instead.


an example file should like:
in utf8 directory

\ProvidesFile{c70rm.fd}
[2006/06/09 v0.8 ctex
font definition file]

\DeclareFontFamily{C70}{rm}{\hyphenchar \font\m@ne}
\DeclareFontShape{C70}{rm}{m}{n}{<-> CJK * song}{}
\DeclareFontShape{C70}{rm}{bx}{n}{<-> CJK * hei}{}
\DeclareFontShape{C70}{rm}{m}{sl}{<-> CJK * song}{}


in ctex directory

\ProvidesFile{c19sf.fd}
[2006/06/09 v0.8 ctex
font definition file]
\DeclareFontFamily{C19}{sf}{\hyphenchar \font\m@ne}
\DeclareFontShape{C19}{sf}{m}{n}{<-> CJK * gbkyou}{}
\DeclareFontShape{C19}{sf}{bx}{n}{<-> CJKb * gbkhei}{}
\DeclareFontShape{C19}{sf}{m}{sl}{<-> CJK * gbkyou}{}
\DeclareFontShape{C19}{sf}{bx}{sl}{<-> CJKb * gbkhei}{}
\DeclareFontShape{C19}{sf}{m}{it}{<-> CJK * gbkyou}{}
\DeclareFontShape{C19}{sf}{bx}{it}{<-> CJKb * gbkhei}{}
\endinput


Last,run texhash and test the files.
Utf8 test file

\documentclass{ctexreputf8}
\begin{document}
你好
\end{document}

GBK test file

\documentclass{ctexrep}
\begin{document}
你好
\end{document}
头像
hualang0929
帖子: 1226
注册时间: 2006-11-11 10:23
来自: Mars
联系:

#2

帖子 hualang0929 » 2007-04-21 22:56

哈哈,lz应该很忙。
本来早想帮lz把这贴转过来的,不过看到你有个id在这个坛子,还是lz自己贴比较好。
lz的googlepage看久了眼花,还不如贴在 ctex 那贴上来
抬头望星空一片晴,我独行,夜已渐寒……
yulewang
帖子: 154
注册时间: 2006-08-12 22:00

#3

帖子 yulewang » 2007-04-22 14:51

應該把代碼用個小框框起來的.
不過我不會這麼弄,好像googlepages沒有這個功能的說.
誰有空就做一下吧.
头像
yangcheng
帖子: 498
注册时间: 2005-09-27 18:24
来自: 杭州

#4

帖子 yangcheng » 2007-04-30 21:37

googlepage可以上传一个html文件来实现...
wangyuanzju
帖子: 77
注册时间: 2005-10-14 20:24

#5

帖子 wangyuanzju » 2007-04-30 22:33

是不是不在教育网下不了?这个版本与其它tug镜像上的不一样吗?
wangyuanzju
帖子: 77
注册时间: 2005-10-14 20:24

#6

帖子 wangyuanzju » 2007-04-30 22:36

比较过大小,这个与ctex的镜像是一样的
头像
hualang0929
帖子: 1226
注册时间: 2006-11-11 10:23
来自: Mars
联系:

#7

帖子 hualang0929 » 2007-05-08 12:10

教育网的上ctex下吧,lz提供的连接好象很不稳定。
抬头望星空一片晴,我独行,夜已渐寒……
头像
sukiyak
帖子: 33
注册时间: 2007-05-12 10:45

#8

帖子 sukiyak » 2007-05-12 10:57

新人报道!
弱弱的问一句,怎么在Ubuntu 6.10 系统中进入Texlive啊? :em06
佩长铗兮握四海升平,邀明月兮放九天高远。
头像
bearscafe
帖子: 694
注册时间: 2007-05-05 23:11

#9

帖子 bearscafe » 2007-05-13 17:28

为什么要用live 2007? LaTeX+GBK不是用得很好吗?
wangyuanzju
帖子: 77
注册时间: 2005-10-14 20:24

#10

帖子 wangyuanzju » 2007-05-20 22:43

看了说明还是有点晕,文档开头说在TexLive 2007里,XeTeX已经可以处理中文字体了。只不过是因为考虑到要兼容以前用CJK/CCT写的文档才需要进行文档下面给出的生成字体等一系列操作。这样是不是说如果不考虑兼容性,只要求用新的XeTeX方法来写中文LaTeX文档的话,就不需要做这些操作了?
ltkun
帖子: 1340
注册时间: 2006-01-10 19:09

#11

帖子 ltkun » 2007-05-24 12:45

其实feisty默认安装好
latex-cjk-chinese的几个字体就能处理utf8编码的tex文档了 根本不需要附加下载任何文件
还是apt-get解决问题最方便

example在
/usr/share/doc/latex-cjk-chinese/examples/arphic-sampler.tex
yulewang
帖子: 154
注册时间: 2006-08-12 22:00

#12

帖子 yulewang » 2007-05-24 23:34

說明幾個問題:

1 有了XeTeX, 你確實在大多數情況下無需這麼做.
不過XeTeX的語言需要你自己用jjgod的xcp來換,並作好可能和你macro package不兼容的準備.

2 為什麼不用gbkfonts?因為
a gbkfonts不是萬能的
b gbkfonts生成的字型不一定好
c debian已把locale統一成utf8,而用gbk字需要反復切換terminal編碼
d 我也講述了虛擬字型的做法,可以使用gbk字型
e gbkfont是王垠做的


3 latex-cjk-chinese中僅可安裝一些不能用,不符合國家標準,字數很少,字型很少的字(cybert太難看大家都知道,bsmi,gbsn,bkai,gkai四個字型只有兩種字,並要不斷換,而且不符合國家標準),所以必需使用sim系列or 方正系列的字體.

4 我已經做好了300M大的字體包供大家使用,包括了12個字體的gbk/utf8字型,並給TeXLive, ctexutf8宏包等作了一系列的bug fix.在水木TeX版的置底ftp上,歡迎使用.
ltkun
帖子: 1340
注册时间: 2006-01-10 19:09

#13

帖子 ltkun » 2007-05-27 11:31

升级到7.10 发现ubuntu竟然摒弃了debian的tetex-bin的封装形式,直接用texlive2007了
头像
fire3
帖子: 76
注册时间: 2007-05-29 18:12
来自: THU
联系:

#14

帖子 fire3 » 2007-05-31 23:35

ltkun 写了:升级到7.10 发现ubuntu竟然摒弃了debian的tetex-bin的封装形式,直接用texlive2007了
是么?回头我也升级一把:)
wentrue
帖子: 21
注册时间: 2007-03-09 20:20

#15

帖子 wentrue » 2007-06-02 19:54

网页链接打不开呢
回复