I'm on Ubuntu 12.04 (not sure if it makes a difference) and I'm trying to change $TEXMFHOME to a custom directory. Currently it is $HOME/texmf, which I believe is the default, but even when I put .sty files in there the compilation of the .tex file cannot find it. And more so, when I change the directory of $TEXMFHOME to something else and move the .sty file there, it still can' find it. However, if I put the .sty file in the same directory as the .tex file it works perfectly (not what I want though). I am changing $TEXMFHOME in /etc/texmf/texmf.d/05TeXMF.cnf and using sudo update-texmf to generate the texmf.cnf file. Is this the correct way? What am I doing wrong?

If it's helpful, I am using emacs with auctex as my editor.

I have found other threads on here and other sites that are very similar, but none of the solutions for those worked for me.

  • 3
    (For the default personal tex tree.) You need to make you texmf home mimic the directory structure of your base install. For LaTeX stuff, you want to do mkdir -p ~/texmf/tex/latex/ and put your personal .sty files there. If, say, you want to put a biblatex.cfg file in your personal tree, then mkdir -p ~/texmf/tex/latex/biblatex/ and put the file there. Another good one: mkdir -p ~/texmf/bibtex/bib and put your .bib fiel there. – jon Sep 12 '12 at 13:28

Why change it at all? I think what you're missing is that you should make your personal texmf-tree mimic that of the installed version. This is easily remedied.

In a terminal:

mkdir -p ~/texmf/{doc,tex}/{context,eplain,generic,latex,lualatex,plain,xelatex,xetex} # for example
mkdir -p ~/texmf/bibtex/bib # put your bib file in here

(You should / will need to make the appropriate sub-directories for bibtex and doc if you want to put things in there.)

Now you can test whether things are found:

touch ~/texmf/tex/latex/myfakefile.sty
kpsewhere myfakefile.sty

The last command should return:


Note also that the command

kpsewhich --var-value TEXMF

should return a list of places that will be searched in the order (I believe) they are searched. Your personal tree is probably listed first, which means that in a race between, e.g., the 'system' myfakefile.sty and your 'personal' myfakefile.sty, the personal one will win.

Finally, I should point out that your attempts at modifying texmf.cnf may have made this answer not work (I'm not sure what you did). I would revert your changes to the default set-up as it will be easier to maintain.

|improve this answer|||||
  • sweet, this worked. I have some questions though so I understand what this is doing.... I looked up the -p option for mkdir, but I didn't quite understand what that option did. How did you know that ~/texmf/tex/latex is a directory that is seen when compiling latex? Is there a book on this sort of stuff for latex? Last question. There is a Ls-R file in '~/texmf/' What is that for? – nick Sep 13 '12 at 14:03
  • I'm glad to hear it. The -p switch allows you to make a subdirectory (or several) along with the parent one; otherwise mkdir will complain: 'No such file or directory'. Checking where *tex (et al.) will look can be done with kpsewhich --var-value <thing to check>; try checking for BIBINPUTS (which is good to know about for bibtex/biber. Try texdoc kpathsea for more information, but I suspect it'll be pretty overwhelming at first. (But it is good to know about texdoc as a means for looking up TeX-related manuals.) – jon Sep 13 '12 at 15:41
  • when I try "texdoc kpathsea" I get the following error "sh: 1: gnome-open: not found" – nick Sep 13 '12 at 20:31
  • @user18641 -- Really? If which gnome-open returns no result (I get /usr/bin/gnome-open), then there is something wrong with your system (not TeX Live related), which you should fix. In the meantime, you can do locate kpathsea.pdf to find the location of the document and then open in manually; or do (say): evince `locate kpathsea.pdf`. – jon Sep 13 '12 at 22:00
  • It returns no result. I'm afraid to ask what that means... – nick Sep 14 '12 at 2:51

Assuming your shell is bash try to set the environment variable using export? In particular invoke export TEXMFHOME=/path/to/your/custom/location and then restart the shell.

If this works, you can add this export command to the .bashrc file and then you'll have it correct when ever you start your terminal.

|improve this answer|||||

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.