[Tex/LaTex] customizing TEXMFHOME

texmf

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.

Best Answer

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:

/home/<user>/texmf/tex/latex/myfakefile.sty

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.