I have a project directory and within the project directory a package in a local texmf-tree. As the project resides in a repository and is compiled on different computers, I would like to have a compile command that first sets the TEXMFHOME variable and then executes pdflatex. Last, I use texstudio v2.10.8. How could I get this working?

In my real scenario I want the packages also to be found in multiple tex-files located in subfolders. Hence, the use of TEXMFHOME.


I have a file main.tex


and foo.sty in texmf/tex/latex/


Also, a file Makefile with content


        export TEXMFHOME=./texmf/
        pdflatex $(MAIN).tex

.PHONY: clean force once all

From command line it works as expected. If I execute /usr/bin/make from texstudio it does not find foo.sty.

  • 2
    Might be more of a make or shell question (perhaps TeXstudio uses /bin/sh which may or may not be the same as /bin/bash). Have you tried TEXMFHOME=./texmf/ pdflatex $(MAIN).tex all on one line? Alternatively, three lines of TEXMFHOME=./texmf/, export TEXMFHOME, pdflatex $(MAIN).tex? – Mike Renfro Aug 13 '17 at 13:01
  • TEXMFHOME=./texmf/ pdflatex $(MAIN).tex seems to work. Do you have any ideas why that would work? I mean, usually I would use ; to sequentialize commands. But then it does not work when calling from texstudio. – Heinrich Ody Aug 13 '17 at 14:45
  • 3
    From within make it uses /bin/sh and from command line /bin/bash. Also, the three line version did not work from within texstudio... – Heinrich Ody Aug 13 '17 at 14:52
  • 1
    I'm assuming the Makefile works consistently, regardless if you run it from the command line or from TeXstudio. The GNU make manual indicates that it'll use /bin/sh as the default shell. If /bin/sh is a symlink to bash, it'll behave like this. If it's a symlink to dash as I suspect, then bash-specific commands like export N=v won't work, any more than \newcommand would work with regular TeX. – Mike Renfro Aug 15 '17 at 0:51
  • 1
    @MikeRenfro, Is there a way to define variable in TeXStudio as part of a command? For instance, I tried export LC_ALL="en_US"; lualatex -synctex=1 -interaction=nonstopmode %.tex but it won't work. I need to set LC_ALL="en_US" in TeXStudio environment before running LuaLaTeX. – Royi May 27 '18 at 4:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.