[NTG-pdftex] cmd line arguments

Reinhard Kotucha reinhard.kotucha at web.de
Tue Jan 3 23:55:54 CET 2006

I got the latest issue of TUGboat today and read Hans' article about
LuaTeX with great interest.

Obviously Hans had the enhancement of [pdf]TeX in mind.  But I think
that much more can be done with it.

Given that LuaTeX allows shell-escapes, I think that it makes a lot of
sense to replace some Perl scripts by LuaTeX.  For instance, Heiko
fixed two bugs in epstopdf I reported but I did not get any response
from the author of the C-version which still resides on CTAN.


This version is still broken.  TeXLive does not provide Perl for
Windows users and I suppose that MikTeX doesn't as well.  Instead,
binaries are provided.  If someone detects a bug, a fixed Perl script
can be provided for UNIX users immediately but Windows users still
depend on someone who provides new binaries.

Though I like Perl very much I think that LuaTeX is quite great.  It
can be make things much more portable.  Suppose that someone ports
epstopdf to LuaTeX, then Windows users can update easily.

There is one problem concerning how [pdf]TeX reads the command line.
[pdf]TeX expects a filename and considers all arguments which come
before the filename as options.  It complains if an option is not
known.  However, options after the filename are accessible by TeX.

Try the following file:


\newlinechar=`\^^J \def\echo#1{\message{^^J#1}}




\def\ProcessFile#1{\echo{File: "#1"}}

    \echo{Unknown Option "#1", ignored}

\def\GetArg#1 {\setbox0=\lastbox\endgraf


\DefineOption{abc}{\echo{Known Option "abc"}}
\DefineOption{def}{\echo{Known Option "def"}}


When I say

   tex -abc getargs -def -uvw xyz

I get:

   $ tex -abc getargs -def -uvw xyz
   tex: unrecognized option `-abc'
   This is TeX, Version 3.141592 (Web2C 7.5.4)
   Known Option "def" 
   Unknown Option "uvw", ignored 
   File: "xyz"
   No pages of output.
   Transcript written on getargs.log.

Though it is good that TeX makes all arguments available to TeX which
come after the filename, there is a problem if getargs is a format

In this case the command line looks like

    getargs -abc -def -uvw xyz

and everything before "xyz" is lost.

In other words, if you say

    epstopdf -hires myfile.eps 

TeX will complain

    epstopdf: unrecognized option `-hires.'

How can this problem be fixed?

The current behaviour of web2c is absolutely correct but I assume that
LuaTeX users need a bit more.

Is it possible to convince [pdf]TeX to ignore unknown options for
particular format files by adding some lines to texmf.cnf similar to

  TEXINPUTS.latex = ...

which disable commandline option checking and pass everything to TeX?

Another point:
It would be nice if LuaTeX allows shell-escapes.  This might be
regarded as beeing unsecure.  What about having a list of trusted
programs in texmf.cnf?   


Reinhard Kotucha			              Phone: +49-511-4592165
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.

More information about the ntg-pdftex mailing list