学习再学习,多少大秘密

25 Oct

texlive2008 网络安装及中文等配置

texlive2008 也出来很久了,差不多第一时间就用上了,其中的新的管理方式和功能使得安
装和配置都变得非常的方便,下面就个人在gentoo linux上的配置过程做一个纪录。本文所
有内容都在gentoo linux上实验通过。

1. 网络安装
texlive的iso算起来有2G以上的个头,就算lzma压缩之后也有1G多,所以下载的等待实在不
是一件好玩的事情,因此采用网络安装的方式进行安装。

首先下载unix-like系统的安装包,一个命令就行
wget ftp://ftp.ctex.org/CTAN/systems/texlive/tlnet/2008/install-tl-unx.tar.gz
不禁在这里感谢下 ctex 网站,这个包1M左右,下载起来都是飞快。

然后解压之后进入这个文件夹, 运行命令
./install-tl -location ftp://ftp.ctex.org/CTAN/systems/texlive/tlnet/2008

简单说明,此时选择安装镜像是ctex的ftp,同样是基于速度考虑,然后深呼吸一下,或喝
口水,再看屏幕,出来了一群说明,不对,这是安装界面。下面开始安装

按下B,选择相应的binary system, 一般来说,这个会自动探测,不用更改。但还是先确
认下的好。。确认之后按R回到安装的界面。

之后就是选择安装的scheme,按下S,可以看到它有好多的建议,这个就自己选了,如果网
络条件也不错硬盘空间也大也懒得以后折腾的,可以选择full…, 由于以后的选择可能会
覆盖这个,这里我先选basic。在后面的custom的时候方便些。

然后按C进入custom方式,选下F,就是Xetex相关的,其他的看自己的需要,可能用到的有
一些推荐的包,当然不装也没有关系,用到了再说。

再按L选择语言, 选个英文(2), CJK咱有Xetex了,用不着了,然后选个文档,最多BE两项。

按D选路径,1修改,最好用一个自己有完全的可读写的路径,以后还有好处,后面再说。

Options 基本不动,下面按下I,就开始安装了,现在出去户外运动下吧,这步操作基于网
速,可能会用很长时间。。。

完成之后,还需要一步,
export PATH=[path/to/texlive]/bin/i386-linux:$PATH
其中,[path/to/texlive]就是在上面选择的安装路径,终端中 export 操作的话,可以用 tab 补全的。
可以写到 .bashrc 中。

然后来个小测试

  1. \documentclass{article}
  2. \begin{document}
  3. Hello, World!
  4. \end{document}

保存成 test.tex, 然后 xelatex test, 就生成了一个 test.pdf 文件。用一个pdf阅读器
打开就应该能看到 hello world 了。

2. 中文的配置
让繁杂的CJK字体配置有多远就闪多远。。 这里用个 zhspacing 或 xeCJK 的包就能完全实
现写中文文章了。
两个选择。 先看 zhspacing, 其主页在 http://code.google.com/p/zhspacing/, 下载
回来后,解压先,然后在 ~/.texlive2008/texmf-var/tex/ 下弄个目录。将解压出来的东
西扔进去,就算是安装好了。

然后翻开zhspacing的文档,照着输入就是了。

xecjk,在 ctex 论坛里面有下载, 同样,解压出来后放到
~/.texlive2008/texmf-var/tex/ 下的某个目录里面,翻出文档来看看,就会用了。

3.升级等操作
装好的东西,有一个管理器,叫做 tlmgr, 先 tlmgr –help 看下大概的操作,对,也有
–location 的选项,和前面一样,弄成ctex的镜像,然后没事了就 tlmgr update –list
一下,会提示有什么包更新了,可以安装, 使用 tlmgr update –all 就可以将刚才看到
的那些包自动更新到最新版本了。因此,现在不用害怕包更新了还要手动去升级了,记得当
时为了beamer的一个bug等升级等了好久,出来后什么都不知道,还一个个解压覆盖了原来
的文件….

另外一个使用的地方,就是查询和安装,比如得到一个模板文件,编译的时候出现,
xxx.sty not found 的提示,就可以采用 tlmgr 进行查询,然后安装。
下面给出一个例子,在编译一份文档时,我发现algorithmic.sty找不到。因此采用如下操
作:
$tlmgr search --global algorithmic.sty

得到输出:
algorithmicx - The algorithmic style you always wanted.
algorithms - A suite of tools for typesetting algorithms in pseudo-code.

然后使用tlmgr进行安装
$tlmgr install algorithmicx algorithms

完成之后再进行编译,OK~

