I want to create my own packages and classes. I know how to install them (Where do I place my own .sty or .cls files, to make them available to all my .tex files?) but what if I don't want to put them in my TeX home directory ?

I want to add a directory somewhere on my computer to regroup all the files I need (packages, bibliography, logo ...) but I want to place it in a specific place to find it more easily (for me at least). How can I do it (if it's possible) ?

  • Which operating system are you using? You could set a symbolic link to your ~/texmf/tex/latex/ directory such that the packages are at the right place, but you can access them more easily.
    – Tiuri
    Commented Jun 2, 2017 at 17:25
  • Do you need both your tex home directory and this new folder? Otherwise you could change the tex home folder to your new location. Commented Jun 2, 2017 at 17:28
  • @Tiuri I use Linux (Ubuntu). Is it the only way ? (just to know, this one is good) I have another question : when I execute kpsewhich -var-value=TEXMFHOME I obtain a certain location (~\texmf) but I don't have this folder ?? @samcarter I suppose I need both but I'm not sure
    – Ccile
    Commented Jun 2, 2017 at 17:34
  • @samcarter has described an alternative way. To your other question: By default, TeX looks for packages in ~/texmf. If this directory doesn't exist, it just skips it. But one can, at any time, create it and store packages there when needed, and then these packages are automatically included.
    – Tiuri
    Commented Jun 2, 2017 at 17:38
  • 1
    Update: TeX Live 2017 now also supports multiple TEXMFfolders, see e.g. preining.info/blog/2017/06/tex-live-2017-released.
    – Tobi
    Commented Jun 4, 2017 at 9:03

1 Answer 1


There are excellent discussions on TeX.SE on how and where to store own LaTeX packages locally. In short:

  • You need to store the files in the specific folder structure texmf/tex/latex/mystuff, where LaTex will look for texmf at some specific place, on Ubuntu with TeXLive usually ~/texmf. Continue reading
  • You can change the location of this texmf folder, e.g. to ~/.texmf (such that it will not be displayed in the file browser). Continue reading

However, your own package files will always need to be in this nested folder structure, and you might wish your packages folder to be somewhere else near your other LaTeX files. So here is a solution that works on Ubuntu (and other Unix-like operating systems), but not on Windows.

Your folder structure is like this:

  • ~/texmf/tex/latex/mystuff, from where the packages are included in your LaTeX documents
  • ~/Documents/coding/mystuff (or similar), where you want to edit and manage your package files

The idea is to create a symbolic link (excellent introduction in German) such that the mystuff directory in one of the two places links to the other place. You can then access and edit the very same files using both paths.

So to create a symbolic link (read more), simply execute one of the two following commands in a terminal:

  • ln -s ~/texmf/tex/latex/mystuff ~/Documents/coding/mystuff
  • ln -s ~/Documents/coding/mystuff ~/texmf/tex/latex/mystuff

You first specify the source directory and second location and name of the link. Thus, using the first line, mystuff is stored in texmf with a symbolic link in Documents, while using the second line gives it the other way around.

  • +1 nice comprehensive answer. The last solution works especially nicely for those of us with multiple computers. My local texmf is in Dropbox and linked like this.
    – Alan Munn
    Commented Jun 2, 2017 at 20:47

You must log in to answer this question.

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