docstripprovides the macro \batchinput, which calls a separate ins file. This file can be in a different directory with, say:


and they are generated, but in the same directory as the master ins. However, I want them to be generated in the same directory as the dtx/ins files. I've tried


But then I get

! I can't write on file `../contrib/xx.ldf'.

Edit ... because TeXLive doesn't allow paths beginning with two dots.

I know \BaseDirectory, but this is intended for specifing the root directory of the TEX hierarchy (locally, by administrators).

How can I tell docstrip the files must be generated in the same directory as the dtx/ins files? Edit In other words, I wonder if these ins files can be run without having to set the path of the corresponding files (only the ins one).

  • 5
    TeX Live and MiKTeX disallow writing in directories above the current one or those specified with a full path.
    – egreg
    Commented Jun 22, 2012 at 14:51
  • Assuming bash, you can say openout_any=a tex file.ins; use at your own risk.
    – egreg
    Commented Jun 22, 2012 at 17:00
  • @egreg. Well, assuming bash, I think I can write an script running directly all those ins files, intead of using a master ins. Commented Jun 22, 2012 at 17:02
  • Of course. But this is a security issue, so without specific and explicit user intervention, writing is disallowed except in the current directory or subdirectories thereof.
    – egreg
    Commented Jun 22, 2012 at 17:14
  • Clearly, there is no hope... except moving the ins file to the "local" root directory, so that all ins files are in subdirectories (base and contrib). Not very elegant, imo, but it works. Commented Jun 22, 2012 at 17:49

1 Answer 1


TeX Live sets up his options in the file texmf.cnf located in texlive/20XX/texmf/web2c/ However this file needn't to be edit. You should edit instead the file texmf.cnf in the directory texlive/20XX/.

In the main file you will find the following hint:

% Allow TeX \openin, \openout, or \input on filenames starting with `.'
% (e.g., .rhosts) or outside the current tree (e.g., /etc/passwd)?
% a (any)        : any file can be opened.
% r (restricted) : disallow opening "dotfiles".
% p (paranoid)   : as `r' and disallow going to parent directories, and
%                  restrict absolute paths to be under $TEXMFOUTPUT.
openout_any = p
openin_any = a

Based on this information you can edit the file texmf.cnf and set up openout_any=a

  • Thanks, but the ins files should work out of the box. Commented Jun 22, 2012 at 17:51
  • This was very helpful, thank you!
    – Jan
    Commented Jan 29, 2022 at 11:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .