12

I'd like to be able to temporarily ignore my "home" texmf tree (in MacTeX /Users/will/Library/texmf) for testing purposes; e.g., to test some code and ensure only TeX Live-installed packages are found. Is this easily possible?

lockstep
  • 250,273
  • 1
    would mv texmf texmf-something-else be acceptable? – Andrew Stacey Sep 08 '11 at 07:10
  • @Andrew: That's the way I do it (mv ~/texmf ~/texmf_) :-). However, maybe using export TEXMFHOME="" will overwrite the internal definition of TEXMFHOME? – Martin Scharrer Sep 08 '11 at 07:13
  • A similar suggestion to that of @AndrewStacey's is to keep your "home" texmf tree wherever and create a symbolic link to it via /Users/will/Library/texmf. Then you can manipulate that link whenever you want to disable TEXMFHOME. This might be somewhat safer than using mv. Also you could create a script that when invoked if the TEXMFHOME is enabled disables it, and if it's disables, enables it. – N.N. Sep 08 '11 at 07:13
  • 1
    unset TEXMFHOME –  Sep 08 '11 at 07:22
  • Testing on my system shows that you need to set TEXMFHOME to something, but that that something need not exist. So export TEXMFHOME=$HOME/a-nonexistant-directory works. – Andrew Stacey Sep 08 '11 at 07:22
  • @Herbert: unset TEXMFHOME (as well as export TEXMFHOME="") only works if TEXMFHOME has been explicitly set (and exported) by the user. It doesn't work if TEXMFHOME has the “implicit” default value set in texmf.cnf. – mhp Sep 08 '11 at 18:02
  • My experiment showed that if the TEXMFHOME directory is in the standard place then unset TEXMFHOME doesn't work. – Andrew Stacey Sep 08 '11 at 18:29

2 Answers2

9

This is a bit long for a comment, and the formatting would be restrictive. Here's what happens on my (Linux) system:

~% echo $TEXMFHOME

~% kpsewhich mymacros.sty
/home/stacey/texmf/tex/latex/bzr/mymacros.sty
~% export TEXMFHOME=""
~% kpsewhich mymacros.sty
/home/stacey/texmf/tex/latex/bzr/mymacros.sty
~% export TEXMFHOME=$HOME/a-nonexistant-directory
~% kpsewhich mymacros.sty                        
(1)~%
~% unset TEXMFHOME
~% kpsewhich mymacros.sty
/home/stacey/texmf/tex/latex/bzr/mymacros.sty
~% 

So the one that works reliably is to set TEXMFHOME to something that doesn't exist. (You could set it to something that does exist, but then you run the risk of there being something TeX might look for in that directory.)

Andrew Stacey
  • 153,724
  • 43
  • 389
  • 751
  • Thanks! I tried setting TEXMFHOME="" myself and when that failed asked here :) – Will Robertson Sep 08 '11 at 11:02
  • This is what I do. I have a testing texmf directory, and a TeXShop engine script that sets TEXMFHOME to that directory. If that directory is empty, then you'll get only TL stuff. – Alan Munn Sep 08 '11 at 18:32
3

My approach is to use a directory other than the default directory for the personal texmf tree (the latter is set in texmf.cnf). If I want the personal texmf tree to be ignored I simply invoke latex (in a Bash shell) like

TEXMFHOME="" latex mydoc.tex
mhp
  • 8,692
  • So it would seem that if TEXMFHOME is unset or is empty then TeX uses the standard location (most likely $HOME/texmf). So this works if ones home texmf tree is in a non-standard place. Mine works for the standard place, so between us that's everything covered! – Andrew Stacey Sep 08 '11 at 17:49
  • @Andrew Stacey: Yes, in your case, you would simply pass TEXMFHOME=<non-existing-directory> to the subshell in which latex is executed. – mhp Sep 08 '11 at 18:30