53

Possible Duplicate:
How do I install an individual package on a Linux system?

The Debian/Ubuntu archives typically include assemblies of many LaTeX packages for convenience of downloading (e.g., texlive-latex-extra). However, a user may prefer a single package to these conglomerations. Is there a simple way to manually acquire a single LaTeX package on Debian/Ubuntu?

user001
  • 7,964

3 Answers3

52

The following four steps permit manual installation of packages on Debian/Ubuntu (and presumably other Linux) systems.

  1. Download the package from CTAN (e.g., footmisc.zip).
  2. Extract the files and place them in an appropriate directory (e.g., /usr/local/share/texmf/tex/latex/footmisc/). This location is preferable to the main installation tree (/usr/share/texmf-texlive/tex/latex/) as the files are more likely to be preserved during upgrades.
  3. Generate the .sty file by running latex on the appropriate source files (e.g., latex footmisc.ins and latex footmisc.dtx).
  4. Update the ls-R file in this source tree (e.g., cd /usr/local/share/texmf/ ; sudo mktexlsr). Because /usr/local/share/texmf/tex/ is not searched recursively by kpathsea (cf. kpsepath tex), the ls-R file at the root directory of this search path must be updated to make the system aware of the new package.
user001
  • 7,964
11

The TeXLive in the repositories is from 2009. It's more recommended to go with the latest version on the Tug (TeX Users Group) website:

http://www.tug.org/texlive/acquire.html

Once you have installed this, you'll have access to the command tlmgr which stands for 'TeX Live manager'. There have been a few other posts here on tex.se that will give further information:

The advantage of using tlmgr is that it will keep all of the dependencies up to date- trying to do this manually can often be frustrating :)

cmhughes
  • 100,947
  • Thanks for this suggestion. As of now, I prefer to stick with the Debian stable texlive (2009) because my system tends to have problems with more "bleeding edge" installs. Short of tlmgr, which I will look forward to in the next Debian stable release, is there another way to install a single package besides downloading it, moving files to appropriate locations (probably /usr/local/) and updating the ls-R files? – user001 Dec 21 '11 at 03:54
  • @user001: that should work, but as I say, there might be dependencies that are hard to predict :) – cmhughes Dec 21 '11 at 03:58
  • @user001 This is in some ways a Debian question as what you want to do is grab part of something they have packaged up. The 'pure TeX' way is to either use tlmgr as cmhighes says or to get it from CTAN as you suggest in your question. – Joseph Wright Dec 21 '11 at 08:09
  • TexLive fails to update tikz-cd, which I need. I put it inside my ~/texmf directory, but how can I get it to work with TexLive? – Yan King Yin Jul 31 '15 at 07:04
3

I always found that the easiest way to manually install a package is to create a folder texmf in my "home" directory, dump all the downloaded .sty or .cls or whatever in there and run texhash texmf. That's all I ever had to do, if I'm not installing a font.

  • Thanks Joseph. I will try that as well. Does texhash texmf operate similarly to mktexlsr? – user001 Dec 28 '11 at 07:33
  • 4
    @user001: In Debian, texhash is simply a link to mktexlsr. – mhp Aug 31 '12 at 10:35
  • 1
    Don't you have to manually create an ls-R file? I've done the file dumping in ~/texmf, but texhash doesn't create an ls-R file (it updates the ones at /usr/share, but LaTeX is still not seeing the package. – Waldir Leoncio Jun 20 '16 at 17:25
  • This does not work. – Fly by Night Jun 10 '17 at 21:19
  • @FlybyNight, it does. At least in Ubuntu/Debian it never failed. Please provide more info, as well as reasons to downvote the answer. –  Jun 11 '17 at 00:55
  • It seems not to work in debian installations, because the updated version of a package may have dependencies, which must then be installed etc. - and second, the structure of the texmf file seems to be very strict and files from packages must be correctly filed. – user855443 Nov 23 '18 at 12:58