[texhax] where to put .sty files?

Steve Schwartz s.j.schwartz at qmul.ac.uk
Mon Sep 27 11:02:58 CEST 2004

Since no one has mentioned it, the alternative to worrying about
permissions, running mktexlsr, and which partitions to put things in (so
personal .sty's and such won't get lost when you upgrade your system) is
to put them wherever you like, e.g., in a directory called LATEX in your
home space (or wherever) and use the TEXINPUTS environment variable to
tell your tex installation where to look for things. My .cshrc sets this
environment variable as

setenv TEXINPUTS .:/usr/lib/latex2html/texinputs:/home/sjs/SJSLATEX//:
where the trailing "//" descends recursively down my personal directory
and the trailing ":" ensures the standard distribution is picked up.
Dropping .sty files, or package folders, into SJSLATEX makes them
instantly available to latex. I guess latex searches down this set of
paths in the order shown, and quirky things can happen if there are
multiple occurences of packages which aren't identical, but your log
file will tell you where latex found each package you call out in your

For shared installations, it's more robust to reconfigure the local
texmf tree rather than rely on all users to set the appropriate
environment variable, but the above works well, especially when you're
up against a deadline!


On Fri, 2004-09-24 at 22:07, Pierre MacKay wrote:
> Not so very incidentally, one of the most important things you can do to
> keep the distribution file tree clean (and to keep a lot of bad things from happening)
> is to change fstab so that /usr is mounted read-only.  You have to put a link
> to /usr/local in there first, but from then on, when risky packages try to alter
> your /usr partition, you get a solid warning that they need to be altered before
> installing.  Occasional things HAVE to be added to /usr. but very few.
> /usr/local will have to be on a distinct partition, of course.
> My /usr/local --> /opt/local (which indicates a long past experience with Solaris)
> > Your personal additions should go in your local texmf tree, not the main one. 
> > You can create your local texmf tree anywhere you want, but a standard place 
> > for it (including Debian) is /usr/local/share/texmf. You can organize your 
> > local tree as the main one, so duplicate it with, say:
> > 
> > cd /usr/share/texmf	# or wherever your $TEXMFMAIN is
> > find . -type d | cpio -pdv /usr/local/share/texmf
> > 
> > <*.sty> files can then go in /usr/local/share/texmf/tex/latex/<package>
> Copying the entire TEXMFMAIN to /usr/local seems extreme.  That is what
> TEXMFCNF is for, and most particularly what SELFAUTOLOC, etc. is for.
> The one lot of things you do have to copy out of /usr is the binaries
> you actually use, which must be in /usr/local/bin (links won't work).
> Remember that when you add something to /usr/local/texmf, you need to run
> mktexlsr.  (It will complain that it can't do anyything about the ro /usr
> but that is just what you want. 
> Pierre MacKay
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> TeX newsgroup: http://groups.google.com/groups?group=comp.text.tex
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org
| Steve Schwartz               S.J.Schwartz at qmul.ac.uk            |
| Astronomy Unit                                                  |
| Queen Mary, Univ. of London  Tel: +44 (0)20 7882 5449           |
| Mile End Road                Fax: +44 (0)20 8983 3522           |
| London E1 4NS, UK            URL: www.space-plasma.qmul.ac.uk/  |

More information about the texhax mailing list