5

I am currently trying to start writing a package and l3build seems to be a rather useful tool for this. I have read up on how to write .ins and .dtx files as well as the documentation for l3build. As far as I could tell, a minimal setup for a new package would be a folder containing the following three files.

  • testpackage.dtx

    % \iffalse meta-comment
    %
    % Some notes about the package.
    % See for example siunitx.dtx for an example.
    %
    %<*driver>
    \documentclass{l3doc}
    % The next line is needed so that \GetFileInfo will be able to pick up
    % version data
    \usepackage{testpackage}
    \begin{document}
      \DocInput{\jobname.dtx}
    \end{document}
    %</driver>
    % \fi
    %
    % \GetFileInfo{testpackage.sty}
    %
    % \title{^^A
    %   \pkg{testpackage} -- Just for testing purposes!^^A
    %   \thanks{This file describes \fileversion,
    %     last revised \filedate.}^^A
    % }
    %
    % \author{^^A
    %  Someone^^A
    %  \thanks{^^A
    %    E-mail:
    %    \href{mailto:[email protected]}
    %      {[email protected]}^^A
    %   }^^A
    % }
    %
    % \date{Released \filedate}
    %
    % \maketitle
    %
    % \begin{documentation}
    %
    % \section{\cs{foo} is a function}
    % \begin{function}{\foo}
    %   \begin{syntax}
    %     |\foo| \marg{input}
    %   \end{syntax}
    %   Something about \cs{foo}.
    %   |\foo{bar}| will produce `\foo{bar}'.
    % \end{function}
    %
    % \end{documentation}
    %
    % \begin{implementation}
    %
    % \section{Implementation}
    %
    %    \begin{macrocode}
    %<*package>
    %    \end{macrocode}
    %
    %    \begin{macrocode}
    %<@@=testpackage>
    %    \end{macrocode}
    %
    %    \begin{macrocode}
    \RequirePackage{xparse}
    \ProvidesExplPackage {testpackage} {2019-06-23} {0.1.0}
                     {Just for testing purposes!}
    %    \end{macrocode}
    %
    % \begin{macro}{\foo}
    %   \begin{arguments}
    %     \item Some input
    %   \end{arguments}
    %   Some description of \cs{foo}
    %    \begin{macrocode}
    \NewDocumentCommand \foo { m }
      {
        I~saw~#1!
      }
    %    \end{macrocode}
    % \end{macro}
    %
    %    \begin{macrocode}
    %</package>
    %    \end{macrocode}
    %
    % \end{implementation}
    %
    % \PrintIndex
    
  • testpackage.ins

    \iffalse meta-comment
    
    Info about the package.
    
    \fi
    
    \input l3docstrip.tex
    \askforoverwritefalse
    \keepsilent
    
    \preamble
    This is the preamble!
    \endpreamble
    \postamble
    This is the postamble!
    \endpostamble
    
    \generate
      {%
        \file{testpackage.sty}
          {%
            \from{testpackage.dtx}{package}
          }%
      }
    
    \endbatchfile
    
  • build.lua

    -- Build script for the testpackage package.
    
    -- Identify the module.
    module = "testpackage"
    

Running l3build unpack seems to work fine and creates some folders containing the unpacked .sty file. However, trying to run l3build doc leads to the error message

! LaTeX Error: File `testpackage.sty' not found.
  • What do I have to change in the setup to be able to produce documentation using l3build?
  • Are there any other obvious steps I should include in this setup in order to avoid similar problems using the other l3build later (in particular check and ctan)?
  • Say I want to have a test document (not a test file for l3build) in which I can play around with the current development state of the package (without installing it in my texmf tree; unrelated documents should not find the development version of the package). Is there a convenient way to do this? Or do I have to manually copy the unpacked .sty file to some separate folder in order to test it in this way?
9

1 Answer 1

4

Taking the three parts

  • The set up you have should be correct with a recent l3build, at least for the minimal sources you've got

  • All steps in l3build use the same data, so once you have the doc target working then check and ctan will be the same

  • You have a few options for a test document. You could simply have it in the working folder and add it to typesetfiles or typesetdemofiles. You could use the --texmfhome option to use a custom install location: this works best if you use TEXINPUTS or auxtrees to set up additional inputs. Or you could as you say simply unpack and then copy manually.

You must log in to answer this question.

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