.png)
Estoy interesado en crear un paquete usando LaTeX3, pero no puedo (a) encontrar documentación sobre cómo generar un nuevo archivo dtx o (b) encontrar una plantilla para crear un archivo dtx para un paquete usando LaTeX3 (probablemente usando l3doc
).
¿Existe una utilidad (como dtxgen
para LaTeX2e) o una plantilla para paquetes LaTeX3?
Un ejemplo del tipo de cosas que busco.
Al crear un paquete LaTeX (por ejemplo mynewpackage
), mi primer paso suele ser ejecutar
$ dtxgen mynewpackage.sty
Lo que crea un Makefile
y mynewpackage.dtx
(entre otros archivos). De forma predeterminada, esto usa docstrip y usa la clase ltxdoc
para la documentación. Ambos son buenos, pero LaTeX3 introduce algunos cambios que incluyen:
- El uso de
l3docstrip
para introducir nuevas características como@@
ser reemplazado por__<module name>
(obtenido deexpl3.pdf
desdehttps://www.ctan.org/pkg/l3kernel) - Utiliza
\ProvidesExplPackage
en lugar de\ProvidesPackage
(obtenido deEscribe un nuevo paquete con LaTeX2e o LaTeX3) - Usar
l3doc
class en lugar deltxdoc
(parece tener sentido, ya que admite la documentación clara de funciones de LaTeX3)
Actualmente, no he podido encontrar una referencia completa de todos los cambios que se deben realizar para habilitar la compatibilidad total con LaTeX3.
¿Existe un script para generar un archivo dtx inicial con todos los cambios recomendados para LaTeX3 y/o un lugar donde se documenten todos los cambios necesarios?
Respuesta1
Recomendaría usar una estructura simple en la que tengas:
- Uno o más
.dtx
archivos - un
.ins
archivo README.md
- Un
CHANGELOG.ms
archivo (verhttps://keepachangelog.com/en/1.0.0/) - (Posiblemente)
LICENSE
como una copia de la LPPL (parap.ejGitHub)
y para paquetes más grandes
- Una
.tex
documentación separada para el usuario. - (Si usa varios
.dtx
archivos) Un.tex
archivo para combinar toda la documentación del código en un solo PDF
Tomando ese modelo, el que .dtx
recomendaría es el siguiente.
% \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
En lo anterior, supuse que tenemos un archivo fuente (un paquete más pequeño): una división más grande se cargaría expl3
solo una vez.
Nuevamente, para fuentes más grandes, dividiría la @@
convención en subpartes, de modo que cada una .dtx
sea independiente. ver por ejemplohttps://github.com/josephwright/siunitxpara un ejemplo.