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?

2
  • 3
    Debian includes a texlive-full package. If you don’t want to worry about such things, install this one.
    – mhp
    Aug 31, 2012 at 10:33
  • Closed as a 'reverse dupe': we've now got a proper answer for the general case.
    – Joseph Wright
    Sep 18, 2012 at 14:33

3 Answers 3

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.
7
  • 1
    What happens if the manually installed package (in the "preferable" /usr/local/share/texmf/tex/latex/YouNameIt directory) gets, also, available in the repositories and installed automatically during an upgrade to the main installation tree? Any confusions to be expected? Jun 21, 2012 at 9:28
  • 1
    @NikosAlexandris: /usr/local/share/texmf/tex normally takes precedence over /usr/share/texmf-texlive/tex. Check the output of kpsepath tex.
    – mhp
    Aug 31, 2012 at 10:43
  • @mph Indeed, it precedes. Aug 31, 2012 at 15:27
  • 1
    there is no tex folder in texmf in my system as you mentioned in point 2. how do i proceed ?
    – creative
    Feb 22, 2016 at 8:25
  • @Hirak, create those folders yourself. Jun 12, 2016 at 20:11
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 :)

4
  • 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, 2011 at 3:54
  • @user001: that should work, but as I say, there might be dependencies that are hard to predict :)
    – cmhughes
    Dec 21, 2011 at 3: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, 2011 at 8: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? Jul 31, 2015 at 7: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.

6
  • Thanks Joseph. I will try that as well. Does texhash texmf operate similarly to mktexlsr?
    – user001
    Dec 28, 2011 at 7:33
  • 4
    @user001: In Debian, texhash is simply a link to mktexlsr.
    – mhp
    Aug 31, 2012 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. Jun 20, 2016 at 17:25
  • This does not work. Jun 10, 2017 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.
    – user9424
    Jun 11, 2017 at 0:55

Not the answer you're looking for? Browse other questions tagged .