Next: , Up: \write   [Contents][Index]


27.5.1 \write and security

The ability to write files raises security issues. If you compiled a downloaded LaTeX file and it overwrote your password file then you would be justifiably troubled.

Thus, by default TeX systems only allow you to open files for writing that are in the current directory or output directory, if specified (see output directory), or in a subdirectory of those. So, this code

\newwrite\jhfile
\openout\jhfile=../test.jh

gives an error like:

Not writing to ../test.jh (openout_any = p).
! I can't write on file `../test.jh'

You can get just such an error when using commands such as \include{../filename} because LaTeX will try to open ../filename.aux. The simplest solution is to put the included files in the same directory as the root file, or in subdirectories.


Unofficial LaTeX2e reference manual