Como criar um arquivo dtx padrão para um pacote usando LaTeX3 (semelhante ao dtxgen para LaTeX2e)

Como criar um arquivo dtx padrão para um pacote usando LaTeX3 (semelhante ao dtxgen para LaTeX2e)

Estou interessado em criar um pacote usando LaTeX3, mas não consigo (a) encontrar documentação sobre como gerar um novo arquivo dtx para ele ou (b) encontrar um modelo para criar um arquivo dtx para um pacote usando LaTeX3 (provavelmente usando l3doc).

Existe um utilitário (como dtxgeno LaTeX2e) ou modelo para pacotes LaTeX3?


Um exemplo do tipo de coisa que procuro.

Ao criar um pacote LaTeX (por exemplo mynewpackage), meu primeiro passo geralmente é executar

$ dtxgen mynewpackage.sty

O que cria um Makefilee mynewpackage.dtx(entre outros arquivos). Por padrão, isso usa docstrip e a classe ltxdocpara a documentação. Ambos são bons, mas o LaTeX3 introduz algumas mudanças, incluindo:

Atualmente, não consegui encontrar uma referência completa de todas as alterações que devem ser feitas para ativar o suporte completo ao LaTeX3.

Existe um script para gerar um arquivo dtx inicial com todas as alterações recomendadas para o LaTeX3 e/ou um local onde todas as alterações necessárias sejam documentadas?

Responder1

Eu recomendaria usar uma estrutura simples na qual você tenha:

  • Um ou mais .dtxarquivos
  • Um .insarquivo
  • README.md
  • Um CHANGELOG.msarquivo (vejahttps://keepachangelog.com/en/1.0.0/)
  • (Possivelmente) LICENSEcomo uma cópia da LPPL (parapor exemploGitHub)

e para pacotes maiores

  • Um separado .texpara a documentação do usuário
  • (Se estiver usando vários .dtxarquivos) Um .texarquivo para combinar toda a documentação do código em um PDF

Tomando esse modelo, o que .dtxeu recomendaria é o seguinte

% \iffalse meta-comment
%
% File: <NAME>.dtx Copyright (C) <YYYY> <AUTHOR>
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
% license or (at your option) any later version.  The latest version
% of this license is in the file
%
%    https://www.latex-project.org/lppl.txt
%
% This file is part of the "<NAME> bundle" (The Work in LPPL)
% and all files in that bundle must be distributed together.
%
% The released version of this bundle is available from CTAN.
%
% -----------------------------------------------------------------------
%
% The development version of the bundle can be found at
%
%    <SOURCE REPO>
%
% for those people who are interested.
%
% -----------------------------------------------------------------------
%
%<*driver>
\documentclass{l3doc}
% The next line is needed so that \GetFileInfo will be able to pick up
% version data
\usepackage{<NAME>}
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \GetFileInfo{<NAME>.sty}
%
% \title{^^A
%   \pkg{<NAME>} -- <DESCRIPTION>^^A
%   \thanks{This file describes \fileversion,
%     last revised \filedate.}^^A
% }
%
% \author{^^A
% <AUTHOR>^^A
%  \thanks{^^A
%    E-mail:
%    \href{mailto:<EMAIL>}
%      {<EMAIL>}^^A
%   }^^A
% }
%
% \date{Released \filedate}
%
% \maketitle
%
% \begin{documentation}
%
% \end{documentation}
%
% \begin{implementation}
%
% \section{\pkg{<NAME>} implementation}
%
% Start the \pkg{DocStrip} guards.
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%
% Identify the internal prefix (\LaTeX3 \pkg{DocStrip} convention).
%    \begin{macrocode}
%<@@=<PREFIX>>
%    \end{macrocode}
%
% \subsection{Initial set up}
%
% Load the essential support (\pkg{expl3}) \enquote{up-front}.
%    \begin{macrocode}
\RequirePackage{expl3}
%    \end{macrocode}
%
% Make sure that the version of \pkg{l3kernel} in use is sufficiently new.
%    \begin{macrocode}
\@ifpackagelater {expl3}{<MINIMUM DATE>}
  {}
  {%
    \PackageError {<NAME>} {Support package expl3 too old}
      {%
        You need to update your installation of the bundles 'l3kernel' and
        'l3packages'.\MessageBreak
        Loading~<NAME>~will~abort!%
      }%
    \endinput
  }%
%    \end{macrocode}
%
% Identify the package and give the over all version information.
%    \begin{macrocode}
\ProvidesExplPackage {<NAME>} {<DATE>} {<VERSION>}
  {<DESCRIPTION>}
%    \end{macrocode}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
% \end{implementation}
%
% \PrintIndex

Acima, presumi que temos um arquivo fonte (um pacote menor): uma divisão maior carregaria expl3apenas uma vez.

Novamente, para fontes maiores, eu dividiria a @@convenção em subpartes, de modo que cada uma .dtxfosse independente. Veja por exemplohttps://github.com/josephwright/siunitxPor exemplo.

informação relacionada