I wanted to set my TEXINPUTS
environment variable from with an arara
rule/directive. For example my texinputs.yaml
rule is
!config
identifier: texinputs
name: texinputs
command: export TEXINPUTS="@{mypaths}$TEXINPUTS:"
arguments:
- identifier: mypaths
flag: "@{parameters.mypaths}"
and my test.tex
file is
\documentclass{article}
\begin{document}
Hello world
\end{document}
% arara: texinputs: { mypaths: ".//:" }
% arara: pdflatex
When I run arara -v test
from the directory in which test.tex
is located, I get
Running texinputs…
I'm sorry, but the command from the 'texinputs' task could not be
found. Are you sure the command 'export TEXINPUTS=".//:$TEXINPUTS:"'
is correct, or even accessible from the system path?
What am I doing wrong? I am on Linux with TeX Live 2012
.
Best Answer
I learned a lot in chat. Even if
texinputs.yaml
could be made to set theTEXINPUTS
environment variable, this will have no affect on subsequent calls to thepdflatex
directive since each directive runs in a self contained environment. The problem withtexinputs.yaml
as constructed is that in Linuxexport
is a special commands built into the Bash shell and therefore "confuses"arara
into thinking it is not a command.The simplest, and possibly cleanest work around is to redefine the
pdflatex.yaml
rule to take atexinputs
argument and then runpdflatex
inenv
which allows setting of the environment variables. Specifically, the modified rule looks likeThere are at least two problems with this approach: it ignores previously set values of
TEXINPUTS
and cannot handle paths with spaces in them. It might be possible to work around both of these issues. A more general solution, but one that requires adding an additional script is to modifypdflatex.yaml
to beand define a
texinputs.sh
file asThis handles the appending of a preexisting
TEXINPUTS
as well as spaces in the path. I am hoping that there is a cleaner approach which handles a preexistingTEXINPUTS
as well as spaces and doesn't require anextra
script file.