How to install LaTeX packages for Tex Live?

If you install TeXLive from the ubuntu repositories (Ubuntu software Center). Then tlmgr isn't installed, because all packages should use the system package management system 'apt-get'. Hence you get the error:

tlmgr: command not found

So you will have to install the package manually:

Download algorithm2e.sty here

Then, go to the folder ~/texmf or ~/.texmf it depends, if it doesn't exist create it:

mkdir ~/texmf

and copy algorithm2e.sty to it. Then run:

sudo texhash

put in root password when requested.

unfortunately, the TexLive packages in Ubuntu are not very often updated so some errors might come up.

The alternative is manually installing the entire TexLive distribution and following the guide you posted.

Hope that helps


TeXLive is divided into collections. Every TeXLive package belongs to one (and only one) collection, for example the package algorithm2e belongs to the collection science. For simplicity, most distributions, including Ubuntu, do not have a package for every individual TeXLive package, but group together all the TeXLive packages in a given collection and distribute the entire collection as a single package.

In Ubuntu, the TeXLive collection foo is distributed as the Ubuntu package texlive-foo, so for example the collection science is distributed as the Ubuntu package texlive-science. Hence, the Ubuntu answer to your question about how to install the TeXLive package algorithm2e is that you need to install the Ubuntu package texlive-science. (Of course, a side effect is that it will also install all the other packages in the science collection.)

The standard way to determine which collection a TeXLive packages belongs to is to use 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

But in Ubuntu, tlmgr is not installed. I like to use apt-file:

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

or you can search for it in the "Search the contents of packages" section of http://packages.ubuntu.com/.


go to ubuntu software center, and install the software TeX Live: Additional fonts.