TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

According to my ubuntu 11.04 my texlive is the latest version. But when I tried to \usepackage{algorithm} it says file algorithm.sty is not found. I read the algorithm.pdf manual and tried latex algorithms.ins in terminal and again it says file not found. So what is the problem here? I installed texlive using sudo apt-get install texlive but it seems to be missing some packages that were suppose to be included. How do I fix this?

share|improve this question
TeX will only search the local directory, or the TEXMF tree. Where did you "compile" algorithm.ins? – Werner Sep 16 '11 at 2:10
@Werner: Silly me I thought latex would fetch algorithm.ins from server or something like apt-get. I have just successfully run latex algorithms.ins. Do you know where I should put the sty files? – Mark Sep 16 '11 at 2:15
up vote 59 down vote accepted

sudo apt-get install texlive does not install all packages from CTAN. sudo apt-get install texlive-full does that (well, it installs everything that was on CTAN when the package was created). If you do not want to install everything, you can just install texlive-science which contains the various algorithm-related packages.

On Arch the equivalent meta package is texlive-most.

share|improve this answer
How come it says tlmgr not found? – Mark Sep 16 '11 at 15:08
@Mark: That's the whole point: The Ubuntu/Debian packages do not include tlmgr. Only a direct install of Tex Live does that. – Caramdir Sep 16 '11 at 17:30
@Caramdir, Fedora/Red Hat has also split up texlive into a lot of packages, and (consistent with the philosophy of one tools for each job) they are handled as normal packages, i.e., no lexlive manager (tlmgr ;-) wanted. – vonbrand Jan 13 at 17:54

As mentioned before, texlive doesn't install the entire TeX Live distribution. To install everything, you should use texlive-full, but it contains many packages that you will not even dream of using in the real life.

If you are using Debian/Ubuntu and want to use algorithm + algorithmic, then I would suggest that you simply install texlive-science and go on with life.

If on the other hand, you are feeling adventurous (not really), you may want to check the new version that I have been baking for some time on github, but have still not uploaded to CTAN.

The new version features a slightly easier, streamlined installation procedure, with you having to worry about just one file, algorithms.dtx.

As the original question was about Debian/Ubuntu, I would like to point out a very valuable resource that many may not know, which is the Debian/Ubuntu-specific information on TeX Live. There you will see directives on how to maintain your local packages from stepping onto the distributed versions of those packages, to ease the maintainance task, detailed in Chapter 4.

share|improve this answer

Compiling algorithms.ins in the local working folder (wherever you are currently working in) will produce algorithm.sty and algorithmic.sty that you can leave it there. This is the first place that TeX will search for style and class files. However, if you're interested in using these styles for other projects as well, then you have to put it in the TEXMF tree. I am not familiar with Ubuntu's tree structure, but I'm guessing it will be located in


In the above location, make a folder algorithms and place algorithm.sty and algorithmic.sty in there, and run texhash.

share|improve this answer
Better put it into the local TEXMF tree (I believe ~/.texmf) instead of the system-wide one. That way you don't interfere with the package manager. (Except of course if you want it to be available for several users — then you need to use a system-wide directory.) – Caramdir Sep 16 '11 at 3:00

I faced one problem my algorithms.sty package was not being recognized even though it was installed. I went to folder it was installed and saw that folder name is algorithms but file name is algorithm.sty hence I changed that to algorithms.sty and now its working fine. Hope it helps some of you.

share|improve this answer
But you probably used \usepackage{algorithms} rather than \usepackage{algorithm}. – Werner Oct 3 '12 at 5:22
Admittedly it is confusing: There is the bundle algorithms that consists of the packages algorithm and algorithmic. The directory name is correct, it is named according to the bundle name. Also the file name was correct before your change. The package is loaded with \usepackage{algorithm}. Also the package file itself says: \ProvidesPackage{algorithm}. Using a different file name will trigger a LaTeX warning: You have requested package algorithms, but the package provides algorithm. – Heiko Oberdiek Oct 3 '12 at 6:00

I follow these steps (I use vanilla TexLive from CTAN) --

Step-1: During compilation, you suppose to get this type of error message if a package/style file is missing -

! LaTeX Error: File `sublabel.sty' not found.

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

Enter file name:_

Step-2: If X.sty is missing, search on google for it, like "X.sty + CTAN", you also supposed to get a link like below --


Step-3: In CTAN, generally many stlye(.sty) files are packaged under some other folders. In this case, sublabel.sty is packaged under preprint (Note the root folder www.ctan.org/tex-archive/macros/latex/contrib/Y). So, X.sty is packaged under Y. Or to make sure, you can go to the link to check if X is really in Y.

Step-4: Now install Y, use tlmgr (generally shipped with 'TexLive') --

sudo ./tlmgr install Y

Everything related to Y (in this case X) will be installed.

share|improve this answer

This is because there is no algorithms package, only algorithmic and algorithm packages.

So you should do this instead:

% "algorithms" bundle

It is really confusing because the official doc calls "algorithms" a bundle: http://mirror.its.dal.ca/ctan/macros/latex/contrib/algorithms/algorithms.pdf

but then goes on to say:

This package provides two environments, algorithmic and algorithm

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.