Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have an non-root account on a shared server which has an old version of a package available to all users, and I want to use a newer one on my account. I cannot just use $TEXINPUTS, because latex finds the shared version first. How can I get latex to use my version?

I.e. how can I get latex to use the first of these two files:

/home/fgregg/share/texmf/tex/latex/pgf/basiclayer/pgf.sty
/usr/share/texmf/tex/latex/pgf/pgf.sty
share|improve this question
add comment

1 Answer 1

up vote 27 down vote accepted

By default, should local packages are expected to be in ~/texmf not ~/share/texmf (they are expected to be in ~/Library/texmf on a Mac). So try putting your new version of the package in ~/texmf/tex. This directory should be found first when latex searches for packages.

Furthermore, the local texmf needs to follow the TeX Directory Structure: (you don't need to create all of these directories initially, but you do need to put things in the right places when you add new stuff.)

  •  bibtex directory    This is where bib files and bst files go
     ⁃  bst directory       Put bst files here
     ⁃  bib directory       Put bib files here 
  •  tex directory       This is where new packages go
     ⁃  latex directory     Put latex packages here
     ⁃  plain directory     Put plain tex files here
     ⁃  xelatex directory   Put xelatex specific packages here
     ⁃  xetex  directory    Put plain xetex files here
     ⁃  context directory   Put context files here
     ⁃  generic directory   Put files that are usable with any TeX flavour here
  •  doc directory
     ⁃  put documentation files from packages installed in the tex directory here.
        Putting the documentation files here allows them to be found by the texdoc  
        system.

For example, suppose you have the new package cool-new-package. If it's a latex package, the package will come with (at least) a .sty file, and some documentation files (often a .tex and .pdf version). You would create a directory in ~/texmf/tex/latex called cool-new-package and then put cool-new-package.sty there. You would also create a cool-new-package directory in ~/texmf/doc and put the documentation files there.

Note that in a brand new installation, a local texmf folder is not created and you will need to create one if one doesn't exist. If you are using a Mac, I have created a standalone script to create the correct folder structure. You can get it here:

share|improve this answer
    
Good answer. You could add an example, "For example, you might have ~/texmf/tex/latex/foo/foo.sty for a local version of the foo package." –  TH. Jan 6 '11 at 1:40
2  
@Seamus: No, you do not need to run texhash for user additions ever. And you certainly wouldn't need to run it with sudo. If that were true, the whole idea of user additions would be invalid, since it would prevent non-administrator accounts from ever managing their own local packages. –  Alan Munn Jan 6 '11 at 16:39
3  
TeX uses three variables for the directories: $TEXMF, $TEXMFLOCAL and $TEXMFHOME. For the first two a directory list file ls-R is needed which is created by mktexlsr or texhash. The user directory dosn't use such a file. The search order for files is: document dir - TEXMFHOME - TEXMFLOCAL - TEXMF. For MiKTeX you have other directories. And everything is predefined in texmf.cnf –  Herbert Jan 6 '11 at 17:12
1  
@PatrickT That folder is not a good substitute for your local texmf folder. For one thing, next year when you update to TeXLive 2014, nothing you have placed in that folder will be accessible to the new distribution. If you don't have a local texmf you can find a script on my web page (see my profile) which will create the folder structure for you. –  Alan Munn Feb 15 at 14:33
1  
@PatrickT To create the structure, open a new Finder window, hit Command-Shift-G; type ~/Library in the box that appears and click OK; now press Command-Shift-N and name texmf the new folder. Then you can add the folder to the Favorites bar for easier access. –  egreg Feb 15 at 15:50
show 9 more comments

Your Answer

 
discard

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.