Pages

Saturday, July 20, 2013

TeX Live:tlmgr管理工具、宏包安装位置

本文依据TeX Live 官方中文文档写成(texlive-zh-cn),命令行输入texdoc texlive-zh-cn命令可打开此文件

tlmgr管理工具简单使用教程

Tex Live 包含一个叫 tlmgr 的程序,它可以用来管理安装后的TeX Live系统。

基本使用

  • 打开图形界面:
    tlmgr -gui
Windows用户也可从开始菜单打开。
  • 在初始安装之后,你可以用下面的命令更新系统:
    tlmgr update -all
  • 如果这太激进了一点,先尝试:
    tlmgr update -all -dry-run
  • 或 (产生更少输出):
    tlmgr update -list
  • 下面这个更复杂一点的例子从本地目录添加了一个新的软件包集合,用于 XeTeX 引擎。
    tlmgr -repository /local/mirror/tlnet install collection-xetex
(输出省略)
tlmgr 会安装所有依赖的包,也会处理所有包括刷新文件名数据库和重新生成格式文件在内的所有必要的安装后工作。上面给 XeTeX 生成了新的格式文件。
  • 要描述一个包 (或者集合、安装方案):
    tlmgr show collection-latexextra

Tex Live 目录结构与宏包安装位置

Tex Live 的顶层目录

顶层目录

bin TEX         系统程序,按平台组织。
readme.html     网页,提供了多种语言的简介和有用的链接。
readme-*.dir    Tex Live 多种语言的简介和有用的链接,同时有 HTML 和纯文本版本。
source          所有程序的源代码,包括主要的基于 Web2C  TEX 发行版。
texmf-dist      最主要的文件树,见下文的 TEXMFDIST
tlpkg           用来维护安装程序所用到的脚本,程序和数据,以及对 Windows 的特殊支持。

文档

命令:texdoc name-to-lookup

如:
texdoc texlive-zh-cn   # 打开TeX Live的中文文档
texdoc ctex
顶层目录下的 doc.html 文件中提供的完整的链接会有帮助。程序的文档 (手册,man page, Info 文件等) 在 texmf-dist/doc 目录下,因为这些程序本身是属于 texmf 目录的。TEX 宏包与格式文件的文档则放在 texmf-dist/doc 目录。但不管放在哪个地方,你都可以使用 texdoc 程序来寻找这些文档。
TeX Live 本身的文档在 texmf-dist/doc/texlive 目录下。

预定义的 texmf 目录树概览

