I learned a lot in chat. Even if texinputs.yaml could be made to set the TEXINPUTS environment variable, this will have no affect on subsequent calls to the pdflatex directive since each directive runs in a self contained environment. The problem with texinputs.yaml as constructed is that in Linux export 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 a texinputs argument and then run pdflatex in env which allows setting of the environment variables. Specifically, the modified rule looks like
!config
# PDFLaTeX rule for arara
# author: Marco Daniel
# last edited by: Paulo Cereda
# requires arara 3.0+
identifier: pdflatex
name: PDFLaTeX
command: <arara> @{texinputs} pdflatex @{action} @{draft} @{shell} @{synctex} @{options} "@{file}"
arguments:
- identifier: action
flag: <arara> --interaction=@{parameters.action}
- identifier: shell
flag: <arara> @{isTrue(parameters.shell,"--shell-escape","--no-shell-escape")}
- identifier: synctex
flag: <arara> @{isTrue(parameters.synctex,"--synctex=1","--synctex=0")}
- identifier: draft
flag: <arara> @{isTrue(parameters.draft,"--draftmode")}
- identifier: options
flag: <arara> @{parameters.options}
- identifier: texinputs
flag: "env TEXINPUTS=@{parameters.texinputs}"
There 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 modify pdflatex.yaml to be
!config
# PDFLaTeX rule for arara
# author: Marco Daniel
# last edited by: Paulo Cereda
# requires arara 3.0+
identifier: pdflatex
name: PDFLaTeX
commands:
- <arara> @{texinputs} '@{action} @{draft} @{shell} @{synctex} @{options} "@{file}"'
arguments:
- identifier: action
flag: <arara> --interaction=@{parameters.action}
- identifier: shell
flag: <arara> @{isTrue(parameters.shell,"--shell-escape","--no-shell-escape")}
- identifier: synctex
flag: <arara> @{isTrue(parameters.synctex,"--synctex=1","--synctex=0")}
- identifier: draft
flag: <arara> @{isTrue(parameters.draft,"--draftmode")}
- identifier: options
flag: <arara> @{parameters.options}
- identifier: texinputs
flag: texinputs.sh "@{parameters.texinputs}"
default: pdflatex
and define a texinputs.sh file as
#!/usr/bin/bash
TEMP=$(echo $1 | sed s#\"##g)
export TEXINPUTS=$TEMP:$TEXINPUTS
pdflatex $2
This 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 preexisting TEXINPUTS as well as spaces and doesn't require an extra script file.
+1Thank you very much for sharing this answer, Daniel!:)– Paulo Cereda Jul 16 '13 at 01:23texinputs.shthrows arguments$3and further arguments away. Also I would putpdflatexas argument totexinputs.sh. Then the linepdflatex $2can be replaced by the two linesshiftand"$@". And the call in the rule would be@{texinputs} pdflatex @{action} @{draft} @{shell} @{synctex} @{options} "@{file}". – Heiko Oberdiek Jul 16 '13 at 08:01araradoes for valid commands. I am not sure why from a design standpoint it is beneficial to prevent running shell built-in functions. – StrongBad Jul 16 '13 at 10:46export LC_ALL="en_US"as a user command in TeXStudio? I need to be done before callingLuaLaTeX. – Royi May 27 '18 at 04:05