# Multiple instances of xelatex in parallel without overwriting generated PDF's

I've one TeX file abc.tex which is executed using xelatex abc.tex to generate the PDF file abc.pdf

Inside abc.tex I'm using the datatool package to read data from an external CSV file (say pqr.csv).

Now, I've to execute multiple CSV files for which I need to generate a PDF using abc.tex.

Currently, I'm manually changing the name of the CSV file inside abc.tex and executing xelatex to generate the PDF.

Is there any smart option to perform same operation multiple times? Is there any way I can run four instances of xelatex abc.tex and generate four separate PDF files in parallel?

You can first of all use a macro to hold the name of the .csv file in abc.tex:

\documentclass{article}
\usepackage{datatool}

\begin{document}

...

...

\end{document}


Then you can call xelatex from the command line by saying

xelatex -jobname=abc-pqr '\def\csvname{pqr}\input{abc}'

xelatex -jobname=abc-stu '\def\csvname{stu}\input{abc}'

xelatex -jobname=abc-vwx '\def\csvname{wvx}\input{abc}'


The first line will read pqr.csv and produce a file abc-pqr.pdf, the second line will read stu.csv and produce abc-stu.pdf, and similarly for the third line.

• Thanks a lot egreg for giving PERFECT direction. This is VERY MUCH useful. – Pawan Mude Dec 22 '13 at 6:13