Latex 中文支持CJK的安装与配置

来源:互联网 发布:济南知豆电动汽车租赁 编辑:程序博客网 时间:2024/05/21 22:32
Latex中文支持CJK的安装与配置
在这里记一下自己Latex中文安装与配置的方法,为还没有搞定这个问题的朋友们提供一点小小的帮助.
CJK的安装包可以从这里下载得到:
http://www.cjk.org
我们还可以从王垠的个人主页下载一个方便安装的程序:
http://learn.tsinghua.edu.cn/homepage/2001315450/tex_frame.html
我们现在认为我们将下载下来的安装程序放在我们的用户主目录下.下面开始我们的安装工作:
1 进入/usr/local/share目录,执行下面的命令来创建我们要用到的目录:
mkdir -p texmf/tex/latex/CJK
mkdir -p texmf/fonts/truetype/chinese
2 回到我们用户主目录,解压CJK安装包:
tar -xvzf cjk-4.6.0.tar.gz
3 进入解压后的目录,将texinput目录拷贝到我们刚创建的CJK目录下:
cd cjk-4.6.0
mv texinput /usr/local/share/texmf/tex/latex/CJK
4 解压字体生成程序:
tar -xvzf gbkfonts-linux-0.3.tar.gz
5 进入解压后的目录,拷贝相应的程序到相应的目录:
cp go appendconf gbkfonts /usr/local/bin
6 修改go程序:
vi /usr/local/bin/go
找到下面的部分:
gbkfonts ${opts[*]} $dir/simsun.ttf song
gbkfonts ${opts[*]} $dir/simkai.ttf kai
gbkfonts ${opts[*]} $dir/simhei.ttf hei
gbkfonts ${opts[*]} $dir/simfang.ttf fs
一般来说我们用这些字体程序就可以了,如果再没有其他的字体了,我们就可以将下面的我们不会用到的内容注释掉.
7 拷贝我们需要的字体到/usr/local/share/texmf/fonts/truetype/chinese目录,一般来说这个字体程序是由windows目录下拷过来的,在这里我们用到的是simsun.ttc,simhei.ttf,simkai.ttf,simfang.ttf四种字体,并将simsun.ttc改名为simsun.ttf
8 生成字体:
cd /usr/local/share/texmf
go fonts/truetype/chines
这样我们就会看到字体的生成过程了.
9 执行下面的命令:
appendconf /usr/local/share/texmf
10 修改Tex的配置文件:
vi /usr/share/texmf/dvips/config/config.ps
找到 o | lpr 一行,将其注释掉,在下面加入下面一行:
p +cjk.map
11 更新Tex字体数据库:
mktexlsr
如果我们还算顺利现在我们就可以在Tex中使用汉字了,我们可以简单的写一个测试文件test.tex:
/documentclass{article}
/usepackage{CJK}
/begin{document}
/begin{CJK*}{GBK}{song}
哈哈,你好CJK!
/end{CJK*}
/end{document}
保存退出后,执行下面的命令:
latex test.tex
这样就会生成一个test.dvi文件,我们可以用下面的命令来预览一下:
xdvi test.dvi
如果我们看到可以正确的显示中文就说明我们的安装配置已经成功了.
参考:http://www.linuxsir.org

还有一本何勃亮老师写的CJK的安装教程,很不错的,基本上就是靠他来搞定的.





Fedora 15 上的中文LaTeX配置

Mike Manilone posted @ Fri, 03 Jun 2011 12:26:07 +0800 in Fedora with tags 中文latex 中文tex ctex latex , 3351 readers

在Linux中,最常用的[tex]\TeX[/tex]套装就是TeXLive了,而且Fedora官方源中也有它,不过只是个2007版,而且也没有中文配置……

好吧,在Fedora维基中我找到了TeXLive2010套装,可以参考这里。

我这里使用的安装命令是

pkcon install texlive texlive-latex texlive-xetex texlive-ctex #因为是fedorapeople,所以速度超慢

这样就安装到带有ctex-kit包的TeXLive!

如果你需要ctex要用的中文字体,可以下在这里的奥多比中文字体集并安装。以下就是一个测试!

\documentclass[adobefonts]{ctexart}\begin{document}世界你好!\LaTeX{}你好!\TeX{}你好!C\TeX 你好!\end{document}

可以正常在Linux下使用带有中文支持的[tex]\TeX[/tex]咯!

 

推荐的LaTeX工作环境是Emacs + AucTeX,安装也很简单——pkcon install emacs emacs-auctex。

顺便,其实,我发现这个源里面有所有CTAN里面有的,所以比如你需要beamer这个包,只要安装 texlive-beamer 即可。



想分享本文?找一个要分享的地方吧!

微型提示,看看最底下的版权声明,不了解的话请点击那个链接获得更多信息。

小提示,署名方式即添上出处(URL)。



error: kpathsea library not found

错误的处理,下载地址:http://mirror.bjtu.edu.cn/CTAN/systems/win32/w32tex/

然后参考http://dvi2bitmap.sourceforge.net/ssn71.htx/N-a5b1c1.html

5.1.1 Obtaining the kpathsea library

Not all TeX distributions install the kpathsea library, even though they install applications built with it, and the texmf.cnf configuration file which controls it.

If the library does not appear to be in your distribution, then you can obtain and build it yourself. The library is distributed as part of the web2c (Unix TeX source) distribution, which you can find at<ftp://ftp.tug.org/tex/web2c.tar.gz>, or mirrored on CTAN sites (for example at <http://www.tex.ac.uk> in directory systems/web2c).

Take a copy of the library (this is a big distribution), and unpack it. Go into the kpathsea directory and do the usual `./configure; make; make install' routine. With (some?) older distributions of the library this appeared not to work, and you had to go to the parent of the kpathsea directory, delete the web2c directory (which is the bulk of the distribution), then configure and build it as usual, ignoring the warnings about the missing main texmf tree.


有人说:安装这个就可以。解压以后复制到相应的目录。

http://cygwin.cybermirror.org/release/tetex/tetex-devel/




http://blog.csdn.net/defeattroy/article/details/7581846