# MikTeX does not use TEXMFLOCAL environment variable

I use TEXMFLOCAL, TEXINPUTS and TEXFONTMAPS to tune tex compilation. Everything works fine under Linux and Mac OS X, but MitTeX under Windows breaks my expectations.

c:\tmp\tex> type test.bat
set TEXMFLOCAL=some;thing
kpsewhich --var-value TEXMFLOCAL

c:\tmp\tex> test.bat

c:\tmp\tex>set TEXMFLOCAL=some;thing

c:\tmp\tex>kpsewhich --var-value TEXMFLOCAL
C:/Documents and Settings/user/Application Data/MiKTeX/2.9


Why the value of the environment variable TEXMFLOCAL is ignored? Do I set it wrong, or is it a feature of MikTeX? How to affect MikTeX's TEXMFLOCAL, TEXINPUTS and TEXFONTMAPS from a script (.bat or .py)?

-
AFAIK MikTeX does not support TEXMFLOCAL, only TeX Live based distributions does. MikTeX has the concept of roots instead. –  daleif Jun 12 '13 at 9:34
You can register a root in a script with initexmf --register-root=path\to\root. You can unregister it with -unregister-root. –  Ulrike Fischer Jun 12 '13 at 9:58
The idea is not to touch an existing TeX installation at all. Adding root is invasive. And after adding root, I then need to teach MikTeX about my font map file. –  olpa Jun 12 '13 at 10:48
If the texmf tree you are trying to add contains relevant font map files (or e.g. a updmap.cfg) you will in any case have to run updmap - regardless how you announce the tree to a tex system. Adding and removing roots in miktex is easy (and is imho one of the great features of miktex which I'm using constantly) and it is the way to do it in this tex system. Use TeXLive if you don't like it. –  Ulrike Fischer Jun 12 '13 at 11:39

The only environment variables recognised (at least the documented ones) by MiKTeX globally are (MiKTeX manual, Chapter 8):

BIBINPUTS Extra paths to locate .bib files.

BSTINPUTS Extra paths to locate .bst files.

MFINPUTS Extra paths to locate METAFONT input and openin files.

MIKTEX_REPOSITORY Location of the package repository. This can be either a fully qualified path name (a local package repository) or an URL (a remote package repository).

MIKTEX_TRACE Comma-separated list of trace stream names (see Chapter 9, Trace Streams). If this variable is set, then MiKTeX programs will write trace messages into the DebugView window.

MPINPUTS Extra paths to locate MetaPost input files.

TEXINPUTS Extra paths to locate TeX \input and \openin files.

TFMFONTS Extra paths to locate TeX font metric files

If you want to know hot to set a local texmf tree have a look at Create a local texmf tree in MiKTeX

-
I wouldn't dare to claim that these are the only variables ;-). Not everything in miktex is documentated and some variable are only mentioned in some messages. E.g. some time ago you needed to set MIKTEX_GS_LIB to be able to use mgs on the command line. –  Ulrike Fischer Jun 12 '13 at 10:29
@UlrikeFischer Can you please let us now which ones are not documented? –  karlkoeller Jun 12 '13 at 10:31
I can't. Over the years Christian mentioned some (like the MIKTEX_GS_LIB) in postings. I don't know if they still in use or if other have been added. The documentation of miktex is not very elaborate. A lot of things which actually work fine (like e.g. --shell-escape, or MIKTEX_EDITOR) are not mentioned. –  Ulrike Fischer Jun 12 '13 at 10:44
@UlrikeFischer I hoped you knew more about them... Anyway I was aware of MIKTEX_EDITOR which is the equivalent of TEXEDIT and MFEDIT (BTW, I don't know why MPEDIT isn't substituted by that variable as well) –  karlkoeller Jun 12 '13 at 10:54
Just for clarification: Is the sematics regarding TEXINPUTS, BSTINPUTS and BIBINPUTS different from TexLive? For instance, does a \usepackage look into folders given by TEXINPUTS? –  Daniel Jun 12 '13 at 11:23