If you have 3 different files you need, you can use first-line (or second if you need utf8 stuff) comments. I use it to compile the main TeX file from one of the children.
%!../main_file.tex \documentclass[12pt,a4paper] \usepackage[czech,english]
I have a script, which looks at the first line:
match=`head -n1 $1 | grep %!` if [[ $match ]] then # do stuff with the parent's name, which is $ else # no match :/ fi
and a simple build file aiming at my custom script:
{ "cmd": ["/path/to/build/script.sh", "$file"], "selector": "whatever" }
This way, you can have as many "references" in your files as you want. Just switch the value of head -n1
.
In XML, you would probably use <!--%somefilename -->
with head -n1 $1 | grep '<!--%'
and $
.
To end with, I present to you my XeLaTeX build script ;)
#!/bin/bash file="$1" flag="-halt-on-error" match=`head -n1 $file | grep %!` if [[ $match ]] then if [ $ = ../ ] then cd .. && target=$ else target=$ fi else target=$file fi rubber -c 'set arguments -shell-escape' -f -m xelatex -W all $target exit 0