0

I have written a package and placed it in the same directory as e.g. latex.ltx. However, TeXShop just won't load it, or rather, XeLaTeX and pdfTeX called through TeXShop won't. If I, however, on the file not found error, type:

/usr/local/texlive/2013/texmf-dist/tex/latex/base/mworx.sty

on the Console, the file is found and loaded. And that path is the same as to size10.clo, the first file I see loaded. Why exactly is XeLaTeX doing what appears to be looking for the file only in the .tex file's directory?

marked as duplicate by egreg, David Carlisle, Claudio Fiandrino, barbara beeton, Andrew Swann Aug 19 '14 at 12:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    don't place your own files in the latex base directory:-) – David Carlisle Aug 19 '14 at 12:31
3

You shouldn't put new packages into the texmf-dist tree; they'll potentially be overwritten by distribution updates. (Or more likely will just be forgotten when your upgrade to MacTeX2015 or whatever.)

Since you're on a Mac, the appropriate place to add (LaTeX) package files is

~/Library/texmf/tex/latex/

The reason why putting the file into texmf-dist in seemingly the correct place didn't result in TeX being able to find the file is because kpathsea, which TeX uses to find files, does not search folders dynamically for performance reasons.

The configuration file texmf.cnf, however, makes special consideration for the "home" texmf tree linked above — since this tree will (usually) be quite small, there is little performance penalty to searching the disk when attempting to find files there.

There is also another "allocated" location to put files into your TeX distribution:

/usr/local/texlive/texmf-local

If you put files here, which will be found by all users of the computer (as opposed to the ~/Library/texmf tree), it's necessary to inform kpathsea to update its database of files using the Terminal command:

sudo texhash
  • 1
    Perhaps worth adding a note to explain why it will be found in the local tree but not the main one (at least without hashing). – Joseph Wright Aug 19 '14 at 12:32
  • Good idea :) I was distracted half-way though my original answer. – Will Robertson Aug 19 '14 at 12:49
  • Um… I can't find Library/texmf, neither in /Library nor in <home directory>/Library. Anyway sudo texhash solved this problem. – MickG Aug 19 '14 at 13:02
  • In the Home directory's Library I see TeXShop, TeXWorks and texlive, whereas in the one directly on the root directory (the one of the Applications folder) I find TeX. – MickG Aug 19 '14 at 13:03
  • @MickG Depending on your system, you may not have ~/Library/texmf 'out of the box': just make the folder. – Joseph Wright Aug 19 '14 at 13:09

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