Debian Codegraph @

texmf-dist/source/generic/plainpkg/plainpkg-doc.tex

raw
1 \ProvidesFile{plainpkg-doc.tex}[2012/09/19 documenting plainpkg.tex]
2 \title{\pkg{\huge plainpkg}\\---\\%%%Rudimentary Package Management
3 % without \LaTeX\thanks{This document describes
4 a ``Minimal" Method\\for Making ``Generic" Packages\thanks{%
5 This document describes
6 \file{plainpkg.tex}'s %% 2012/08/24
7 version~\textcolor{blue}{\UseVersionOf{plainpkg.tex}}
8 as of~\textcolor{blue}{\UseDateOf{plainpkg.tex}}.}}
9 % \listfiles %% 2012/09/16
10 % \RequirePackage{inputtrc}\dotracinginputs
11 { \RequirePackage{makedoc} \ProcessLineMessage{}
12 \renewcommand*{\mdSectionLevelOne}{\string\subsection}
13 \renewcommand*{\mdJobName}{plainpkg}
14 \MakeJobDoc[tex]{21}%% 2012/08/25
15 {\SectionLevelTwoParseInput} }
16 \documentclass[fleqn]{article}%% TODO paper dimensions!?
17 \input{makedoc.cfg} %% shared formatting settings
18 % \ReadFileInfos{plainpkg} %% 2012/09/16 Fehler, wird wohl schon
19 %% durch fifinddo via stacklet aufgerufen.
20 \MDkeywords{Macro programming, package management}
21 \newcommand*{\plpkg}[1]{\pkg{plainpkg} #1ackage}
22 \newcommand*{\plpkgpkg}{\plpkg p}
23 \newcommand*{\Plpkgpkg}{\plpkg P}
24 \sloppy
25 \begin{document}
26 \maketitle
27 \begin{MDabstract}
28 'plainpkg.tex' provides some rudimentary \LaTeX-like package
29 management for ``generic" packages: \
30 (i)\enspace a (rather arbitrary) implementation of
31 \LaTeX's `\ProvidesFile' (support for \ctanpkgref{readprov}), \
32 (ii)\enspace an implementation of \LaTeX's `\ProvidesPackage'
33 that, in addition to (i), avoids loading twice, \
34 (iii)\enspace a simple implementation of \LaTeX's `\RequirePackage' %% P 2012/09/19
35 to allow nesting of package files with and without \LaTeX\ \ and \
36 %% <- 2012/08/25
37 (iv)\enspace loading 'stacklet.sty' for managing private letters
38 with nested package files. \ Also,
39 (v)\enspace a rather experimental `\ifltx' is provided indicating
40 whether the format is \LaTeX---or \CtanPkgRef{miniltx}{miniltx.tex}
41 has been loaded earlier~... \
42 A by-product is \ (vi)\enspace the helper `\withcsname' for
43 `csname' constructs. %% rm. \ 2012/09/19
44 %% 2012/09/19:
45 The documentation also introduces a notion of ``\plpkgpkg s"
46 for a central explanation of how to make and work with ``generic"
47 packages based on 'plainpkg'.
48
49 \MDaddtoabstract{Related Packages}
50 \ctanpkgref{miniltx}, \ctanpkgref{maybeload};
51 \ctanpkgref{catoptions},\\\null\qquad 'pcatcode' from \ctanpkgref{amsrefs},
52 \ctanpkgref{texapi}
53 %% 2012/09/19:
54 \MDaddtoabstract{Required Packages} 'stacklet.sty' from
55 \ctanpkgref{catcodes} bundle
56 \end{MDabstract}
57 % \newpage
58 \tableofcontents
59 \section{Purpose and Usage}
60 \label{sec:pu}
61 \subsection{Purpose}
62 'plainpkg.tex' in the first instance is a tool for \TeX\ macro packages
63 to work with \LaTeX\ as well as with Plain \TeX, perhaps even with other
64 \TeX\ formats.
65 When \LaTeX\ seems to be missing, a definition for `\ProvidesPackage'
66 is provided that avoids loading such a package a second time.
67 Earlier (in the \ctanpkgref{dowith} package), I tried to ``hide"
68 the `\ProvidesPackage' command when it was not defined,
69 the original motive was to have that command somewhere so
70 its version information can be accessed by the \ctanpkgref{readprov} package.
71 As such ``generic" packages often use private \LaTeX\ internals,
72 I thought that 'plainpkg' also should offer a stack for handling category
73 codes of `@' in nested package files. Rather than providing such a stack
74 in `plainpkg.tex', I use the more general 'stacklet.sty', because I
75 have used different ``private letters" in other nested package files
76 that \emph{require \LaTeX}, so such stacks should be accessible
77 \emph{without} 'plainpkg'.
78 %
79 % Details, including why a mere document author should consider it,
80 % are following.
81
82 \subsection{Installing: How and Why}
83 The file `plainpkg.tex' is provided ready, like `stacklet.sty'
84 (\ctanpkgref{catcodes} bundle), installation only requires
85 putting both somewhere where \TeX\ finds them
86 (which may need updating the filename data
87 base).\urlfoot{ukfaqref}{inst-wlcf}
88
89 \subsection{Features}
90 \label{sec:feat}
91 Besides providing 'stacklet''s features---see the 'catcodes' bundle
92 documentation in `catcodes.pdf'---and a fallback definition
93 |\ProvidesPackage| for running without \LaTeX, some |\withcsname|,
94 a conditional |\ifltx| as well as
95 fallback definitions for |\RequirePackage| and |\ProvidesFile|
96 are provided---see implementation sections for details.
97
98 \subsection{Loading `plainpkg.tex'}
99 \label{sec:load}
100 `plainpkg.tex' may be loaded by |\input plainpkg| or---with \LaTeX---by
101 |\input{plainpkg}|. However, in a document source file this is useful only
102 when so-called ``weak \plpkgpkg s" according to Section~\ref{sec:plpkg}
103 are loaded additionally. With \LaTeX, the only effect will be that
104 `\withcsname' works and that the 'stacklet' package is loaded.
105 So if you just want to have the 'stacklet' functionality of support for
106 private letters in nested package files, you better use
107 |\RequirePackage{stacklet}| or |\usepackage{stacklet}| directly.
108 The latter still is a little strange---it may be helpful for private
109 letters other than `@' in a \LaTeX\ document, or with ``weak 'stacklet'
110 packages," a notion that I have not introduced yet.
111
112 \subsection{Notion and Usage of ``\Plpkgpkg s"}
113 \label{sec:plpkg}
114 The main purpose of the present section is to have a central
115 reference for all ``generic" packages based on 'plainpkg',
116 to avoid repeating details in the documentation of each single
117 package of that kind.
118
119 \subsubsection{The Notion: ``Strong" and ``Weak \Plpkgpkg s"}
120 \label{sec:not}
121 I introduce the notion of ``\strong{\plpkgpkg s}" for ``generic" packages
122 based on 'plainpkg.tex' and requiring it.
123 \begin{description}
124 \item[Strong \plpkgpkg s] (i)~have filename extension |.sty|
125 \ and \ (ii)~contain |\input plainpkg|.
126 \item[Weak \plpkgpkg s] do not load `plainpkg.tex',
127 but their \emph{documentation} says that they must be loaded
128 \emph{after} `plainpkg.tex' has been loaded.
129 They have filename extension |.sty| as well.
130 \end{description}
131 \emph{My} \plpkgpkg s will also contain \ |\ProvidesPackage{<pkg>}[<ver>]| \
132 (\mbox{after} `\input plpkgpkg').
133 A package loading `plainpkg.tex' and \emph{not} containing `\ProvidesPackage'
134 may work and be called a ``\plpkgpkg", but the usefulness of such a
135 practice, hmm, is in some sense discussed in Section~\ref{sec:load}.
136
137 ``Weak" \plpkgpkg s are just an idea that came to my mind when I thought
138 about the present documentation, at present I prefer \emph{strong}
139 \plpkgpkg s, I do not want to explain usage of weak \plpkgpkg s.
140
141 I like to place the `\input plainpkg' ``right-adjusted" in the
142 plain text file hoping this way the file information of the next
143 \cs{Provides\dots} line is not overlooked.
144
145 \subsubsection{How to Load a \Plpkgpkg}
146 For loading a \plpkgpkg\ `<generic>.sty' from within some file <loading>,
147 we have the following cases:
148 \begin{description}
149 \item[from within the \LaTeX\ document preamble] of <loading>:\\
150 |\usepackage{<generic>}|\footnote{$\dots$ or even
151 &\RequirePackage{<generic>} \dots}
152 \item[not intended for \LaTeX:] |\input <generic>.sty|
153 \item[possibly with \LaTeX (``generic"):] |\Require{<generic>}|\\---and
154 `plainpkg.tex' should have been loaded before,\\
155 \strong{recommendation:} <loading> a \plpkgpkg\ `<lodyng>.sty' itself.
156 \end{description}
157 \strong{Note:}\quad The optional argument as in
158 |\RequirePackage{<generic>}[<date>]| is \strong{not supported} (at present)!
159
160 \subsubsection{How to Make a \Plpkgpkg}
161 % \subsubsection{What a \Plpkgpkg\ Must Contain}
162 % For what a \plpkgpkg\ \emph{must} contain,
163 % ---see Section~\ref{sec:not}.
164 Section~\ref{sec:not} tells what rather is \emph{required} for a
165 \plpkgpkg, and Section~\ref{sec:may} summarizes what additionally
166 \emph{works} in a \plpkgpkg, due to 'plainpkg''s \emph{features.}
167
168 \subsubsection{What a \Plpkgpkg\ May Contain}
169 \label{sec:may}
170 A \plpkgpkg\ may contain
171 \begin{itemize}
172 \item |\ProvidesPackage|, |\RequirePackage|
173 (without optional argument),
174 \item |\ifltx|, and |\withcsname|;
175 \item 'stacklet' commands properly paired:
176 for each ``private letter" <char>, place
177 \begin{itemize}
178 \item |\PushCatMakeLetter\<char>| above its first use
179 and place
180 \item |\PopLetterCat\<char>| after the last use, above `\endinput'.
181 \item If <char> is `@',
182 |\PushCatMakeLetterAt| and |\PopLetterCatAt| are recommended instead.
183 \end{itemize}
184 \end{itemize}
185
186 % \subsubsection{Implications}
187 % See Section~\ref{sec:feat} for what is available besides the
188 % specific features advertised for some \plpkgpkg.
189 %
190 \subsubsection{Other ``\pkg{plainpkg} Files"}
191 As 'plainpkg' also provides a fallback definition for
192 |\ProvidesFile|, another notion could be that of a
193 ``\pkg{plainpkg} file" <file> that \
194 (i)~has an arbitrary filename extension, \
195 (ii)~is loaded by |\input <file>| or, with \LaTeX, |\input{<file>}|
196 \ and \
197 (iii)~may contain what is allowed according to Section~\ref{sec:may},
198 apart from `\ProvidesPackage'.
199 As an obvious example, all the document source files such as `<part>.tex'
200 may start with `\ProvidesFile', or certain `.def' files could be
201 considered ``\pkg{plainpkg} files."
202
203 % \subsection{More PU\dots}
204 % \begin{enumerate} %% 2012/08/24
205 % \item
206 % `plainpkg.tex' should be loaded by
207 % % \[|\input plainpkg|\]
208 % \[\cs{input plainpkg}\]
209 % starting a file <generic> for Plain~\TeX\ or that should be
210 % independent of a \TeX\ format (basically based on `plain.tex').
211 % \item
212 % Below that line, such a file may contain
213 % \begin{enumerate}
214 % \item a \LaTeX\ |\ProvidesFile| or |\ProvidesPackage|
215 % command (purpose: accessible by '\ctanpkgref{readprov}.sty'),
216 % \item commands from the 'stacklet' package managing
217 % private letters with nested packages,
218 % \item |\RequirePackage<args>|,
219 % \item |\ifltx| indicating running under \LaTeX\ or with
220 % \CtanPkgRef{miniltx}{miniltx.tex}.
221 % However, something may fail when 'miniltx.tex'
222 % is loaded \emph{after} 'plainpkg.tex'.
223 % In this case, `\ifltx' at least indicates
224 % what \emph{format} is used.
225 % \end{enumerate}
226 % \item
227 % When <generic> is some `<generig>.sty' also intended to
228 % work as a \LaTeX\ package, 'plainpkg' will at least ensure
229 % that the 'stacklet' commands in <generic> work.
230 % \item
231 % (Such) <generic> `<generig>.sty' files should be loaded by
232 % \[|\RequirePackage{generig}|\]
233 % ---\emph{not} \qtd{\cs{input <generig>.sty}}---to ensure that,
234 % under \LaTeX, %% 2012/09/16
235 % \[`\ProvidesPackage{generig}'\]
236 % works properly and to avoid multiple loading. %% 2012/09/16
237 % \item
238 % \emph{Without} \LaTeX, |\ProvidesPackage| also stops reading
239 % the rest of the file when it has been loaded earlier.
240 % Thus it is a replacement for \ctanpkgref{maybeload}.
241 % \end{enumerate}
242
243 % \setcounter{section}{-1}
244 \section{Comparison with 'miniltx' and 'maybeload'}
245 % Packages based on 'plainpkg' can and should employ `\ProvidesPackage'
246 % and `\RequirePackage' even without \LaTeX. In the latter situation,
247 % however, their definitions
248 Without \LaTeX, the definitions of `\ProvidesPackage' and `\RequirePackage'
249 are by no means copies from \LaTeX, as they are in \ctanpkgref{miniltx}.
250 Rather, \cs{Provides}\-\code{Package} will work like \ctanpkgref{maybeload}'s
251 `\thisfileis'.---\pkg{maybeload} was made for ``\LaTeX," too,
252 according to its comment. But that rather was
253 pre\mbox{-}$2_{\varepsilon}$ \LaTeX. 'plainpkg' might also have been called
254 ``\pkg{maybeload2e}", as we are essentially combining 'maybeload''s functionality
255 with fall-back support for \LaTeXe's basic package commands.
256 But of course, that name would not reflect loading 'stacklet',
257 whose purpose also has been to have as little as possible
258 above `\ProvidesPackage'.
259
260 \section{The Package File}
261 \subsection{Header---Bootstrapping and Legalese}
262 The first line is for Section~\ref{sec:once}.
263 Next I want to have \cs{Provides\textellipsis} info at the top
264 of the file, but such a command hasn't been defined yet.
265 `\def\filename' etc. could be bad as well, overriding `\filedate'
266 of a package that loads 'plainpkg.tex'.
267 \input{plainpkg.doc}
268
269 \end{document}
270
271 VERSION HISTORY
272
273 2012/08/22 for v0.1 very first
274 2012/08/24 for v0.3 \thanks supplemented
275 2012/08/25 "installing" sec. -> `plainpkg.tex',
276 adjusted \HeaderLines, abstract extended,
277 TOC on \newpage, explaining top lines,
278 mentioning \ifltx
279 2012/08/26 LaTeX -> \LaTeX; doc. grammar fix
280 2012/09/19 different title, moving documentation here
281 from package file and reworking it,
282 changing doc structure, abstract mod.