13 Responses to “texlive2008 网络安装及中文等配置”

  1. 1
    jjgod Says:

    export $PATH=:$PATH

    这个写错了…

  2. 2
    zhan Says:

    多谢指出,已经修正。

  3. 3
    Leo D.Knuth Says:

    请问,照着您的教程做,编译源文件test.tex出现问题了。

    源文件:test.tex
    1 \documentclass{article}
    2 \usepackage{zhspacing}
    3 \zhspacing
    4 \begin{document}
    5 中Eng文混排,“标点压缩”,间 距 调 整 ……
    6 \end{document}

    编译时候输出
    This is XeTeXk, Version 3.1415926-2.2-0.999.6 (Web2C 7.5.7)
    %&-line parsing enabled.
    entering extended mode
    (./test_cn.tex
    LaTeX2e
    Babel and hyphenation patterns for english, usenglishmax, dumylang, noh
    yphenation, ukenglish, loaded.
    (/opt/texlive/2008/texmf-dist/tex/latex/base/article.cls
    Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
    (/opt/texlive/2008/texmf-dist/tex/latex/base/size10.clo))

    ! LaTeX Error: File `zhspacing.sty’ not found.

    Type X to quit or to proceed,
    or enter new name. (Default extension: sty)

    Enter file name:
    *****(在这里回车以下)*****
    ! Undefined control sequence.
    \zhspacing

    l.3 \zhspacing

    根据你的文章,我查询了下缺失的sty文件,并安装相对应包
    $tlmgr search –global xkeyval.sty
    输出
    tlmgr: installation location ftp://ftp.comp.hkbu.edu.hk/pub/TeX/CTAN/systems/texlive/tlnet/2008
    xargs – Define commands with many optional arguments.
    $tlmgr install xargs

    但是,在我做完这些工作后,依然不能编译通过,还是提示缺失xkeyval.sty,GOOGLE也没找到原因。请指教。
    期待您的回复。

  4. 4
    zhan Says:

    To Leo D.Knuth:
    你好: 根据你的报错情况来看,首先缺少 zhspacing 包, 可以到 http://code.google.com/p/zhspacing/ 去下载。
    其次,缺少 xkeyval.sty 这个文件,可以采用 tlmgr install xkeyval 来安装。 不得不说实际上 tlmgr 还是有些问题的,比如使用 tlmgr -global xkeyval.sty 去查,就只能得到 xargs 的返回,而使用 tlmgr -global xkeyval 去查,就可以在最后看到有 xkeyval 这个包的存在….

    很多时候,缺少 .sty 的时候,就可以使用 tlmgr install 来安装,不行了再查询,再不行就将 .sty 作为关键字到 google 上搜索,一般都能知道这个文件具体属于哪个包, 这时候再用 tlmgr 来安装。

  5. 5
    tseong Says:

    奇怪了,我照你說的方法做,為什麼我裝玩後沒有xelatex這個命令,用whereis也搜索不到。我是用光盤安裝的。不想裝full,硬盤不夠大。

  6. 6
    tseong Says:

    發現了,我把F按成f,真是不好意思,太粗心了。

    >>然后按C进入custom方式,选下F,就是Xetex相关的,其他的看自己的需要,可能用到的有
    >>一些推荐的包,当然不装也没有关系,用到了再说。

  7. 7
    medical equipments Says:

    medical equipments…

    The history of requirements for quality systems, or at least some elements of quality systems, goes back to pre-historic times. Almost 4,000 years ago, in the 18th century B.C., Hammurabi, the king of Babylonia, developed the first recorded code of law…

  8. 8
    transtone Says:

    既然用gentoo,直接emerge texlive不是方便得多?zhspacing也是可以emerge的。

  9. 9
    shellex Says:

    zhan GG,我这个错误怎么解决哈?
    GG都没结果。
    ===========================================
    Local configuration file hyphen.cfg used
    ===========================================
    (/home/shellex/Programs/texlive/2008/texmf-dist/tex/generic/babel/hyphen.cfg
    (/home/shellex/Programs/texlive/2008/texmf/tex/generic/hyphen/hyphen.tex)
    (/home/shellex/Programs/texlive/2008/texmf/tex/generic/hyphen/ushyphmax.tex)
    (/home/shellex/Programs/texlive/2008/texmf/tex/generic/hyphen/dumyhyph.tex)
    (/home/shellex/Programs/texlive/2008/texmf/tex/generic/hyphen/zerohyph.tex)
    ! I can’t find file `dehypht-x-2008-06-18.tex’.

    \relax
    l.370 \repeat

    (Press Enter to retry, or Control-D to exit)
    Please type another input file name:
    ! Emergency stop.

    \relax
    l.370 \repeat

    No pages of output.
    Transcript written on xelatex.log.’ instead of a filename.
    I can’t find the format file `xelatex.fmt’!

  10. 10
    shellex Says:

    搞定了,但是,我居然装了langgreek。。。

  11. 11
    water Says:

    请问安装了新包后是否要texhash

Leave a Reply



Spam Protection by WP-SpamFree

© 2010 学习再学习,多少大秘密 | Entries (RSS) and Comments (RSS)

Your Index Web Directorywordpress logo