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

显然我使用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 

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

他们说:

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

 tlmgr install   ... tlmgr remove   ... 

但是当我尝试:

 tlmgr install algorithm2e 

我明白了:

 tlmgr: command not found 

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

编辑:

我发现我确实有一个

 /usr/local/share/texmf 

EDIT2:

命令:

 apt-cache policy texlive 

结果是:

 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 

夹。

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

 tlmgr: command not found 

所以你必须手动安装包:

在这里下载algorithm2e.sty

然后,转到它所依赖的文件夹~/texmf~/.texmf ,如果它不存在则创建它:

 mkdir ~/texmf 

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

 sudo texhash 

请求时输入root密码。

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

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

希望有所帮助

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

在Ubuntu中,TeXLive集合foo作为Ubuntu包texlive-foo分发,因此例如集合science作为Ubuntu包texlive-science分发。 因此,Ubuntu回答你关于如何安装TeXLive包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 

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

 $ apt-file search algorithm2e.sty texlive-science: /usr/share/texlive/texmf-dist/tex/latex/algorithm2e/algorithm2e.sty 

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

转到ubuntu软件中心,安装TeX Live软件:附加字体。

我找到的最简单的方法是,只需在ubuntu软件中心搜索软件包。 例如,我需要包“braket”,我只是在软件中心输入,搜索结果显示“TeX Live:LaTeX附加包”,其中包含“braket”包以及一堆其他包,我安装了它和我我很高兴。

或者:

充分利用Texlive的最佳方法是按照以下说明安装Telxlive香草:

https://tex.stackexchange.com/a/95373/63118

这可能会解决与包和其他所有相关的所有问题。