4

On Unix like system using TeX Live, the command kpsewhich --var-value=TEXMFLOCAL gives the path of the directory where to install homemade package. For example, on my Mac, I obtain the path /usr/local/texlive/texmf-local.

Does this work on Windows using TeX Live ?

  • 6
    Have you tried it? – Sean Allred Feb 20 '15 at 21:47
  • 3
    Personally, I'd use TEXMFHOME. Much less hassle than TEXMFLOCAL... – cfr Feb 21 '15 at 4:42
  • 1
    @SeanAllred I do not have easily a Windows computer where to play. My question was for developping some tools to easy install homemade package. – projetmbc Feb 21 '15 at 7:51
  • @cfr Good advice. I need to be more carefull with the homemade packages. – projetmbc Feb 21 '15 at 7:52
  • 1
    TEXMFHOME is good for personnal work. TEXMFLOCAL is good for all users of the OS... and may require admin/super-user privileges. – Paul Gaborit Jan 13 '17 at 8:03
3

Although you already got some answers (some of them in the comments), let me say the following: TeXLive (and MikTeX as far as I know)

  1. is set up, to use properly filled TDS, which is TeX Directory Structure(s).
  2. is using the Karl Berry Search Path tools. Therefore you can use the command line tool kpsewhich to determine, where a file is located. This command was inspired by the Unix which-tool, which tries to find the location of a given executable. For the usage in TeX-systems, it was enhanced a little bit.

Especially in TeXLive (but again, I think in MikTeX too), you can use more than one TDS-tree parallel to another. Usually, TeXLive-systems are set up to have three of these TDS-trees:

  1. The TDS for the maintainer of the distributions,
  2. The TDS for the local system administrator,
  3. The TDS for the individual user.

The first one contains all the packages, that came with TeXLive (MikTeX, respectively). It will be installed, when you (as system administrator) install your TeXLive-System. It will be changed, whenever you update your TeXLive-System. Therefore you should not install any packages into that TDS-tree (unless you are an TeXLive maintainer, of course. But why should I explain the setup to you, than?).

The second TDS-tree is for the system administrator, who supports his users with a central repository of readily installed local packages. For example, the style files to obeye your universities corporate design will be installed here. If it is a network share, all TeX users in the whole university (whole company, if you like) can use this files without any further configuration. To be able to install packages in this tree, you usually need to have system administrator rights also, to be able to write files here.

The third and last tree, is the tree for the individual user. It will be located in a directory owned by the user himself; classically this was within the home-directory of the user on Unix systems.

You can use the TeXLive command tool tlmgr to find out, where these three TDS are located on your individual computer. Just run

tlmgr conf

and check for the lines beginning with

  1. TEXMFDIST
  2. TEXMFLOCAL
  3. TEXMFHOME

They point you to the correct locations in your TeX installation.

(I don't know the tool, which gives this information on MikTeX, sorry.)

There is also a line beginning with texmf.cnf which will list the location of the master configuration file. If you ever plan to change some of the locations and you really know, what you are doing there, thats the file to edit!

There is one other important thing to point out. Nowadays, a full grown TeX system consists of hundreds of thousands of files. It would be tedious for your computer, to search every path over and over again, just to locate say book.cls. (Have I mentioned, that computers are stupid? Computers can't remember those locations, if you don't provide any help!) To prevent searching and searching and searching again, all the files, which are located in the distribution TDS tree and in the Local TDS tree, are stored in a simple database. Therefore it is not sufficient, to copy a file into one of those trees. TeX will not find these files, unless you update the database. Of course, you surely will need super user rights (AKA super cow power :-)) to update the database. On classical Unix systems this used to be the texhash command or mktexlsr which is the short form of "Make the TeX ls-minus-R database" (To be true: it is nothing else than ls -R $TEXMFDIST or whatever TDS tree you want to add to your database.)

To sum up all that: if you plan to enrich the world by releasing a package of yours, to be installed on somebodies else computer, the best way would be to convince the TeXLive maintainers to include it in TeXLive. Than you don't have to worry anymore. If your package is not that important, that you could convince the TeXLive maintainers to have it included, it might be best, to instruct your customers, to install it in the TEXMFHOME part of their system. Just ask them to run

tlmgr conf | grep TEXMFHOME

on Unix-like systems. On newer Windows systems having a bash installed, it might also work. In that location they don't need to have super cow powers nor have they to hassle to update the database. If you happen to give your package to system administrators, they usually know, where to store the package and how to update the database.

P.S: If you want to make sure, that the newest book.cls fresh from CTAN, yould be used on your TeXLive system, while the maintainers didn't incorporate it into their distribution, you have to install it either in TEXMFLOCAL or TEXMFHOME and to configure your system by editing temf.cnf in such manner, that TEXMFDIST will be search at last of the three given TDS trees.

0

I never heard of kpsewhich before. However, I copy/pasted the command line you gave and got

C:/Users/Mark/AppData/Roaming/MiKTeX/2.9

So I guess it does work. (Incidentally, using HOME instead of LOCAL gives only a blank line.)

  • 3
    The question deals with TeX Live, not with MiKTeX. – egreg Feb 21 '15 at 9:41
  • Oops. My bad. Sorry. – Mark Feb 21 '15 at 22:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.