[NTG-pdftex] cmd line arguments

Hans Hagen pragma at wxs.nl
Wed Jan 4 10:43:57 CET 2006

Reinhard Kotucha wrote:

>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.
>     http://ctan.org/tex-archive/support/epstopdf
>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.
i've never used epstopdf so maybe i talk non-sense, but running perl on 
windows is rather trivial: there is a good installer, and it comes with 
many libs included (more than on a standard linux install)

if the win tex distributions ship with 'binaries' they are not c 
binaries, but probably zipped 'perl binary + script ' archives; there is 
actually no reason for this so if a windows user wants to use the raw 
scritp with his system perl, aal he/she has to do is

- install perl
- copy stub files [runperl.exe -> whatever.exe]
- put perl scripts in tesmf scripts path

and things should run ok

(for context users i recommend using "texmfstart whatever.pl" in stub 

>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.
so, although your proposal is ok from the prespective of portability, 
it's not needed from the perspective of windows

concerning portability ... in principle all those shell scripts that now 
need to be provided as c program of perl script on windows qualify for 
some kind of luafying (we can even consider putting lua itself in the 
bin distributions; it's small)

(context ships with a ruby ps->pdf script and converting that would take 
quite some lua code -)

>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"}}
>  \expandafter\ifx\csname:opt:#1\endcsname\relax
>    \echo{Unknown Option "#1", ignored}
>  \else
>    \ProcessOption{#1}
>  \fi
>\def\GetArg#1 {\setbox0=\lastbox\endgraf
>  \if\OptionPrefix\car#1\\
>    \edef\Arg{\cdr#1\\}
>    \TestOption\Arg
>  \else
>    \ProcessFile{#1}\expandafter\end
>  \fi
>\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)
>   (./getargs.tex) 
>   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.
i can imagine that we provide access to the raw commandline (i assume 
that this info is availabl esomewhere)

>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?   
this is always a tricky thing and i've pondered a lot about it; there 
are several cases that make sense:

1 - permit nothing
2 - permit everything
3 - permit only programs in same path as calling binary (e.g. pdftex) 
4 - permits only programs in texmftree
5 - permits only programs in given list

(and maybe combinations)

so we need a setup like:


for context it would be enough to have


since texmfstart will handle the rest


More information about the ntg-pdftex mailing list