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]{scrartcl}
\usepackage[czech,english]{babel}
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 ${match:2:100}
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 ${match:5:100}
.
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 [ ${match:2:3} = ../ ]
then
cd .. &&
target=${match:5:100}
else
target=${match:2:100}
fi
else
target=$file
fi
rubber -c 'set arguments -shell-escape' -f -m xelatex -W all $target
exit 0
What tools do you use and what system are you on? I ended up making a custom (quite complex) build scripts for
knitr
and others. – mreq – 2013-04-13T20:59:07.493I am using a variety of tools and platforms, many of which have XSLT capabilities, so my question was whether there exists a plugin or similar that would smoothly allow me to apply an XSLT transform inside of the editor. External scripts might be OK as long as it is a one-time effort that can later be used on arbitrary XML/XSLT-files. – erikxiv – 2013-04-26T12:29:38.473
If you're able to create a custom bash script, it's easy to run it from sublime. If you're able to, I can link you to some further reading. – mreq – 2013-04-26T15:34:25.590
1I guess one of the tricks is that (1) the script requires two inputs, the xslt and the xml, and (2) that the output is a new file. If I write a script that takes three filenames as input (incl output name), how would I execute that and view the output without leaving the editor? If possible, could you write an answer so I can accept it? – erikxiv – 2013-04-30T08:53:26.033