[Tex/LaTex] Texmaker (windows 7) don’t use TEXINPUTS environment variable

miktextexmaker

I normally use Unix system, but I am forced for a while on a Windows7 setup. I installed MikTex and texmaker 4.0.4. All is working except it seems that texmaker is not respecting the TEXINPUTS variable.

MWE: go in one dir and create directories TeXinputs and subdir. In subdir, file testinput.tex:

\documentclass[10pt]{article}
\usepackage{null}
\begin{document}
Nothing
\end{document}

in directory TeXinputs create the file null.sty:

\NeedsTeXFormat{LaTeX2e}[1996/06/01]
\ProvidesPackage{null}[2013/11/12 null package.]
\def\called{\relax}
\endinput

then add the environment variable as user TEXINPUTS with value .:../TeXinputs//.

To add it in Windows, open the "Start" menu, and start typing "environment" in the search box (I suppose it will be different with a non-English installation — in Spanish should be "variables de entorno"). Then choose "set environment variables for your account"and, in the windows that opens, you can add all the variables you want. This is my example:

Setting user environment variables

I have it defined and checked it (this is from a bash shell installed by git):

$echo $TEXINPUTS
./:../TeXinpus//

The idea is that I can use a structure like this in my work directory:

$ls 
TeXinputs subdir1 subdir2 

This works great for MikTeX, to have common files in the same place. I can compile my files correctly from bash:

$ pdflatex testinput
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9 64-bit)
entering extended mode
("z:\adit\My Documents\test\subdir\testinput.tex"
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, afrikaans, ancientgreek, ar
abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic,
croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
lician, german, german-x-2013-05-26, greek, gujarati, hindi, hungarian, iceland
ic, indonesian, interlingua, irish, italian, kannada, kurmanji, latin, latvian,
 lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerman, n
german-x-2013-05-26, nynorsk, oriya, panjabi, pinyin, polish, portuguese, roman
ian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swissgerm
an, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, usengl
ishmax, welsh, loaded.
("C:\Program Files\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex\latex\base\size10.clo"))
("z:\adit\My Documents\test\subdir\..\TeXinputs\\null.sty")
("z:\adit\My Documents\test\subdir\testinput.aux") [1{C:/ProgramData/MiKTeX/2.9
/pdftex/config/pdftex.map}] ("z:\adit\My Documents\test\subdir\testinput.aux")
)<C:/Program Files/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on testinput.pdf (1 page, 12304 bytes).
Transcript written on testinput.log.

As you can see, the file z:\adit\My Documents\test\subdir\..\TeXinputs\\null.sty is found and all is ok.

The problem and question: opening the file in texmaker and trying to compile gives error — it can't find the ../TeXinputs/null.sty file.

I checked too:

  • setting TEXINPUTS as a "system" environment variable (don't work)

  • using absolute path instead of relative one (with or without spces in the path, don't work)

Any hint on why relative TEXINPUTS paths are not working in texmaker?

Best Answer

I found the solution!.

The problem is the colon : in the TEXINPUTS path, used in Unix to separate the various paths, and that utterly confuses Windows. Instead of the colon, to separate elements in the path you should use a semicolon ;.

So setting:

TEXINPUTS=../TeXinputs

as in this image:

setting texinputs

it then does works in texmaker. If you need more than one path, you can use

TEXINPUTS=../TeXinputs;C:/Users/MYUSER/Desktop/TeXinputsGlobal

...and it works ok.

The confusion was that the bash shell understands the notation /c/ instead of C:\ but CMD.exe doesn't.