I am trying to build multiple variantsof my module from the same source directories using l3build.

I intend to provide multiple build.lua configurations, one for each variant.

Preliminary Question:

As far as I am concerned, I can not specify to l3build, which build.lua it should use, right? If this was somehow possible, I would just create files build-varA.lua, build-varB.lua and call l3build with each configuration. If it is possible, I'd like to know how, and then the remainder of my question becomes obsolete.

Currently not possible according to comment by Joseph Wright, author of l3build.

Main Question

Since I am not counting on a positive answer to my preliminary question, I have setup the following structure:

<project root>
 |  |-build.lua
 |  |-build.lua
 |  |-images
 |  |  |-exampleimage.png
 |  |-latex
 |  |  |-mytemplates
 |  |  |  |-mypackage.sty

The content is not important at this point (If reproducing, you may just create empty dummy files).

The build.lua should look like this:

-- varA/build.lua
#!/usr/bin/env texlua

module = "mymodulename"
pkgversion = "0.1-varA"
pkgdate = "26.06.2023"

-- create artefacts in the parent directory
maindir = ".."

-- look for source files in parent directory
sourcefiledir = "../src"
sourcefiles= {"**/*.dtx", "*.ins"}

-- look for documentation files in the common root
docfiledir = "../doc"
typesetfiles = {"*.tex"}

-- include partial tds trees
tdsdirs = { tex = "tex", fonts = "fonts", ../tex = "tex"}

-- keep the directory tree structure in build and tds
flatten = false
flattentds = false
  • The crucial part is the syntax of the tdsdirs variable: the keys are the directories in my project, and the values are the tds tree locations the files are copied to (see l3build documentation).
  • I have left out any *.dtx at this point, as it does not seem to be relevant.
  • I have left out any documentation files, as they do not seem relevant.

However, the config is not working. If I remove the ../tex = tex key-value pair, the config works, but then it searches for a directory <project root>/varA/tex to include instead of including <project root>/tex.

What I need is a way to specify relative/parent paths as keys in tdsdirs. Is this possible, and how?

  • Yes, I want to pull from the parent directory. But the documentation (l3build) states: "[...] the table tdsdirs is available. Each entry is a source directory and the matching installation target, for example tdsdirs = {sources = "tex"}. This would enable a directory sources in the development area to be used for testing and typesetting, and for it to be installed into the tex tree when building a release." So the syntax is quite unintuitive, and I think my interpretation is the correct one. I have of course still tried your suggestion, but it does not map the root tex tree.
    – marc
    Commented Dec 11, 2023 at 11:58
  • We don't currently support multiple configurations for release as ... that doesn't seem to make sense outside very particular circumstances. (The team do use a two-release strategy but based on the branch we are on for develop vs main for the LaTeX kernel.) Not directly part of the Q here, but I'm interested in the use case.
    – Joseph Wright
    Commented Dec 11, 2023 at 12:03
  • @JosephWright I have a professor who is adamant about "flat" directory structures, while I believe in separation of code and artefacts (and I want to teach that to students). So ultimately I have to maintain different variants of the templates for our institution, which only differ in their respective build configuration, hence I did not want to maintain multiple development branches. I understand its a niche use case.
    – marc
    Commented Dec 11, 2023 at 12:07
  • @DavidCarlisle I'll have a look into that and update the question with the additional information later.
    – marc
    Commented Dec 11, 2023 at 12:08
  • What would happen if users install both variants? Wouldn't they end up with duplicated files? Commented Dec 11, 2023 at 12:57

1 Answer 1


You need to remember that Lua only allows the 'shortcut' syntax

foo = { name = "value" }

when the name is alphanumeric. Here, you need to do things the 'complete' way:

tdsdirs["../tex"] = "tex"

as this will allow the use of . and / in the string.

  • Sorry, I can't remember what I never knew. However, this is exactly the information I have been lacking.
    – marc
    Commented Dec 11, 2023 at 15:50
  • @marc I mean 'you' in the general sense - 'Users of l3build need to remember that the build.lua file is a Lua file and therefore must follow the general syntax of Lua', if we want to be formal :)
    – Joseph Wright
    Commented Dec 11, 2023 at 16:12

You must log in to answer this question.

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