[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#311424: checking for write18



Frank Küster <frank@debian.org> writes:

> Norbert Preining <preining@logic.at> wrote:
>

>> Therefor I suggest an appropriate error message, when the epstopdf
>> packages is used in latex documents, but `\write18' is disabled. In
>> addition an example of how to enable it (example: pdflatex -shell-escape
>> test.tex) would be very helpful.
>
> Does anybody on the list know how to check whether \write18 is enabled
> in a TeX document?

This page
<http://groups.google.co.uk/group/comp.text.tex/browse_thread/thread/c843abf7f2f476b7/361e72f2028b7798?lnk=st&q=test+%5Cwrite18+enabled&rnum=2#361e72f2028b7798>

gives one possibility:

\def\tmpfile{/tmp/w18-test-\the\year\the\month\the\day\the\time}
\immediate\write18{touch \tmpfile}
\IfFileExists{\tmpfile}{\message{YES}}{\message{NO}} 

but one should really check \tmpfile didnt exist before the 'touch',
and maybe get rid of \tmpfile afterwards (which has possible security
risks i suppose).  And as Ralf said this is non-portable: 'touch'
wouldnt work in miktex (i dont know if windows even has an equivalent
command), and nor is -shell-escape the correct option for turning on
\write18 under miktex...



Reply to: