add tag
JouleV
## Working directory

The following three files, `testpkg.dtx`, `testpkg.ins` and `build.lua` are in the same directory:

### `testpkg.dtx`

```
% \iffalse
%<*driver>
\documentclass{ltxdoc}
\begin{document}
\DocInput{testpkg.dtx}
\end{document}
%</driver>
% \fi
% \section{Main package file}
%    \begin{macrocode}
%<*main>
\ProvidesPackage{testpkg}
\input{testpkg.code.tex}
%</main>
%    \end{macrocode}
% \section{Code file}
%    \begin{macrocode}
%<*code>
\def\foo{A nice macro}
%</code>
%    \end{macrocode}
```

### `testpkg.ins`

```
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\usedir{tex/latex/testpkg}
\generate{\file{testpkg.sty}{\from{testpkg.dtx}{main}}}
\usedir{tex/latex/testpkg/src}
\generate{\file{testpkg.code.tex}{\from{testpkg.dtx}{code}}}
\endbatchfile
```

### `build.lua`

```lua
module = "testpkg"
installfiles = {"*.sty", "*.code.tex"}
packtdszip = true
```

## What I did

Now I `cd` to that directory and run `l3build ctan`. It gives me this beautiful output:

![blob](/image?hash=85ec3db410674f8004388370b7830257bb6f5fc6446bf0bbbb55d1626728e1ca)

The command also returns `0`, so I suppose all steps are executed successfully.

## Problem

The structure of `build/distrib/tds` folder is like this:

```none
├───doc
│   └───latex
│       └───testpkg
│           └───testpkg.pdf
├───source
│   └───latex
│       └───testpkg
│           ├───testpkg.dtx
│           └───testpkg.ins
└───tex
    └───latex
        └───testpkg
            ├───testpkg.code.tex
            └───testpkg.sty
```

This TDS is good enough, and when I paste it to `~/texmf`, I am able to use `testpkg`. However, in the installer file I write this

```
\usedir{tex/latex/testpkg/src}
```

I want `testpkg.code.tex` to be put in `tex/latex/testpkg/src` and not in `tex/latex/testpkg`. So, `l3build` seems to ignore this `\usedir`.

How can I tell `l3build` to put `testpkg.code.tex` to the right place?
Top Answer
Skillmon
To control the tds structure, `l3build` uses its own settings/mechanism. For this you can specify the `tdslocations` variable, which is a list specifying the file paths of individual files in the tds with paths differing from the defaults. So to place your file `testpkg.code.tex` in `tex/latex/testpkg/src` you'll want to add the item

```lua
"tex/latex/testpkg/src/testpkg.code.tex"
```

to that list. If it is the only file with a special placement the variable initialisation in your `build.lua` file will look like the following:

```lua
tdslocations = {
	"tex/latex/testpkg/src/testpkg.code.tex",
}
```

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.