6

I have an module that I want to manage with l3build. Unpacking a docstrip file generates a tex file. l3build doc typesets that generated tex file. But I can't figure out how to configure build.lua to enable that process to see any images that should be included.

My MWE is four files (all in a Github repo for ease)

file tree

├── build.lua
├── foo.dtx
├── foo.ins
└── support
    └── duck.png

foo.dtx

%<*foo>
\documentclass{article}
\usepackage{graphicx}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\includegraphics[
    width=\textwidth,
%<bar>angle=180,
]{duck}
\end{document}
%</foo>

foo.ins

\input docstrip.tex
\askforoverwritefalse
\generate{\file{bar.tex}{\from{\jobname.dtx}{foo,bar}}}
\endbatchfile

So bar.tex has one extra line, which should rotate the image 180 degrees.

build.lua

module = "foo"

typesetsuppfiles = {"duck.png"}
typesetfiles = {"foo.dtx","bar.tex"}

duck.png

duck

Command:

l3build doc foo
  • duck.png is copied into typesetdir
  • foo.dtx is typeset in typesetdir (I think)
  • result: success. foo.pdf is moved into maindir.

Command:

l3build doc bar
  • bar.tex is unpacked into unpackdir
  • tex is run on bar.tex in unpackdir
  • result: failure because duck.png is not found.
9
  • Add duck.png in support/.
    – Niranjan
    Commented Nov 22, 2021 at 6:59
  • Hmm, I see where the issue arises ... need to think about a solution
    – Joseph Wright
    Commented Nov 22, 2021 at 9:44
  • @JosephWright the setup works fine for me if I set typesetfiles = {"*.dtx"}. Commented Nov 22, 2021 at 10:07
  • @UlrikeFischer Yes, I know :) It's to do with what gets copied where: there's an assumption that images or whatever go with 'real' sources, not with extracted demos. I think I may have to make an adjustment to l3build to address this.
    – Joseph Wright
    Commented Nov 22, 2021 at 10:09
  • 1
    Please: it might be a few days, but Marcel and I know we have a few issues to look at and fix
    – Joseph Wright
    Commented Nov 22, 2021 at 13:36

3 Answers 3

1

This should be your build.lua:

module = "foo"

typesetsuppfiles = { "duck.png" }
typesetfiles = {"foo.dtx"}

and the directory structure should be:

├── build.lua
├── foo.dtx
├── foo.ins
└── support
    └── duck.png

support is the official directory name supported by the l3build program.

2
  • 1
    What I understood from the documentation is that support is the default directory name, and it could be changed. But I did as you suggested with moving the image file and removing the supportdir line. The bigger issue is that I don't want to typeset foo.dtx, I want to typeset foo.tex. In my actual use case unpacking foo.dtx generates several different tex files. Commented Nov 22, 2021 at 9:57
  • I have a better version of my MWE now. Commented Nov 22, 2021 at 13:30
0

The following code (yes it's ugly) works for the specific case you present:

module = "foo"

--typesetsuppfiles = {"duck.png"}
typesetfiles = {"foo.dtx","bar.tex"}

function docinit_hook()
  errorlevel = cp("duck.png", "./support", unpackdir)
  if errorlevel ~= 0 then
    error("** Error!!: Can't copy duck.png from ./support to "..unpackdir)
    return errorlevel
  end
  errorlevel = cp("duck.png", "./support", typesetdir)
  if errorlevel ~= 0 then
    error("** Error!!: Can't copy duck.png from ./support to "..typesetdir)
    return errorlevel
  end
  return 0
end
1
  • Thanks. I've been reading through your demopkg\-jw repo so I recognize your code. I think this could be cleaned up using some of the pattens in l3build's modules, so that every file in supportdir that matches a pattern in typdsetsuppfiles is copied into unpackdir and typesetdir. But I think that's what build/local is really for. Commented Nov 22, 2021 at 20:50
0

I submitted an issue to the l3build github and it has been fixed. Thanks Joseph and Marcel!

You must log in to answer this question.

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