13

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
  • 3
  • Just out of curiosity: why is ~/mylocaltexmf going to be better than ~/texmf (= normal TEXMFHOME)? But, anyway, look in texmf.cnf for these settings. Or install TeX Live from TUG, as suggested. Or use symlinks. – jon Feb 18 '14 at 03:17
  • 1
    See my edit. The real folder I want to be my local texmf tree at is actually a folder in my Dropbox which can sync across multiple computers. – I Like to Code Feb 18 '14 at 03:49
  • 1
    OK. Find your texmf.cnf, namely the one you should/can edit. Since you are using the Debian-based TeX Live, I'm not sure where that is. Try to find it with kpsewhich or locate. The one you should edit says it should contain (only) your personal changes. Add this line: TEXMFHOME = ~/Dropbox/texmf (or mylocaltexmf). Now -- important! -- do mkdir ~/Dropbox/texmf/tex/latex and put your .sty files there. TEXMF* folders must mimic the TeX Live Directory Structure (TDS). Thus a .bib file should go in ~/Dropbox/texmf/bibtex/bib; etc., etc. – jon Feb 18 '14 at 16:22
  • 3
    With just one local texmf tree, you can use these commands: cd; mv texmf texmf.orig; ln -s ~/Dropbox/mylocaltexmf/ ~/texmf – Paul Gaborit Feb 18 '14 at 22:58
  • Paul, your solution works. Do you want to submit it as an answer which I can accept? – I Like to Code Feb 19 '14 at 02:15
  • jon, locate texmf.cnf returns two files /etc/texmf/texmf.cnf and /usr/share/texmf/web2c/texmf.cnf, both of which contain the contents: This file is automatically generated by update-texmf PLEASE DO NOT EDIT THIS FILE DIRECTLY. It is meant to be generated from files in /etc/texmf/texmf.d/. Perhaps as Adam said I need to install a vanilla version of TeX Live. – I Like to Code Feb 19 '14 at 02:17
  • @PaulGaborit, paging to submit answer and collect reputation. – Waldir Leoncio Jun 21 '16 at 15:53

1 Answers1

12

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.

Drew
  • 221
  • Ran through this, and it did not work for me. Even though /etc/texmf/web2c/texmf.cnf says TEXMFHOME = /home/STUFF/Dropbox/texmf, kpsexpand $TEXMFHOME only outputs /home/STUFF/Dropbox, no texmf at the end. – RghtHndSd Mar 19 '16 at 18:50
  • @drewsberry: I have made mylocaltexmf in ~/path/to/mylocaltexmf. Inside that, I have created the folder tex/latex and have copied the verse folder which contains verse.sty into it. But when I run a sample test.tex file, I get the error verse.sty not found. sudo texhash doesn't seem to indicate mylocaltexmf. kpsexpand command doesn't exist in my system. But /etc/texmf/web2c/texmf.cnf has an entry for mylocaltexmf. And finally, the test.log doesn't show any entry of searching the verse.sty in mylocaltexmf. What am I doing wrong? – vrgovinda Mar 22 '22 at 11:05