[texhax] [tex-live] Access to Windows environment variables from \input

Zdenek Wagner zdenek.wagner at gmail.com
Mon Oct 6 22:57:31 CEST 2014

2014-10-06 22:48 GMT+02:00 Philip Taylor <P.Taylor at rhul.ac.uk>:
> Zdenek Wagner wrote:
>> Environment variables are expanded by cmd.exe, not by I/O libraries.
>> For these libraries % is just a character. You would have to call a
>> system library for retrieving the environment variables. And the
>> names of the environment variables are case sensitive and must be
>> all uppercase. You can use set test=something and both echo %test%
>> and echo %TEST% (and even echo %TesT%) will work because the
>> conversion to uppercase will be done automatically by cmd.exe but it
>> does not happen when called directly from your program. TEST will
>> have the expected value while the value of test will be an empty
>> string with no error message. TeX does not allow you to access
>> environment variables but it might be possible by luatex (I do not
>> know luatex, I just guess).
> David Carlisle wrote:
>> probably this would help
> http://tex.stackexchange.com/questions/62010/can-i-access-system-environment-variables-from-latex-for-instance-home/62039#62039
>> as for loading .tex I assume that's just because (a) the shell was
>> never called to expand environment variables and (b) I don't think
>> you can have a% in the filename in windows so you got the empty
>> filename with .tex appended... the latex tools directory has a .tex
>> file exactly to catch that kind of weirdness.
>> David (is texlive really the right list for this?)
> It was hard to know, whence it was sent both to TeXhax and to TeX-Live.
> Thank you both for your replies; all clear, but I am very surprised that a
> directory under .../texmf-dist/tex/latex/ should be in my TeX input path; I
> can understand it being in a LaTeX input path, but in a TeX input path as
> well ?
I don't think so. There may be files with the same name for both plain
TeX and LaTeX (and for different engines). Therefore the default
TEXINPUT first contains the format/engine specific directories and
then tex with all its directories. If it happens that in plain TeX you
need a LaTeX specific file and the file of the same name is not found
in the plain TeX tree, it will finally be found in the LaTeX tree. It
need not be true in other TeX distributions but TeX Live has this

> ** Phil.

Zdeněk Wagner

More information about the texhax mailing list