# Using a .bat file with TeXlipse

I use TeXlipse as editor of my choice.

Since I use the `nomencl` package, I added a `.bat` file in TeXlipse preferences:

``````@echo off

pdflatex -synctex=1 -interaction=nonstopmode main.tex
makeindex main.idx
makeindex main.nlo -s nomencl.ist -o main.nls
bibtex main
``````

Now my problem is that every project would use this `.bat` file in this folder. If I have to swap between two projects I always need to adapt the file.

Is there a way I can specify a `.bat` file directly in the `.tex` file, so that I can use a `.bat` file for a specific project?

-
Is not possible to use a kind of variable to the main file? Something like %f.tex? – Sigur Jul 3 '12 at 22:32

You have a different option now: just add

``````% arara: pdflatex: {synctex: yes, action: nonstopmode}
% arara: makeindex
% arara: nomencl
% arara: bibtex
% arara: pdflatex
``````

at the beginning of your LaTeX file (say `main.tex`) and change the `.bat` file into

``````@echo off

arara main
``````

If you have an uptodate TeX Live 2012, arara will already be available. With MiKTeX 2.9 you have to install it. See https://github.com/cereda/arara for finding the installer and the documentation.

-

In the builder of Texlipse you can call your .bat as usual and in the arguments pour `%input`.

Then in your .bat you can do

``````@echo off
cd "%~dp1"
set texSource=%~n1

pdflatex -synctex=1 -interaction=nonstopmode "%texSource%.tex"
makeindex %texSource%.idx
makeindex %texSource%.nlo -s nomencl.ist -o %texSource%.nls
bibtex %texSource%
``````

Also, I suggest you look at using LatexMK which, after you installed Perl, allows you to replace all that above with

``````latexmk -pdflatex="pdflatex -file-line-error -synctex=1" -pdf "%texSource%" -r latexmk
``````

for instance.

-