所有这些目录树,包括个人的,都应该遵循 TEX 目录结构 (TDS, http://tug.org/tds),包括其 中所有细小的子目录,否则文件就可能找不到。

命令:tlmgr conf 列出系统中用于指定 texmf 目录的所有预定义变量

输出示例:
=========================== version information ==========================
tlmgr revision 31082 (2013-07-03 06:25:56 +0200)
tlmgr using installation: /opt/texlive/2013
TeX Live (http://tug.org/texlive) version 2013

==================== executables found by searching PATH =================
PATH: /usr/local/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/texlive/2013/bin/x86_64-linux
kpsewhich: /usr/local/bin/kpsewhich
updmap: /usr/local/bin/updmap
fmtutil: /usr/local/bin/fmtutil
tlmgr: /usr/local/bin/tlmgr
tex: /usr/local/bin/tex
pdftex: /usr/local/bin/pdftex
mktexpk: /usr/local/bin/mktexpk
dvips: /usr/local/bin/dvips
dvipdfmx: /usr/local/bin/dvipdfmx
=========================== active config files ==========================
texmf.cnf: /opt/texlive/2013/texmf.cnf
updmap.cfg: /opt/texlive/2013/texmf-dist/web2c/updmap.cfg
fmtutil.cnf: /opt/texlive/2013/texmf-var/web2c/fmtutil.cnf
config.ps: /opt/texlive/2013/texmf-dist/dvips/config/config.ps
mktex.cnf: /opt/texlive/2013/texmf-dist/web2c/mktex.cnf
pdftexconfig.tex: /opt/texlive/2013/texmf-dist/tex/generic/config/pdftexconfig.tex
============================= font map files =============================
psfonts.map: /opt/texlive/2013/texmf-var/fonts/map/dvips/updmap/psfonts.map
pdftex.map: /opt/texlive/2013/texmf-var/fonts/map/pdftex/updmap/pdftex.map
ps2pk.map: /opt/texlive/2013/texmf-var/fonts/map/dvips/updmap/ps2pk.map
dvipdfm.map: =========================== kpathsea variables ===========================
TEXMFMAIN=/opt/texlive/2013/texmf-dist
TEXMFDIST=/opt/texlive/2013/texmf-dist
TEXMFLOCAL=/opt/texlive/2013/../texmf-local
TEXMFSYSVAR=/opt/texlive/2013/texmf-var
TEXMFSYSCONFIG=/opt/texlive/2013/texmf-config
TEXMFVAR=/home/starfish/.texlive2013/texmf-var
TEXMFCONFIG=/home/starfish/.texlive2013/texmf-config
TEXMFHOME=/home/starfish/.texlive/texmf
VARTEXFONTS=/home/starfish/.texlive2013/texmf-var/fonts
TEXMF={/home/starfish/.texlive2013/texmf-config,/home/starfish/.texlive2013/texmf-var,/home/starfish/.texlive/texmf,!!/opt/texlive/2013/texmf-config,!!/opt/texlive/2013/texmf-var,!!/opt/texlive/2013/../texmf-local,!!/opt/texlive/2013/texmf-dist}
SYSTEXMF=/opt/texlive/2013/texmf-var:/opt/texlive/2013/../texmf-local:/opt/texlive/2013/texmf-dist
TEXMFDBS={!!/opt/texlive/2013/texmf-config,!!/opt/texlive/2013/texmf-var,!!/opt/texlive/2013/../texmf-local,!!/opt/texlive/2013/texmf-dist}
WEB2C={/home/starfish/.texlive2013/texmf-config,/home/starfish/.texlive2013/texmf-var,/home/starfish/.texlive/texmf,!!/opt/texlive/2013/texmf-config,!!/opt/texlive/2013/texmf-var,!!/opt/texlive/2013/../texmf-local,!!/opt/texlive/2013/texmf-dist}/web2c
TEXPSHEADERS=.:{/home/starfish/.texlive2013/texmf-config,/home/starfish/.texlive2013/texmf-var,/home/starfish/.texlive/texmf,!!/opt/texlive/2013/texmf-config,!!/opt/texlive/2013/texmf-var,!!/opt/texlive/2013/../texmf-local,!!/opt/texlive/2013/texmf-dist}/{dvips,fonts/{enc,type1,type42,type3}}//
TEXCONFIG={/home/starfish/.texlive2013/texmf-config,/home/starfish/.texlive2013/texmf-var,/home/starfish/.texlive/texmf,!!/opt/texlive/2013/texmf-config,!!/opt/texlive/2013/texmf-var,!!/opt/texlive/2013/../texmf-local,!!/opt/texlive/2013/texmf-dist}/dvips//
ENCFONTS=.:{/home/starfish/.texlive2013/texmf-config,/home/starfish/.texlive2013/texmf-var,/home/starfish/.texlive/texmf,!!/opt/texlive/2013/texmf-config,!!/opt/texlive/2013/texmf-var,!!/opt/texlive/2013/../texmf-local,!!/opt/texlive/2013/texmf-dist}/fonts/enc//
TEXFONTMAPS=.:{/home/starfish/.texlive2013/texmf-config,/home/starfish/.texlive2013/texmf-var,/home/starfish/.texlive/texmf,!!/opt/texlive/2013/texmf-config,!!/opt/texlive/2013/texmf-var,!!/opt/texlive/2013/../texmf-local,!!/opt/texlive/2013/texmf-dist}/fonts/map/{kpsewhich,pdftex,dvips,}//
==== kpathsea variables from environment only (ok if no output here) ====

预定义目录的意义

TEXMFDIST 这个目录树包含几乎所有原有发行版本的文件——配置文件、脚本、宏包、字体等等。唯一的例外是每个平台的可执行文件,存储在与它同级的 bin/ 目录下。
TEXMFLOCAL 系统管理员用来安装供整个系统使用的额外的或更新过的宏包、字体的目录。
TEXMFHOME 给用户存放它们自己独立安装的的宏包、字体等等。这个变量根据不同的用户选择不同的主目录。
TEXMFCONFIG  texconfigupdmap、和 fmtutil 这些程序存储个人修改过的配置文件。
TEXMFSYSCONFIG  texconfig-sysupdmap-sys  fmtutil-sys 这些程序存储修改过的全局文件。
TEXMFVAR 这个目录是给 texconfigupdmap  fmtutil 存储 (缓存) 格式文件、生成 map 文件这类运行时个人数据的。
TEXMFSYSVAR  texconfig-sysupdmap-sys  fmtutil-sys 还有 tlmgr 这几个命令存储、缓存运行时使用的格式文件和生成的 map 文件,对整个系统都有效。
TEXMFCACHE ConTEXt MkIV  LuaL A TEX用来保存(缓存的)运行时数据的目录树;缺省为TEXMFSYSVAR,如果该目录不可写,则使用 TEXMFVAR

默认的目录结构:

系统目录

全系统根目录 可以包含多个 TEX Live 版本:
    2012 上一个版本。
    2013 当前版本。
        bin
            i386-linux GNU/Linux 二进制文件
            ...
            universal-darwin Mac OS X 二进制文件
            win32 Windows 二进制文件
        texmf-dist TEXMFDIST  TEXMFMAIN
        texmf-var TEXMFSYSVAR, TEXMFCACHE
        texmf-config TEXMFSYSCONFIG
    texmf-local TEXMFLOCAL 用来存放在不同版本间共享的数据。

用户目录

用户主 (home) 目录 ($HOME 或 %USERPROFILE%)
    .texlive2012 给上个版本的,个人生成和配置的数据。
    .texlive2013 给这个版本的,个人生成和配置的数据。
        texmf-var TEXMFVAR, TEXMFCACHE
        texmf-config TEXMFCONFIG
    texmf TEXMFHOME 个人的宏包文件,等等。等等。
知道了TeX Live组织目录的规则,我们手动安插宏包、字体时就要有章可循了。
Written with StackEdit.

No comments:

Post a Comment