LaTeX3을 사용하여 패키지에 대한 상용구 dtx 파일을 만드는 방법(LaTeX2e의 dtxgen과 유사)

LaTeX3을 사용하여 패키지에 대한 상용구 dtx 파일을 만드는 방법(LaTeX2e의 dtxgen과 유사)

LaTeX3을 사용하여 패키지를 만드는 데 관심이 있지만 (a) 새 dtx 파일을 생성하는 방법에 대한 문서를 찾거나 (b) LaTeX3을 사용하여 패키지에 대한 dtx 파일을 생성하기 위한 템플릿을 찾을 수 없습니다(아마도 )를 사용합니다 l3doc.

dtxgenLaTeX3 패키지용 유틸리티(예: LaTeX2e용)나 템플릿이 있습니까 ?


내가 추구하는 종류의 예입니다.

LaTeX 패키지(예: mynewpackage)를 만들 때 첫 번째 단계는 일반적으로 다음을 실행하는 것입니다.

$ dtxgen mynewpackage.sty

Makefile(다른 파일 중에서) 및를 생성합니다 mynewpackage.dtx. 기본적으로 이는 docstrip을 사용하고 ltxdoc문서용 클래스를 사용합니다 . 둘 다 훌륭하지만 LaTeX3에는 다음과 같은 몇 가지 변경 사항이 도입되었습니다.

현재 저는 LaTeX3를 완전히 지원하기 위해 변경해야 하는 모든 사항에 대한 완전한 참조 자료를 찾을 수 없습니다.

LaTeX3에 대한 모든 권장 변경 사항 및/또는 필요한 모든 변경 사항이 문서화된 장소가 포함된 초기 dtx 파일을 생성하는 스크립트가 있습니까?

답변1

다음과 같은 간단한 구조를 사용하는 것이 좋습니다.

더 큰 패키지의 경우

  • .tex사용자 문서에 대한 별도의
  • (여러 파일을 사용하는 경우 .dtx) .tex모든 코드 문서를 하나의 PDF로 결합하는 파일

해당 모델을 선택하면 .dtx다음과 같이 추천합니다.

% \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

위에서는 하나의 소스 파일(더 작은 패키지)이 있다고 가정했습니다. 더 큰 분할은 expl3한 번만 로드됩니다.

@@다시 말하지만, 더 큰 소스의 경우 규칙을 하위 부분으로 분할하여 각 부분이 .dtx독립적이 되도록 하겠습니다 . 예를 들어 참조https://github.com/josephwright/siunitx예를 들어.

관련 정보