如何为 Tex Live 安装 LaTeX 软件包?

Mar*_*dik 22 latex texlive software-installation

显然我使用 Tex Live 作为我的 LaTeX 发行版:

martin@martin-XPS-8300:~$ pdflatex -v

pdfTeX 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian) kpathsea version
6.1.0 Copyright 2012 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX). 
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and the Lesser GNU
General Public License. For more information about these matters, see
the file named COPYING and the pdfTeX source. Primary author of
pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX). Compiled
with libpng 1.2.49; using libpng 1.2.49 Compiled with zlib 1.2.7;
using zlib 1.2.7 Compiled with poppler version 0.20.5
Run Code Online (Sandbox Code Playgroud)

我想使用本指南安装其他软件包。

他们说:

手动安装 TeX Live 后,使用 tlmgr 单独管理包。

tlmgr install <package1> <package2> ... 
tlmgr remove <package1> <package2> ...
Run Code Online (Sandbox Code Playgroud)

但是当我尝试:

tlmgr install algorithm2e
Run Code Online (Sandbox Code Playgroud)

我得到:

tlmgr: command not found
Run Code Online (Sandbox Code Playgroud)

我似乎也没有~/texmf文件夹,只有一个~/.texmf-var文件夹。我的安装是否损坏或我做错了什么?

编辑:

我发现我实际上有一个

/usr/local/share/texmf
Run Code Online (Sandbox Code Playgroud)

编辑2:

命令:

apt-cache policy texlive
Run Code Online (Sandbox Code Playgroud)

结果是:

texlive:
  Installed: 2012.20120611-5
  Candidate: 2012.20120611-5
  Version table:
 *** 2012.20120611-5 0
        500 http://jp.archive.ubuntu.com/ubuntu/ raring/main amd64 Packages
        100 /var/lib/dpkg/status
Run Code Online (Sandbox Code Playgroud)

文件夹。

Min*_*nos 11

如果您从 ubuntu 存储库(Ubuntu 软件中心)安装 TeXLive。然后没有安装 tlmgr,因为所有包都应该使用系统包管理系统 'apt-get'。因此你得到错误:

tlmgr: command not found
Run Code Online (Sandbox Code Playgroud)

因此,您必须手动安装软件包:

下载 在此处algorithm2e.sty

然后,转到该文件夹~/texmf或视情况~/.texmf而定,如果它不存在则创建它:

mkdir ~/texmf
Run Code Online (Sandbox Code Playgroud)

并将 algorithm2e.sty 复制到它。然后运行:

sudo texhash
Run Code Online (Sandbox Code Playgroud)

在要求时输入 root 密码。

不幸的是,Ubuntu 中的 TexLive 软件包不经常更新,因此可能会出现一些错误。

另一种方法是手动安装整个 TexLive 发行版并遵循您发布的指南。

希望有帮助

  • 规范的答案是 http://tex.stackexchange.com/questions/1137/where-do-i-place-my-own-sty-files-to-make-them-available-to-all-my-tex-档案 (2认同)

fkr*_*iem 9

TeXLive 分为集合。每个 TeXLive 包都属于一个(并且只有一个)集合,例如包algorithm2e属于集合science。为简单起见,包括 Ubuntu 在内的大多数发行版都没有为每个单独的 TeXLive 包提供一个包,而是将给定集合中的所有 TeXLive 包组合在一起,并将整个集合作为单个包分发。

在 Ubuntu 中,TeXLive 集合foo作为 Ubuntu 包分发texlive-foo,例如,该集合science作为 Ubuntu 包分发texlive-science。因此,对于您关于如何安装 TeXLive 软件包的问题,​​Ubuntu 的回答algorithm2e是您需要安装 Ubuntu 软件包texlive-science。(当然,一个副作用是它还会安装science集合中的所有其他包。)

确定 TeXLive 包属于哪个集合的标准方法是使用tlmgr

$ tlmgr info algorithm2e
package:     algorithm2e
category:    Package
shortdesc:   Floating algorithm environment with algorithmic keywords.
longdesc:    Algorithm2e is an environment for writing algorithms. An algorithm becomes a floating object (like figure, table, etc.). The package provides macros that allow you to create different keywords, and a set of predefined key words is provided; you can change the typography of the keywords. The package allows vertical lines delimiting a block of instructions in an algorithm, and defines different sorts of algorithms such as Procedure or Function; the name of these functions may be reused in the text or in other algorithms.
installed:   Yes
revision:    28749
sizes:       doc: 661k, run: 137k
relocatable: Yes
cat-version: 5.0
cat-date:    2013-01-06 21:16:44 +0100
cat-license: lppl
collection:  collection-science
Run Code Online (Sandbox Code Playgroud)

但是在Ubuntu下,tlmgr是没有安装的。我喜欢使用apt-file

$ apt-file search algorithm2e.sty
texlive-science: /usr/share/texlive/texmf-dist/tex/latex/algorithm2e/algorithm2e.sty
Run Code Online (Sandbox Code Playgroud)

或者您可以在http://packages.ubuntu.com/的“搜索包的内容”部分中搜索它。