[Tex/LaTex] \usepackage with a full path


As the name suggests – can I do something like:


LaTeX is throwing errors at me when I try to do it.

Best Answer

Instead of using a full path, it is a much better practice to put your file in an appropriate place where TeX will find it. It seems you are a *NIX user, so you may try

$ less `kpsewhich texmf.cnf`

to know which places are these. There is a lot of comments in this file, they will help you. Alternatively, you can use the TEXMFHOME or the TEXINPUTS environment variable. Their use is detailed in texmf.cnfas well.

You probably want to distinguish three cases of use for your software package mypackage:

  • Site-wide installation, it is then adapted to store your TeX files in a site-wide available directory and ${TEXMFLOCAL}/tex/latex/mypackage is probably a good choice. (Use kpsexpand to know which actual path to use, as in kpsexpand '${TEXMFLOCAL}/tex/latex/mypackge').

  • User specific installation, the directory ${TEXMFHOME}/tex/latex/mypackage then looks appropriate.

  • Development, while you are developing your package, you probably want to avoid repeteadly installing TeX related files and prefer add the appropriate locations to the TEXINPUTS environment variable.

The file texmf.cnf contains useful informations about these variables.

Related Question