8

I'm venturing into writing my own packages, but LaTeX is not finding them.

I working on a iMac OS X, but I don't want to use TEXMFHOME=~/Library/texmf. I would like to put my packages in a different directory: for the sake of this post let's call it ~/private/texmf.

My TEXINPUTS is set as TEXINPUTS=.:~/private/texmf//: and works perfectly well for standard .tex files. But when I place a new .sty file in these directories, LaTeX complains that they can't be found.

I've tried numerous things. The two most notable are:

  1. Setting TEXMFHOME=~/private/texmf:~Library/texmf
  2. Setting TEXMFHOME=~/private/texmf

Both times, I've entered ~/private/texmf and run sudo texhash to update everything (I've never had to do this before). I've moved to the directory in which my packages are located ~/private/texmf/tex/latex/packages/ and called texhash again. All to no avail.

I've search the web and this site for clues about what to do:

  1. Change TEXMFHOME per-user

  2. Where do I place my own .sty files, to make them available to all my .tex files?

  3. How to access style files in texlive-publishers from Kile

    What's mentioned above is what seemed to be suggested at various different sites. Nothing's working.

Help.

13
  • Have you run texhash to update your TDS?
    – Werner
    Jun 19, 2013 at 2:18
  • What is my TDS?
    – A.Ellett
    Jun 19, 2013 at 2:19
  • Sorry, try mktexlsr; I'm not sure texhash is still supported/active. TDS refers to your TeX Directory Structure.
    – Werner
    Jun 19, 2013 at 2:20
  • Now things are working. Not sure why.
    – A.Ellett
    Jun 19, 2013 at 2:28
  • 1
    Another idea: symlink your directory. I think you can use this command on OSX: ln -st ~/texmf/tex/latex/ ~/private/texmf. (Note: I assume these are personal latex files.)
    – jon
    Jun 19, 2013 at 4:13

1 Answer 1

9

The location of the "private tree" is normally, with MacTeX,

~/Library/texmf

to which the (pseudo)variable TEXMFHOME points:

> kpsewhich --var-value TEXMFHOME
/Users/<user>/Library/texmf

(I only masked my real user name on this machine). If you try

> less $(kpsewhich texmf.cnf)

you'll get on your screen something like

% (Public domain.)
% This texmf.cnf file should contain only your personal changes from the
% original texmf.cnf (for example, as chosen in the installer).
%
% That is, if you need to make changes to texmf.cnf, put your custom
% settings in this file, which is .../texlive/YYYY/texmf.cnf, rather than
% the distributed file (which is .../texlive/YYYY/texmf-dist/web2c/texmf.cnf).
% And include *only* your changed values, not a copy of the whole thing!
%
TEXMFHOME = ~/Library/texmf
TEXMFVAR = ~/Library/texlive/2013/texmf-var
TEXMFCONFIG = ~/Library/texlive/2013/texmf-config
/usr/local/texlive/2013/texmf.cnf (END)

The last line doesn't belong to the file, it just shows its location. This file is the top level texmf.cnf so the first to be read in when a TeX program is launched; the system is set up so that no variable is clobbered when other texmf.cnf files are input.

Thus what you have to do is simply editing that file

sudo nano $(kpsewhich texmf.cnf)

(use whatever editor you prefer instead of nano); for instance, you might want to set

TEXMFHOME=~/private/texmf:~Library/texmf

I tested it and files are found in both locations (precedence to ~/private/texmf). You don't need to run texhash or mktexlsr after adding files to the private tree or trees. However, you have to properly create a structure in the tree; a file such as wonderfulpackage.sty can be found by LaTeX only if it's stored as

~/private/texmf/tex/latex/wonderfulpackage/wonderfulpackage.sty

(the last subdivision, that is, the directory wonderfulpackage) is optional, but its usage is recommended for later maintenance. If you put the file just at ~/private/texmf it will not be found by LaTeX.

3
  • 1
    This could be problematic. tug.org/pipermail/tex-live/2012-July/032005.html and the rest of the documentation in this thread. Jun 19, 2013 at 9:27
  • @UlrikeFischer I read it, but I don't see how this might cause problems. In my test, files are found both in ~/private/texmf and ~/Library/texmf trees.
    – egreg
    Jun 19, 2013 at 9:33
  • 1
    Finding files is not the problem. The question is if some scripts expect texmfhome to expand to a single directory (like the problem starting the thread where updmap expected texmflocal to contain only one directory). It is quite possible that it works without problems (as there has been a bit pressure due to some discussions about "how to add more trees like in miktex). Jun 19, 2013 at 10:08

You must log in to answer this question.

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