.png)
LaTeX3 を使用してパッケージを作成することに興味がありますが、(a) 新しい dtx ファイルを生成する方法に関するドキュメントが見つからないか、(b) LaTeX3 を使用してパッケージの dtx ファイルを作成するためのテンプレートが見つかりません (おそらく を使用l3doc
)。
dtxgen
LaTeX3 パッケージ用のユーティリティ (LaTeX2e 用など) またはテンプレートはありますか?
私が求めているものの例。
LaTeXパッケージ(例mynewpackage
)を作成する場合、私の最初のステップは通常、
$ dtxgen mynewpackage.sty
Makefile
これにより、および(他のファイルとともに)が作成されますmynewpackage.dtx
。デフォルトでは、docstrip が使用され、ドキュメントには クラスが使用されますltxdoc
。これらはどちらも優れていますが、LaTeX3 では次のようないくつかの変更が導入されています。
- から取得された(から取得)に置き換えられる
l3docstrip
などの新しい機能を導入するためにの使用@@
__<module name>
expl3.pdf
https://www.ctan.org/pkg/l3kernel) \ProvidesExplPackage
の代わりに使用します\ProvidesPackage
(LaTeX2e または LaTeX3 で新しいパッケージを作成する)l3doc
の代わりにクラスを使用するltxdoc
(LaTeX3関数を明確に文書化するためのサポートがあるため、理にかなっているようです)
現時点では、LaTeX3 の完全なサポートを有効にするために行う必要があるすべての変更の完全なリファレンスを見つけることができませんでした。
LaTeX3 に推奨されるすべての変更を含む初期 dtx ファイルを生成するスクリプトや、必要なすべての変更が文書化されている場所はありますか?
答え1
次のようなシンプルな構造を使用することをお勧めします。
- 1つ以上の
.dtx
ファイル - 1つの
.ins
ファイル README.md
- ファイル
CHANGELOG.ms
(https://keepachangelog.com/en/1.0.0/) - (おそらく)
LICENSE
LPPLのコピーとして(例えばGitHub)
大型パッケージの場合
.tex
ユーザードキュメント用の別冊- (複数のファイルを使用する場合
.dtx
).tex
すべてのコードドキュメントを1つの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
上記では、ソース ファイルが 1 つ (パッケージが小さい) であると想定しました。分割が大きい場合は、expl3
一度だけ読み込まれます。
@@
繰り返しになりますが、より大きなソースの場合は、それぞれが自己完結的になるように、規約をサブパートに分割します.dtx
。たとえば、https://github.com/josephwright/siunitx例えば。