For example, let's say that a user has an older version of somepackage.sty
somewhere on their system.
/path/to/install/latex/somepackage.sty
Placing a (possibly different version) somepackage.sty
in the working directory appears to shadow the system/installed version.
/some/other/dir/myfile.tex
/some/other/dir/somepackage.sty
However, if the preferred version of somepackage.sty
is not in the local working directory, how can it be specified on the command line? Is it even possible? In the example below, I want to be able to specify the non-system/non-default version of somepackage.sty
:
/some/path/preferred/package/versions/somepackage.sty
/my/current/project/myfile.tex
Best Answer
The order in which the TEXMF trees are searched is fixed in the configuration somewhere. The canonical order is: current directory, user's TEXMF in ~/texmf, system-local TEXMF (usually called texmf-local), and finally texmf and texmf-dist. So, installing manually (into texmf-local as admin/root or ~/texmf as user) always takes precedence.
I've once looked at this situation in the multiver package, but I'm not sure if it will handle files in different texmf trees. (It will try to recognize the optional-argument form
\usepackage[opts]{pkg}[yyyy/mm/dd vVersion]
and look for vVersion/pkg.sty instead.But it turns out anyway that the situation is more difficult, because if your "overriding" package loads other packages, they may or may not need to be different versions. Something like a KoMa-Script class would certainly like to load its matching auxiliary packages.
And not giving a version at all would result in some version from a subdirectory being picked (first one found), so a working solution needed a change to the format of the ls-R database.
Long story short: having multiple versions of the same file in the same installation is fraught with danger. One thing you can do is to have, for example, multiple
localtexmf
s, I think you can switch between those with an environment variable.