2

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.

MWE

I have a file main.tex

\documentclass{article}
\usepackage{foo}
\begin{document}
    \foo
\end{document}

and foo.sty in texmf/tex/latex/

\newcommand{\foo}{c}

Also, a file Makefile with content

MAIN=main

compile:
        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.

9
  • 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? Aug 13, 2017 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. Aug 13, 2017 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... Aug 13, 2017 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. Aug 15, 2017 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, 2018 at 4:16

0

You must log in to answer this question.

Browse other questions tagged .