Difference between revisions of "Write18"

From Wiki
Jump to navigation Jump to search
m (→‎Windows - MikTeX: deleted a note for deprecated MikTeX 2.4 (it's archived anyway))
m (→‎Windows - MikTeX: correcting myself after testing)
Line 7: Line 7:
  
 
Each application now has it's own configuration file. To enable <code>write18</code> run
 
Each application now has it's own configuration file. To enable <code>write18</code> run
 +
initexmf --edit-config-file=miktex\config\pdftex.ini
 +
or (if you have MikTeX 2.5 or a version of ConTeXt from 2006)
 
  initexmf --edit-config-file=miktex\config\pdfetex.ini
 
  initexmf --edit-config-file=miktex\config\pdfetex.ini
 
and put
 
and put
 
  EnableWrite18=t
 
  EnableWrite18=t
 
into it. An alternative is to se the environment variable <code>MIKTEX_ENABLEWRITE18=t</code>.
 
into it. An alternative is to se the environment variable <code>MIKTEX_ENABLEWRITE18=t</code>.
 
''Note: it could have made more sense if MikTeX would read settings from pdftex.ini, not from pdfetex.ini in 2.6. I don't know if this is intentional or not though.''
 
  
 
=== Linux/Mac ===
 
=== Linux/Mac ===

Revision as of 13:14, 19 May 2007

When write18 is turned on, it means that it's possible to execute external programs in the middle of a TeX run. This is required to make some modules such as those for R, lilypond, gnuplot, ... etc. to work properly, but may impose a security leak if you would be running TeX on a server with untrusted sources of TeX files, so it's turned off by default.

How to turn on write18

Windows - MikTeX

MikTeX 2.5/2.6

Each application now has it's own configuration file. To enable write18 run

initexmf --edit-config-file=miktex\config\pdftex.ini

or (if you have MikTeX 2.5 or a version of ConTeXt from 2006)

initexmf --edit-config-file=miktex\config\pdfetex.ini

and put

EnableWrite18=t

into it. An alternative is to se the environment variable MIKTEX_ENABLEWRITE18=t.

Linux/Mac

First try to figure out where your configuration file resides:

kpsewhich texmf.cnf

will should return you something like

/usr/local/teTeX/texmf.cnf

or

/usr/local/gwTeX/texmf.cnf

In that file you'll probably find a line reading

shell_escape = f

Change that "f" (false) to "t" (true) to enable it.

How to check if write18 is turned on

Sometimes while writings a module, one needs to check if write18 is enabled or now. There are different ways in which this can be done.

\ifeof18 works with both pdfTeX and XeTeX, while \pdfshellescape only works with pdfTeX.

Hans response on the mailing list

write 18 is a hack and pdfshellescape a sane replacement

in luatex it will probably be gone completely since there we have

\directlua 0 { os.execute("...") }

See also