Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MikTeX 2.5 and-shell-escape

1,096 views
Skip to first unread message

mrb...@yahoo.es

unread,
Feb 3, 2007, 3:45:50 AM2/3/07
to
Dear TeXexperts,

I cannot get success running:

pdflatex -shell-escape file.tex, or
pdflatex -enable-write18 file.tex.

Also, I have checked http://www.guit.sssup.it/phpbb/viewtopic.php?
p=10163&highlight=
and it doesnt work.

Finally I have play with environment variables, as shows http://
wiki.contextgarden.net/Write18, and it's the same.


Anyone can give more information?


PS. pdflatex -shell-escape works perfecty in w32tex distribution.

Ulrich Diez

unread,
Feb 3, 2007, 6:31:33 PM2/3/07
to
mrb...@yahoo.es wrote:

> I cannot get success running:
>
> pdflatex -shell-escape file.tex, or
> pdflatex -enable-write18 file.tex.

According to the MikTeX2.5-manual, you need _two_
leading dashes when specifying command-line-options:

pdflatex --enable-write18 file.tex.

Ulrich

Ruben

unread,
Feb 3, 2007, 7:05:45 PM2/3/07
to
I use Miktex 2.5 with Winedt.

In Winedt I did the following changes. Go to Options -> Execution
Modes:

for LaTeX:

In switches type in: --shell-escape %0

for Pdflatex:

in switches: --shell-escape

for Texify:
in switches: --tex-option=-shell-escape %0

for PDFTeXify:
in switches: --pdf --tex-option=-shell-escape

for ConTeXt:
in switches: --shell-escape

Do the necessary changes if you want to use the command line to
compile your tex file (i.e., replace %0 with the name of your tex
file). By the way, you don't need to do any (unsafe) change in the
environment variables.

Best,
Ruben.

mrb...@yahoo.es

unread,
Feb 4, 2007, 1:38:26 AM2/4/07
to
Thank you for your replies.

In MikTeX 2.5 (pdflatex 1.30.6-2.2):

pdflatex --shell-escape file.tex ... WORKS

But now (and before) the problem is \pdfshellescape, involved in
several packages, which does not work.

Could someone check this minimal example?:

\documentclass{article}

\begingroup
\makeatletter
\@ifundefined{pdfshellescape}
{%
\@latex@warning@no@line
{%
Status of \string\write18-feature cannot be detected
automatically!\MessageBreak
pdfTeX 1.30 or higher is needed for the check via%
\MessageBreak\string\pdfshellescape.\MessageBreak
It is assumed that \string\write18\space is enabled%
}%
}%

{%
\ifnum\pdfshellescape>0\else
\@latex@error
{\string\write18-feature is not enabled. Aborting soon}%
{%
Try command line option -shell-escape (teTeX)
or -enable-write18 (mikTeX).%
}%
\stop
\fi
}

\endgroup

\begin{document}

\immediate\write18{dir > listing}
\IfFileExists{listing}{\message{\write18 ENABLED}}{\message{\write18
DISABLED}}

}%

Robin Fairbairns

unread,
Feb 4, 2007, 9:20:11 AM2/4/07
to

the blank line after the second argument of \@ifundefined gets
translated to \par and given to \@ifundefined as a third argument

>\endgroup
>
>\begin{document}
>
>\immediate\write18{dir > listing}
>\IfFileExists{listing}{\message{\write18 ENABLED}}{\message{\write18
>DISABLED}}
>
>}%

what does that stuff do? do the \write18s in \IfFileExists have any
effect? -- i would imagine they would cause some sort of chaos: you
need \string\write there.
--
Robin Fairbairns, Cambridge

Ulrich Diez

unread,
Feb 4, 2007, 9:18:57 AM2/4/07
to
mrb...@yahoo.es wrote:

> In MikTeX 2.5 (pdflatex 1.30.6-2.2):
>
> pdflatex --shell-escape file.tex ... WORKS
>
> But now (and before) the problem is \pdfshellescape, involved in
> several packages, which does not work.
>
> Could someone check this minimal example?:

1. Your example is not complete.
Missing e.g., \end{document}

2. Large portions of the code in your exampe are copied
from a reply of mine to the discussion "Running programs
from tex" which was initiated by Ohad Kammar.
The message-ID of that posting is:
<epv85j$2up$01$1...@news.t-online.com>
If you do copy'n-paste, you should leave linebreaking
and indentation intact. You did not:

In the original code I wrote something like this:

[...]
\@ifundefined{pdfshellescape}
{%
[...]
}%
{%
[...]
}
[...]


In "your" exampe, I find something like this:

[...]
\@ifundefined{pdfshellescape}
{%
[...]
}%

{%
[...]
}
[...]

You see the additional empty line in your code?
This equals:

[...]
\@ifundefined{pdfshellescape}
{%
[...]
}%
\par
{%
[...]
}
[...]

Now guess what in "your code" will be the arguments to
\@ifundefined.

Ulrich

Ronald Klopp

unread,
Feb 4, 2007, 9:33:30 AM2/4/07
to
mrb...@yahoo.es wrote:

> \begin{document}
>
> \immediate\write18{dir > listing}
> \IfFileExists{listing}{\message{\write18 ENABLED}}{\message{\write18
> DISABLED}}
>
> }%

Sorry I pushed the submit-button to early.
I have yet another comment:
The second argument of \IfFileExists prints a \message to
screen.
I don't think it makes sense to call the \write-macro from
within the argument of a \message.
AFAIK \message will fully evaluate/expand/execute its
argument while writing to the \write18-register has nothing
to do with producing a text for the screen.
You need to prevent \write's expansion here.
You can e.g., use "\string\write" instead.

Ulrich


Message has been deleted

Ulrich Diez

unread,
Feb 4, 2007, 9:33:29 AM2/4/07
to
mrb...@yahoo.es wrote:

> \begin{document}
>
> \immediate\write18{dir > listing}
> \IfFileExists{listing}{\message{\write18 ENABLED}}{\message{\write18
> DISABLED}}
>
> }%

Sorry I pushed the submit-button to early.

mrb...@yahoo.es

unread,
Feb 4, 2007, 11:42:56 AM2/4/07
to
Well, apologies to everyone offended.


I would like you focus on \pdfshellescape. Take a look at this WORKING
example (part extracted from epstopdf package):

\documentclass{article}

\begingroup
\expandafter\ifx\csname pdfshellescape\endcsname\relax
\else
\ifnum\pdfshellescape>0 %
\else
\PackageWarningNoLine{epstopdf}{%
Shell escape feature is not enabled%
}%
\fi
\fi
\endgroup

\begin{document}

\immediate\write18{dir > listing}
\IfFileExists{listing}{\message{\string\write18 ENABLED}}
{\message{\string\write18DISABLED}}
\end{document}

If you run the file:

c:\>pdflatex --shell-escape shellescape.tex
This is pdfeTeX, Version 3.141592-1.30.6-2.2 (MiKTeX 2.5)
entering extended mode
(shellescape.tex
LaTeX2e <2005/12/01>
Babel <v3.8g> and hyphenation patterns for english, dumylang,
nohyphenation, (...)
(c:\miktex\tex\latex\base\article.cls
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(c:\miktex\tex\latex\base\size10.clo))

Package epstopdf Warning: Shell escape feature is not enabled.

(shellescape.aux) \write18 ENABLED (shellescape.aux) )
No pages of output.
Transcript written on shellescape.log.


You can see that the check of shell-escape fails but the \write18
command works properly.

How can I manage this issue?

Miguel.

Ulrich Diez

unread,
Feb 4, 2007, 6:47:33 PM2/4/07
to
mrb...@yahoo.es wrote:

> Well, apologies to everyone offended.

You obviously don't apologize to me because I'm not offended.
I'm just nitpicking ;-)

[...]


> Package epstopdf Warning: Shell escape feature is not enabled.
>
> (shellescape.aux) \write18 ENABLED (shellescape.aux) )

[...]

When writing to a write-register without assigning a file
to it before via "\openout", you usually don't get an
error-message, but the written stuff silently ends up in
"nirvana".

The \IfFileExists-check seeks the whole texmf-tree for
the file.

Thus I see the following "scenario" for your result:

Either: Bug in MiKTeX 2.5
And/Or:
- You have shell-escape-feature disabled so that the test
for \pdfshellescape is negative.
- You already have some file "listing" or "listing.tex"
somewhere in the texmf-tree or in some other dirctory
which is searched by TeX (e.g., the directory where the
file with the TeX-job is stored) so that the test via
\IfFileExists is positive.

The chance that a file named "listing" already exists in the
texmf-tree is high. But there is another noteworthy issue
with the filename "listing":

The name provided has no filename-extension.

In many TeX-implementations (e.g., MiKTeX 2.4) you often
cannot deal successfully in the expected way with filenames
that come without a filename-extension because if no
filename-extension is supplied, TeX automatically assumes/
attaches the extension ".tex".

To me it happened that
- while not having a file "foo" in the texmf-tree, but having the
file "foo.tex" in the system, the \IfFileExists-test on "foo"
yielded true.
- while having a file "foo" in the texmf-tree, but not having the
file "foo.tex" in the system, the \IfFileExists-test on "foo"
yielded false.

Ulrich

Ulrich Diez

unread,
Feb 4, 2007, 6:54:21 PM2/4/07
to
mrb...@yahoo.es wrote:

> If you run the file:
>
> c:\>pdflatex --shell-escape shellescape.tex

Did you already try

c:\>pdflatex --enable-write18 shellescape.tex

instead?

Ulrich


mrb...@yahoo.es

unread,
Feb 5, 2007, 1:27:48 AM2/5/07
to
Thanks for your interest.

It´s right everything you say; my situation is:

pdflatex shellescape.tex - > does not create listing file, message
shell escape feature not enabled

pdflatex --shell-escape shellescape.tex = create listing file, message
shell escape feature not enabled

