Debian Codegraph @

texmf-dist/source/latex/oberdiek/stackrel.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: stackrel.dtx
4 % Version: 2016/05/16 v1.3
5 % Info: Adding subscript option to stackrel
6 %
7 % Copyright (C)
8 % 2006, 2007 Heiko Oberdiek
9 % 2016-2019 Oberdiek Package Support Group
10 % https://github.com/ho-tex/oberdiek/issues
11 %
12 % This work may be distributed and/or modified under the
13 % conditions of the LaTeX Project Public License, either
14 % version 1.3c of this license or (at your option) any later
15 % version. This version of this license is in
16 % https://www.latex-project.org/lppl/lppl-1-3c.txt
17 % and the latest version of this license is in
18 % https://www.latex-project.org/lppl.txt
19 % and version 1.3 or later is part of all distributions of
20 % LaTeX version 2005/12/01 or later.
21 %
22 % This work has the LPPL maintenance status "maintained".
23 %
24 % The Current Maintainers of this work are
25 % Heiko Oberdiek and the Oberdiek Package Support Group
26 % https://github.com/ho-tex/oberdiek/issues
27 %
28 % This work consists of the main source file stackrel.dtx
29 % and the derived files
30 % stackrel.sty, stackrel.pdf, stackrel.ins, stackrel.drv.
31 %
32 % Distribution:
33 % CTAN:macros/latex/contrib/oberdiek/stackrel.dtx
34 % CTAN:macros/latex/contrib/oberdiek/stackrel.pdf
35 %
36 % Unpacking:
37 % (a) If stackrel.ins is present:
38 % tex stackrel.ins
39 % (b) Without stackrel.ins:
40 % tex stackrel.dtx
41 % (c) If you insist on using LaTeX
42 % latex \let\install=y\input{stackrel.dtx}
43 % (quote the arguments according to the demands of your shell)
44 %
45 % Documentation:
46 % (a) If stackrel.drv is present:
47 % latex stackrel.drv
48 % (b) Without stackrel.drv:
49 % latex stackrel.dtx; ...
50 % The class ltxdoc loads the configuration file ltxdoc.cfg
51 % if available. Here you can specify further options, e.g.
52 % use A4 as paper format:
53 % \PassOptionsToClass{a4paper}{article}
54 %
55 % Program calls to get the documentation (example):
56 % pdflatex stackrel.dtx
57 % makeindex -s gind.ist stackrel.idx
58 % pdflatex stackrel.dtx
59 % makeindex -s gind.ist stackrel.idx
60 % pdflatex stackrel.dtx
61 %
62 % Installation:
63 % TDS:tex/latex/oberdiek/stackrel.sty
64 % TDS:doc/latex/oberdiek/stackrel.pdf
65 % TDS:source/latex/oberdiek/stackrel.dtx
66 %
67 %<*ignore>
68 \begingroup
69 \catcode123=1 %
70 \catcode125=2 %
71 \def\x{LaTeX2e}%
72 \expandafter\endgroup
73 \ifcase 0\ifx\install y1\fi\expandafter
74 \ifx\csname processbatchFile\endcsname\relax\else1\fi
75 \ifx\fmtname\x\else 1\fi\relax
76 \else\csname fi\endcsname
77 %</ignore>
78 %<*install>
79 \input docstrip.tex
80 \Msg{************************************************************************}
81 \Msg{* Installation}
82 \Msg{* Package: stackrel 2016/05/16 v1.3 Adding subscript option to stackrel (HO)}
83 \Msg{************************************************************************}
84
85 \keepsilent
86 \askforoverwritefalse
87
88 \let\MetaPrefix\relax
89 \preamble
90
91 This is a generated file.
92
93 Project: stackrel
94 Version: 2016/05/16 v1.3
95
96 Copyright (C)
97 2006, 2007 Heiko Oberdiek
98 2016-2019 Oberdiek Package Support Group
99
100 This work may be distributed and/or modified under the
101 conditions of the LaTeX Project Public License, either
102 version 1.3c of this license or (at your option) any later
103 version. This version of this license is in
104 https://www.latex-project.org/lppl/lppl-1-3c.txt
105 and the latest version of this license is in
106 https://www.latex-project.org/lppl.txt
107 and version 1.3 or later is part of all distributions of
108 LaTeX version 2005/12/01 or later.
109
110 This work has the LPPL maintenance status "maintained".
111
112 The Current Maintainers of this work are
113 Heiko Oberdiek and the Oberdiek Package Support Group
114 https://github.com/ho-tex/oberdiek/issues
115
116
117 This work consists of the main source file stackrel.dtx
118 and the derived files
119 stackrel.sty, stackrel.pdf, stackrel.ins, stackrel.drv.
120
121 \endpreamble
122 \let\MetaPrefix\DoubleperCent
123
124 \generate{%
125 \file{stackrel.ins}{\from{stackrel.dtx}{install}}%
126 \file{stackrel.drv}{\from{stackrel.dtx}{driver}}%
127 \usedir{tex/latex/oberdiek}%
128 \file{stackrel.sty}{\from{stackrel.dtx}{package}}%
129 }
130
131 \catcode32=13\relax% active space
132 \let =\space%
133 \Msg{************************************************************************}
134 \Msg{*}
135 \Msg{* To finish the installation you have to move the following}
136 \Msg{* file into a directory searched by TeX:}
137 \Msg{*}
138 \Msg{* stackrel.sty}
139 \Msg{*}
140 \Msg{* To produce the documentation run the file `stackrel.drv'}
141 \Msg{* through LaTeX.}
142 \Msg{*}
143 \Msg{* Happy TeXing!}
144 \Msg{*}
145 \Msg{************************************************************************}
146
147 \endbatchfile
148 %</install>
149 %<*ignore>
150 \fi
151 %</ignore>
152 %<*driver>
153 \NeedsTeXFormat{LaTeX2e}
154 \ProvidesFile{stackrel.drv}%
155 [2016/05/16 v1.3 Adding subscript option to stackrel (HO)]%
156 \documentclass{ltxdoc}
157 \usepackage{amsmath}
158 \usepackage{holtxdoc}[2011/11/22]
159 \usepackage{stackrel}[2016/05/16]
160 \begin{document}
161 \DocInput{stackrel.dtx}%
162 \end{document}
163 %</driver>
164 % \fi
165 %
166 %
167 %
168 % \GetFileInfo{stackrel.drv}
169 %
170 % \title{The \xpackage{stackrel} package}
171 % \date{2016/05/16 v1.3}
172 % \author{Heiko Oberdiek\thanks
173 % {Please report any issues at \url{https://github.com/ho-tex/oberdiek/issues}}}
174 %
175 % \maketitle
176 %
177 % \begin{abstract}
178 % This package adds an optional argument to \cs{stackrel} for
179 % putting something below the relational symbol and defines
180 % \cs{stackbin} for binary symbols.
181 % \end{abstract}
182 %
183 % \tableofcontents
184 %
185 % \section{User interface}
186 %
187 % \LaTeX's \cs{stackrel} allows a superscript above a relational symbol,
188 % but pure \LaTeX\ does not provide a macro for putting a subscript
189 % below the symbol. This is supported by \AmS\LaTeX's \cs{underset}
190 % macro that works on both relational and binary symbols. A combination
191 % of \cs{underset} and \cs{overset} can be used to put \mbox{sub-} and
192 % superscripts to the same symbol.
193 %
194 % This package \xpackage{stackrel} extends the syntax of \cs{stackrel}
195 % by adding an optional argument for the subscript position.
196 % It follows the syntax of extensible arrows of packages
197 % \xpackage{amsmath} and \xpackage{mathtools}.
198 %
199 % \begin{declcs}{stackrel}
200 % |[|\meta{subscript}|]| \M{superscript} \M{rel}\\
201 % \cs{stackbin}
202 % |[|\meta{subscript}|]| \M{superscript} \M{bin}
203 % \end{declcs}
204 % Example:
205 % \begin{quote}
206 % |A \stackbin[\text{and}]{}{+} B \stackrel[x]{!}{=} C|\\
207 % $A \stackbin[\text{and}]{}{+} B \stackrel[x]{!}{=} C$
208 % \end{quote}
209 %
210 % \StopEventually{
211 % }
212 %
213 % \section{Implementation}
214 %
215 % \begin{macrocode}
216 %<*package>
217 \NeedsTeXFormat{LaTeX2e}
218 \ProvidesPackage{stackrel}
219 [2016/05/16 v1.3 Adding subscript option to stackrel (HO)]%
220 % \end{macrocode}
221 %
222 % Given the original definition of \cs{stackrel} the addition
223 % of the optional argument is straightforward. If an argument
224 % is empty, then the corresponding sub- or superscript is
225 % suppressed.
226 %
227 % Depending on the available resources (\eTeX, \pdfTeX)
228 % three methods are given for testing emptyness. All tests
229 % allow the hash to be used inside the arguments without
230 % doubling (for the unlikely case that someone wants to
231 % define macros with arguments).
232 % \begin{macro}{\stack@relbin}
233 % \begin{macrocode}
234 \RequirePackage{etexcmds}[2007/09/09]
235 \ifetex@unexpanded
236 \RequirePackage{pdftexcmds}[2016/05/16]%
237 \begingroup\expandafter\expandafter\expandafter\endgroup
238 \expandafter\ifx\csname pdf@strcmp\endcsname\relax
239 \newcommand*{\stack@relbin}[3][]{%
240 \mathop{#3}\limits
241 \edef\reserved@a{\etex@unexpanded{#1}}%
242 \ifx\reserved@a\@empty\else_{#1}\fi
243 \edef\reserved@a{\etex@unexpanded{#2}}%
244 \ifx\reserved@a\@empty\else^{#2}\fi
245 \egroup
246 }%
247 \else
248 \newcommand*{\stack@relbin}[3][]{%
249 \mathop{#3}\limits
250 \ifcase\pdf@strcmp{\detokenize{#1}}{}\else_{#1}\fi
251 \ifcase\pdf@strcmp{\detokenize{#2}}{}\else^{#2}\fi
252 \egroup
253 }%
254 \fi
255 \else
256 \newcommand*{\stack@relbin}[3][]{%
257 \mathop{#3}\limits
258 \toks@{#1}%
259 \edef\reserved@a{\the\toks@}%
260 \ifx\reserved@a\@empty\else_{#1}\fi
261 \toks@{#2}%
262 \edef\reserved@a{\the\toks@}%
263 \ifx\reserved@a\@empty\else^{#2}\fi
264 \egroup
265 }%
266 \fi
267 % \end{macrocode}
268 % \end{macro}
269 % \begin{macro}{\stackrel}
270 % \begin{macrocode}
271 \renewcommand*{\stackrel}{%
272 \mathrel\bgroup\stack@relbin
273 }
274 % \end{macrocode}
275 % \end{macro}
276 % \begin{macro}{\stackbin}
277 % \begin{macrocode}
278 \newcommand*{\stackbin}{%
279 \mathbin\bgroup\stack@relbin
280 }
281 % \end{macrocode}
282 % \end{macro}
283 %
284 % \begin{macrocode}
285 %</package>
286 % \end{macrocode}
287 %
288 % \section{Installation}
289 %
290 % \subsection{Download}
291 %
292 % \paragraph{Package.} This package is available on
293 % CTAN\footnote{\CTANpkg{stackrel}}:
294 % \begin{description}
295 % \item[\CTAN{macros/latex/contrib/oberdiek/stackrel.dtx}] The source file.
296 % \item[\CTAN{macros/latex/contrib/oberdiek/stackrel.pdf}] Documentation.
297 % \end{description}
298 %
299 %
300 % \paragraph{Bundle.} All the packages of the bundle `oberdiek'
301 % are also available in a TDS compliant ZIP archive. There
302 % the packages are already unpacked and the documentation files
303 % are generated. The files and directories obey the TDS standard.
304 % \begin{description}
305 % \item[\CTANinstall{install/macros/latex/contrib/oberdiek.tds.zip}]
306 % \end{description}
307 % \emph{TDS} refers to the standard ``A Directory Structure
308 % for \TeX\ Files'' (\CTANpkg{tds}). Directories
309 % with \xfile{texmf} in their name are usually organized this way.
310 %
311 % \subsection{Bundle installation}
312 %
313 % \paragraph{Unpacking.} Unpack the \xfile{oberdiek.tds.zip} in the
314 % TDS tree (also known as \xfile{texmf} tree) of your choice.
315 % Example (linux):
316 % \begin{quote}
317 % |unzip oberdiek.tds.zip -d ~/texmf|
318 % \end{quote}
319 %
320 % \subsection{Package installation}
321 %
322 % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
323 % \docstrip\ archive. The files are extracted by running the
324 % \xfile{.dtx} through \plainTeX:
325 % \begin{quote}
326 % \verb|tex stackrel.dtx|
327 % \end{quote}
328 %
329 % \paragraph{TDS.} Now the different files must be moved into
330 % the different directories in your installation TDS tree
331 % (also known as \xfile{texmf} tree):
332 % \begin{quote}
333 % \def\t{^^A
334 % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
335 % stackrel.sty & tex/latex/oberdiek/stackrel.sty\\
336 % stackrel.pdf & doc/latex/oberdiek/stackrel.pdf\\
337 % stackrel.dtx & source/latex/oberdiek/stackrel.dtx\\
338 % \end{tabular}^^A
339 % }^^A
340 % \sbox0{\t}^^A
341 % \ifdim\wd0>\linewidth
342 % \begingroup
343 % \advance\linewidth by\leftmargin
344 % \advance\linewidth by\rightmargin
345 % \edef\x{\endgroup
346 % \def\noexpand\lw{\the\linewidth}^^A
347 % }\x
348 % \def\lwbox{^^A
349 % \leavevmode
350 % \hbox to \linewidth{^^A
351 % \kern-\leftmargin\relax
352 % \hss
353 % \usebox0
354 % \hss
355 % \kern-\rightmargin\relax
356 % }^^A
357 % }^^A
358 % \ifdim\wd0>\lw
359 % \sbox0{\small\t}^^A
360 % \ifdim\wd0>\linewidth
361 % \ifdim\wd0>\lw
362 % \sbox0{\footnotesize\t}^^A
363 % \ifdim\wd0>\linewidth
364 % \ifdim\wd0>\lw
365 % \sbox0{\scriptsize\t}^^A
366 % \ifdim\wd0>\linewidth
367 % \ifdim\wd0>\lw
368 % \sbox0{\tiny\t}^^A
369 % \ifdim\wd0>\linewidth
370 % \lwbox
371 % \else
372 % \usebox0
373 % \fi
374 % \else
375 % \lwbox
376 % \fi
377 % \else
378 % \usebox0
379 % \fi
380 % \else
381 % \lwbox
382 % \fi
383 % \else
384 % \usebox0
385 % \fi
386 % \else
387 % \lwbox
388 % \fi
389 % \else
390 % \usebox0
391 % \fi
392 % \else
393 % \lwbox
394 % \fi
395 % \else
396 % \usebox0
397 % \fi
398 % \end{quote}
399 % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
400 % TDS installing feature, then some files can already be in the right
401 % place, see the documentation of \docstrip.
402 %
403 % \subsection{Refresh file name databases}
404 %
405 % If your \TeX~distribution
406 % (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh
407 % these. For example, \TeX\,Live\ users run \verb|texhash| or
408 % \verb|mktexlsr|.
409 %
410 % \subsection{Some details for the interested}
411 %
412 % \paragraph{Unpacking with \LaTeX.}
413 % The \xfile{.dtx} chooses its action depending on the format:
414 % \begin{description}
415 % \item[\plainTeX:] Run \docstrip\ and extract the files.
416 % \item[\LaTeX:] Generate the documentation.
417 % \end{description}
418 % If you insist on using \LaTeX\ for \docstrip\ (really,
419 % \docstrip\ does not need \LaTeX), then inform the autodetect routine
420 % about your intention:
421 % \begin{quote}
422 % \verb|latex \let\install=y\input{stackrel.dtx}|
423 % \end{quote}
424 % Do not forget to quote the argument according to the demands
425 % of your shell.
426 %
427 % \paragraph{Generating the documentation.}
428 % You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
429 % the documentation. The process can be configured by the
430 % configuration file \xfile{ltxdoc.cfg}. For instance, put this
431 % line into this file, if you want to have A4 as paper format:
432 % \begin{quote}
433 % \verb|\PassOptionsToClass{a4paper}{article}|
434 % \end{quote}
435 % An example follows how to generate the
436 % documentation with pdf\LaTeX:
437 % \begin{quote}
438 %\begin{verbatim}
439 %pdflatex stackrel.dtx
440 %makeindex -s gind.ist stackrel.idx
441 %pdflatex stackrel.dtx
442 %makeindex -s gind.ist stackrel.idx
443 %pdflatex stackrel.dtx
444 %\end{verbatim}
445 % \end{quote}
446 %
447 % \begin{History}
448 % \begin{Version}{2006/12/02 v1.0}
449 % \item
450 % First version.
451 % \end{Version}
452 % \begin{Version}{2007/05/06 v1.1}
453 % \item
454 % Uses package \xpackage{etexcmds}.
455 % \end{Version}
456 % \begin{Version}{2007/11/11 v1.2}
457 % \item
458 % Use of package \xpackage{pdftexcmds} for \LuaTeX\ support.
459 % \end{Version}
460 % \begin{Version}{2016/05/16 v1.3}
461 % \item
462 % Documentation updates.
463 % \end{Version}
464 % \end{History}
465 %
466 % \clearpage
467 % \PrintIndex
468 %
469 % \Finale
470 \endinput