add tag
निरंजन
Suppose I have the following directory structure for a project named `foo`. It currently looks as follows:

```bash
.
├── bar
├── foo.dtx
└── foo.ins
```

What should I put in `foo.ins` to instruct it to `\generate` the README and `.sty` in `bar/`? Currently I have the following code in the `foo.ins`, but I am not able to find a way to `\generate` files at custom destinations.

### `foo.dtx`

```
% \iffalse
%<*driver>
\documentclass{l3doc}
\begin{document}
\DocInput{\jobname.dtx}
\PrintIndex
\end{document}
%</driver>
%<*package>
% Hello world
%    \begin{macrocode}
hello world
%    \end{macrocode}
%</package>
% \fi
\endinput
```

### `foo.ins`

```
\input l3docstrip
\usedir{tex/latex/\jobname}
\generate{%
  \file{bar/\jobname.sty}{\from{\jobname.dtx}{package}}%
}
\endbatchfile
```

### `build.lua`

```
module     = "foo"

-- Documentation:
typesetfiles     = { "foo.ins" }
```
Top Answer
Skillmon
You can just use a path in `\generate` (though I don't think this is a good idea, mangling with paths is almost never a good idea in LaTeX).


---
File: `foo.ins`
```
\input l3docstrip
\usedir{tex/latex/\jobname}
\generate{%
  \file{bar/\jobname.sty}{\from{\jobname.dtx}{package}}%
}
\nopreamble\nopostamble
\usedir{doc/latex/\jobname}
\generate{%
  \file{bar/README.txt}{\from{\jobname.dtx}{readme}}%
}
\endbatchfile
```
---

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.