Today I wanted to install the algorithms package for LaTeX under Kubuntu to get some neat pseudo code into my thesis. I found an article that explains how to install LaTeX packages manually to a directory in your $HOME for Ubuntu in the documenatation but it didn’t work for me that way under Kubuntu 10.04. I still got the following error message:
! LaTeX Error: File `algorithms.sty' not found.
Another article for Ubuntu describing how to install to a global directory didn’t work either and assumed you had a .sty file already, but combining the two and slightly changing the path finally worked out.
So here’s what I did: I downloaded the package from CTAN, it came as a zip with various files but no INSTALL file and no .sty files were included. As described on that Ubuntu page, you have to run latex on the .ins file to generate the .sty file in that case:
This will produce two sty files for the algorithms package: algorithm.sty and algorithmic.sty, as explained in the README file for that package. Now that we have these files, we need to create a directory in the proper location and copy the files into it:
sudo mkdir /usr/share/texmf/tex/latex/algorithms/
sudo cp *.sty /usr/share/texmf/tex/latex/algorithms/
Don’t forget the last command, it tells latex where to find the files! The package should now be ready for use.
Btw, I figured out the path /usr/local/share/texmf/ by running mktexlsr. It tells you all the paths it checks for updated packages it seems. For me it said:
mktexlsr: Updating /usr/local/share/texmf/ls-R…
mktexlsr: Updating /var/lib/texmf/ls-R-TEXMFMAIN…
mktexlsr: Updating /var/lib/texmf/ls-R-TEXLIVE…
mktexlsr: Updating /var/lib/texmf/ls-R…