(removing listing file)
pdflatex --enable-write18 shellescape.tex = create listing file,
message shell escape feature not enabled


Well, I can not think about anything different of an error in
\pdfshellescape.

Miguel.

Heiko Oberdiek

unread,
Feb 5, 2007, 5:32:03 AM2/5/07
to
mrb...@yahoo.es wrote:

> pdflatex shellescape.tex - > does not create listing file, message
> shell escape feature not enabled

Same with pdfTeX 1.40.3 (linux).

> pdflatex --shell-escape shellescape.tex = create listing file, message
> shell escape feature not enabled

* file "listing" is created
* message "\write 18 ENABLED" as expected.

> pdflatex --enable-write18 shellescape.tex = create listing file,
> message shell escape feature not enabled

* unrecognized option `--enable-write18'
* error with "\write18-feature is not enabled"

> Well, I can not think about anything different of an error in
> \pdfshellescape.

I don't see anything wrong with it. Perhaps your version/binary is
broken. From the NEWS of pdfTeX:

| pdfTeX 3.141592-1.40.1 was released on 2007-01-08
| -------------------------------------------------
| - bugfix: the shell escape function was a bit broken

Yours sincerely
Heiko <ober...@uni-freiburg.de>

Dan

unread,
Feb 5, 2007, 4:58:17 PM2/5/07
to
On Feb 4, 8:33 am, "Ronald Klopp" <ronald.kl...@cov.inc.invalid>
wrote:

> mrbe...@yahoo.es wrote:
> > \begin{document}
>
> > \immediate\write18{dir > listing}
> > \IfFileExists{listing}{\message{\write18 ENABLED}}{\message{\write18
> > DISABLED}}
>
> > }%
>
> Sorry I pushed the submit-button to early.
> I have yet another comment:
> The second argument of \IfFileExists prints a \message to
> screen.
> I don't think it makes sense to call the \write-macro from
> within the argument of a \message.
> AFAIK \message will fully evaluate/expand/execute its

Fully expanded, but no assignments are evaluated and no
commands are executed (whatever that means). Since
\write is a nonexpandable token, it will be written as is.
(Almost. TeX may perform some processing of \escapechar-s
and adds a space after command names not escaped by
\string.)

> You need to prevent \write's expansion here.

It doesn't expand, so that isn't necessary.

> You can e.g., use "\string\write" instead.

That hs the advantage of suppressing an extra space,
but nothing more.


Dan

Ulrich Diez

unread,
Feb 5, 2007, 6:16:16 PM2/5/07
to
Dan Luecking wrote:

> On Feb 4, 8:33 am, "Ronald Klopp" <ronald.kl...@cov.inc.invalid>
> wrote:

Huh? What posting-header is this?

Ulrich

Dan

unread,
Feb 6, 2007, 2:21:20 PM2/6/07
to
On Feb 5, 5:16 pm, "Ulrich Diez" <eu_angel...@web.de.invalid> wrote:
> Dan Luecking wrote:
> > On Feb 4, 8:33 am, "Ronald Klopp" <ronald.kl...@cov.inc.invalid>
> > wrote:
>
> Huh? What posting-header is this?

I have no idea. It's what Google put there. I was clearly
replying to whoever made the statements about \write
"expanding".

Looking closer I see (in Free Agent and on Google) what
appear to be identical messages, one says it's from from
Ulrich Diez and the other says it's from Ronald Klopp.

I have seen literally thousands of erroneous usenet
headers over the years, so I don't pay them much
attention any more.


Dan

Ulrich Diez

unread,
Feb 6, 2007, 6:38:08 PM2/6/07
to
Dan Luecking wrote:

> On Feb 5, 5:16 pm, "Ulrich Diez" <eu_angel...@web.de.invalid> wrote:

[...]


> > Huh? What posting-header is this?
>
> I have no idea. It's what Google put there. I was clearly
> replying to whoever made the statements about \write
> "expanding".

That was me (Ulrich Diez). I didn't think carefully enough
before posting, so thanks for your annotations/corrections.

I had some "funny" experiences recently.
E.g., I got a bunch of messages where the guys from Google told
me that they had to deny my request for removal of some of my
usenet-postings from their archives. I checked by the IDs
provided: All postings in question were mine. (Into one of those
postings the name "Ronald Klopp" was involved also.)
But the joke is: I never requested Google to remove my postings.
I did not ask them to archive my trash, so I will not ask for
removal. Not my problem.


> Looking closer I see (in Free Agent and on Google) what
> appear to be identical messages, one says it's from from
> Ulrich Diez and the other says it's from Ronald Klopp.

If that ominous "Ronald Klopp"-posting is on Google, I can
find out the message-ID and probably ask for clarification.



> I have seen literally thousands of erroneous usenet
> headers over the years, so I don't pay them much
> attention any more.

I don't know all too much about how usenet works
nowadays. But to me it is hard to believe that somehow
posting-headers get "rearranged" by mistake.
Do you think that something scary is going on
or is it just a kind of google-usenet-lotto?

Ulrich

0 new messages