[Tex/LaTex] Create a local texmf tree in Ubuntu

linuxtexlivetexmfUbuntu

I am running Ubuntu 12.04 which came with TeX Live 2009 pre-installed.
I want to create a local texmf tree at the location ~/Dropbox/mylocaltexmf/,
so that I can place my own .sty files in my Dropbox which automatically syncs across multiple computers.
How do I make a local texmf tree visible to TeX Live?
Note that I do not want to place the .sty files in the default TEXMFHOME.

Similar questions but on different operating systems:

I tried to follow the solution in How to make LaTeX see local texmf tree,
but when I ran the command tlmgr it seems that there is no such command on my system.

$ tlmgr
No command 'tlmgr' found, did you mean:
 Command 'vlmgr' from package 'qdbm-util' (universe)
 Command 'rlmgr' from package 'qdbm-util' (universe)
tlmgr: command not found

Best Answer

Firstly, you need to tell tex to look in your ~/Dropbox/mylocaltexmf folder as the user texmf, instead of in the default, ~/texmf. To do this, you need to create the file 10localtexmf.cnf (or some similarly named file) in /etc/texmf/texmf.d, and tell it your custom value of your home texmf:

cd /etc/texmf/texmf.d sudo touch 10localtexmf.cnf sudo echo "TEXMFHOME = ~/Dropbox/mylocaltexmf" > 10localtexmf.cnf

Next, you need to tell Ubuntu to generate the texmf.cnf file in /etc/texmf/web2c from the contents of the /etc/texmf/texmf.d directory:

sudo update-texmf

Great! Now test to see whether this has worked by running:

kpsexpand \$TEXMFHOME

If that outputs ~/Dropbox/mylocaltexmf, then it's worked, and you're set. If it outputs ~/texmf, it means it's still set on the default. If this is the case, check the contents of /etc/texmf/web2c/texmf.cnf to check whether update-texmf has successfully appended your custom TEXMFHOME.

I personally use this to sync my custom beamer themes. Oh, and remember that as jon said, the contents of your localtexmf must mirror the standard texmf structure, so custom latex styles and themes should be put in ~/Dropbox/mylocaltexmf/tex/latex. Also, remember to run sudo texhash whenever you update your local texmf.