I'm writing an automatic compiling pipeline that should be able to compile any given tex file into a pdf. The diversity of the input tex files mainly shows up in what format of figures they use and how they include them. The figures are mostly eps
, ps
, and pdf
, and they may use psfig
, graphix
etc to include them.
I'm not particular clear on what criteria I should set up in the pipeline about what figure handling packages used in those tex file should trigger which latex compiling scheme among pdflatex, latex, and xelatex. Any easy rule of thumbs or any tables that I can look for the rules? thanks.
EDIT
I am aware the question is not well posed in the first place. I think what I want is 1) is there a tool that could compile all sorts of tex files with different figure formats and figure handling packages. 2) if not, is there a specific keyword I should search for in the file that tells me what compiling method I should use?
My current design is to try various compiling schemes one by one (latex->pdflatex->xelatex) until it succeeds.
Best Answer
"to compile any given tex file" will not work as they are files which are incorrect and can't be compile.
If one assumes that the given tex file can be compiled but that you don't know how: Looking only at the content of the file is not enough. As an example if your file looks like this:
Then you should not use
xelatex
(because ofinputenc
) but iflatex
orpdflatex
can be used (or both) depends on the format(s) of the external image.Also while things like
fontspec
,polyglossia
,pstricks
or driver options like\usepackage[dvips]{....}
all are indications of the expected engine they don't exclude other engines (as they can be hidden in conditionals) and you can't completly rely on them if you don't have complete trust in the code of the tex files – and imho you shouldn't trust code which uses obsolete packages likepsfig
or which tries to include.ps
(non-encapsulated postscript) as graphic.At last: Finding the correct engine is perhaps not enough. Some documents only compile with additional command line switches (
--shell-escape
) or need a special format.