From 57b6bdd7ce9155595f073c8e3c1a689a14f89e6a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 25 Dec 2007 19:55:32 +0000 Subject: gmdoc update (19nov07) git-svn-id: svn://tug.org/texlive/trunk@5905 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty | 2635 +++++++++++++++-------- Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls | 310 ++- Master/texmf-dist/tex/latex/gmdoc/gmoldcomm.sty | 92 + 3 files changed, 2045 insertions(+), 992 deletions(-) create mode 100644 Master/texmf-dist/tex/latex/gmdoc/gmoldcomm.sty (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty b/Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty index 494b00382bc..00351067f45 100644 --- a/Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty +++ b/Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty @@ -16,7 +16,7 @@ %% Written by Natror (Grzegorz Murzynowski), %% natror at o2 dot pl %% -%% \copyright\,2006 by Natror (Grzegorz Murzynowski). +%% \copyright\,2006, 2007 by Natror (Grzegorz Murzynowski). %% %% This program is subject to the \LaTeX\ Project Public License. %% See \url{http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html} ^^A @@ -24,7 +24,7 @@ %% %% LPPL status: "author-maintained".\par %% -%% Many thanks to my \TeX\ Guru Marcin Woli\'nski for his \TeX nical ^^A +%% Many thanks to my \TeX\ Guru Marcin Woli\nacute ski for his \TeX nical ^^A %% support. % %\end{copyrnote} @@ -53,13 +53,15 @@ % \chschange{v0.99c}{07/3/30}{4475} % \chschange{v0.99d}{07/4/26}{4555} % \chschange{v0.99e}{2007/4/29}{4574} +% \chschange{v0.99g}{2007/11/12}{5229} +% % %^^A \docstrip % \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{gmdoc} - [2007/04/29 v0.99e a documenting package (GM)] + [2007/11/12 v0.99h a documenting package (GM)] % % @@ -94,18 +96,22 @@ % hyperlinking of index entries, contents entries and % cross-references. % -% \begin{gmlonely} -% \subdivision{Installation} -% -% Just put the \pk{gmdoc.sty} and \pk{gmdocc.cls} somewhere in the -% \file{texmf/\:tex/\:latex} branch. Creating -% a~\file{texmf/\:tex/\:latex/\:gm} directory may be advisable if -% you consider using other packages written by me. +% The package also works with \XeTeX\ (switches automatically). % -% You should also install \pk{gmverb.sty}, \pk{gmutils.sty} -% and \pk{gmiflink.sty} (e.g., put them into the same \file{gm} +% \begin{gmlonely} +% \subdivision{Installation} Unpack the \file{gmdoc-tds.zip} archive +% (this is an archive conforming the \acro{TDS} standard, see +% \file{CTAN/tds/tds.pdf})% in a~\file{texmf} directory +% or put the \pk{gmdoc.sty}, \pk{gmdocc.cls} and \pk{gmoldcomm.sty} +% somewhere in the \file{texmf/\:tex/\:latex} branch on your own. +% (Creating a~\file{texmf/\:tex/\:latex/\:gm} directory may be +% advisable if you consider using other packages written by me.) +% +% You should also install \pk{gmverb.sty}, \pk{gmutils.sty} and +% \pk{gmiflink.sty} (e.g., put them into the same \file{gm} % directory). These packages are available on CTAN as separate -% \file{.zip} archives. +% \file{.zip} archives also in \acro{TDS}-compliant \pk{zip} +% archives. % % Moreover, you should put the \file{gmglo.ist} file, a MakeIndex % style for the changes' history, into some \file{texmf/\:makeindex} @@ -119,14 +125,15 @@ % \subdivision{Contents of the \pk{gmdoc.zip} Archive} % % The distribution of the \pk{gmdoc} package consists of the -% following six files. +% following six files and a~\acro{TDS}-compliant archive. % \begin{verse} % \pk{gmdoc.sty}\\ % \pk{gmdocc.cls}\\ % \pk{gmglo.ist}\\ % \pk{README}\\ % \pk{gmdocDoc.tex}\\ -% \pk{gmdocDoc.pdf} +% \pk{gmdocDoc.pdf}\\ +% \pk{gmdoc.tds.zip} % \end{verse} % % @@ -135,10 +142,10 @@ % % The last of the above files (the \pk{.pdf}, i.e., \emph{this % file}) is a~documentation compiled from the \pk{.sty} and -% \pk{.cls} files by running \LaTeX\ on the \file{gmdocDoc.tex} +% \pk{.cls} files by running \XeLaTeX\ on the \file{gmdocDoc.tex} % twice, then MakeIndex on the \file{gmdocDoc.idx} and -% \file{gmdocDoc.glo} files, and then \LaTeX\ on \file{gmdocDoc.tex} -% once more. +% \file{gmdocDoc.glo} files, and then \XeLaTeX\ on \file{gmdocDoc.tex} +% once more. (Using \LaTeX\ instead of \XeLaTeX\ should do, too.) % % MakeIndex shell commands: %\begin{verbatim} @@ -188,20 +195,21 @@ % % As a~bonus and example of \docfm-compatibility % there are driver files included -% (cf.\ Palestrina, \textit{Missa papae Marceli} ;-): +% (cf.\ Palestrina, \textit{Missa papae Marcelli} ;-): % % \begin{verse} % \pk{source2e_gmdoc.tex}\\ % \pk{docstrip_gmdoc.tex}\\ % \pk{doc_gmdoc.tex} % -% \pk{oldcomm.sty}\\ +% \pk{gmoldcomm.sty}\\ % (\pk{gmsource2e.ist} is generated from \pk{source2e_gmdoc.tex})\\ % \end{verse} % % These drivers typeset the respective files from the -%\[\hbox{\file{ .../texmf-dist/source/latex/base}}\] -% directory of the \TeX Live2005 distribution. +%\[\hbox{\file{.../texmf-dist/source/latex/base}}\] +% directory of the \TeX Live2005 distribution (they only read that +% directory). % % Probably you should redefine the |\BasePath| macro in them % so that it points that directory on your computer. @@ -277,7 +285,7 @@ % is a~character the |\catcode| of which is 14 usually i.e., when the % file works; if you don't play with % the |\catcode|s, it's just the |%|. When the file is documented with -% \gmdoc, such a~char is re|\catcode|d and its r\^ole is else: it +% \gmdoc, such a~char is re|\catcode|d and its r\ocircum le is else: it % becomes the \textbf{code delimiter}. % % A~line containing any \TeX\ code (not commented out) will be called @@ -320,10 +328,13 @@ % is in \gmdoc\ active and defined to gobble the stuff between itself % and the next line end. % -% Note, however, that both |^^A| and |^^B| are usually macros in -% \gmdoc\ and the text being gobbled is their argument so it has to be -% balanced of braces and, if it occures inside an |\if...|, it has to -% have all |\if...|s coupled with |\else|s and |\fi|s. +% Note that |^^A| behaves much like comment char +% although it's active in fact: it re|\catcode|s the special +% characters including |\|, |{| and |}| +% so you don't have to worry about unbalanced braces or \cs{if}s in +% its scope. But |^^B| doesn't re|\catcode| anything (it would be +% useless in an argument) so any text between |^^B| and line end has +% to be balanced. % % However, it may be a~bit confusing % for someone acquainted with the \docfm\ conventions. If you don't @@ -402,9 +413,11 @@ % % When using |\OldDocInput|, you have to wrap all the code in % \TextUsage*{macrocode} environments, which is not necessary when you -% use |\DocInput|. Moreover, with |\OldDocInput| the -% \env{macrocode(*)} environments require to be ended with -% |% \end{macrocode(*)}|. +% use |\DocInput|. Moreover, with |\OldDocInput| the\ +% \env{mac\-ro\-co\-de(*)} environments require to be ended with +% |% \end{macrocode(*)}| as in \docfm. (With |\DocInput| you are +% not obliged to precede |\end{macrocode(*)}| with The +% Four Spaces.) % % \stanza % If you wish to document many files in one document, you are @@ -512,7 +525,7 @@ % % \stanza % If you need to add something at the beginning of the input of file, -% there's the \TextUsage\AtBegInput\ declaration that takes one and +% there's the \TextUsage\AtBegInput\ declaration that takes one % mandatory argument which is the stuff to be added. This declaration % is global. It may be used more than one time and the arguments of % each occurrence of it add up and are put at the beginning of input @@ -555,7 +568,7 @@ % to reset the counter of lines \himher self, e.g., when \heshe\ % documents many source files in one document. Then \heshe\ may wish % the line numbers to be reset with every |{section}|'s turn for -% instance. This is the r\^ole of the \TextUsage*{uresetlinecount} +% instance. This is the r\ocircum le of the \TextUsage*{uresetlinecount} % option, which seems to be a~bit obsolete however, since the % \TextCommonIndex\DocInclude|\DocInclude| command takes care of % a~proper reset. @@ -601,7 +614,7 @@ % classes it's allright but not all the classes support marginpars. % That is the reason why this package enables marginparing when in % standard classes, enables or disables it due to the respective option -% when with Marcin Woli\'nski's classes and in any case provides the +% when with Marcin Woli\nacute ski's classes and in any case provides the % options \TextUsage*{withmarginpar} and \TextUsage*{nomarginpar}. So, in % non-standard classes the default behaviour is to disable marginpars. % If the marginpars are enabled in \pk{gmdoc}, it will put marked @@ -637,7 +650,7 @@ % |\mylittlemacro|. % % As the standard \LaTeX\ one, my |\verb| issues an error when a~line -% end occures in its scope. But, if you'd like to allow line ends in +% end occurs in its scope. But, if you'd like to allow line ends in % short verbatims, there's the \TextUsage\verbeolOK\ declaration. The % plain |\verb| typesets spaces blank and |\verb*| makes them visible, % as in the standard version(s). @@ -698,9 +711,163 @@ % define the default colour of the hyperlinks, seems to be standard % already, and \pk{makeidx}. % -% -% \subdivision[Macros for Marking the Macros]{^^B -% \gmhypertarget{Macros for Marking the Macros}} +% \subdivision[Automatic marking of definitions]{^^B +% \gmhypertarget{Automatic marking of definitions}} +% \gmdoc\ implements automatic detection of a~couple of +% definitions. By default it detects all occurrences of the following +% commands in the code: +%\begin{enumerate}^^B +%\item \label{def type} +% |\def|, +% |\newcount|, +% |\newdimen|, +% |\newskip|, +% |\newif|, +% |\newtoks|, +% |\newbox|, +% |\newread|,\\ +% |\newwrite|, +% |\newlength|, +% |\newcommand(*)|, +% |\renewcommand(*)|, +% |\providecommand(*)|, +% |\DeclareRobustCommand(*)|, +% |\DeclareTextCommand(*)|,\\ +% |\DeclareTextCommandDefault(*)|, +% +% \item +% |\newenvironment(*)|, +% |\renewenvironment(*)|, +% |\DeclareOption(*)|, +%^^A~ |%\DeclareDefining*\@namedef| +% +% \item \label{newctr} +% |\newcounter|, +% +% \xdef\gmdenumi{\arabic{enumi}} +% \end{enumerate} +% +% of the \pk{xkeyval} package: +% \begin{enumerate}\setcounter{enumi}{\gmdenumi}^^B +% \item\label{dk type} |\define@key|, +% |\define@boolkey|, +% |\define@choicekey|, +% |\DeclareOptionX|, +% +% \xdef\gmdenumi{\arabic{enumi}} +% \end{enumerate} +% +% and of the \pk{kvoptions} package: +% \begin{enumerate}\setcounter{enumi}{\gmdenumi}^^B +% \item \label{DSOption} +% |\DeclareStringOption|, +% |\DeclareBoolOption|, +% |\DeclareComplementaryOption|,\\ +% |\DeclareVoidOption|. +% \end{enumerate}\par +% +% What does `detects' mean? It means that the main argument of +% detected command will be marked as defined at this point, +% i.e.\ thrown to a~margin note and indexed with a~`definition' entry. +% Moreover, for the definitions \ref*{newctr}--\ref*{DSOption} an +% alternate index entries will be created: of the CSs uderlying those +% definitions, e.g. |\newcounter{foo}| in the +% code will result in indexing |foo| and |\c@foo|. +% +% If you want to add detection of a~defining command not listed above, +% use the \TextUsage\DeclareDefining\ declaration. It comes in two +% flavours: `saut\eacute' and with star. The `saut\eacute' version +% (without star and without an optional argument) declares a~defining +% command of the kind of |\def| and |\newcommand|: its main argument, +% whether wrapped in braces or not, is a~CS. The starred version (without +% the optional argument) declares a~defining command of the kind of +% |\newenvironment| and |\DeclareOption|: whose main mandatory +% argument is text. Both versions provide an optional argument in +% which you can set the keys. +% +% Probably the most important key is \TextUsage*{type}. Its default +% value is |cs| and that is set in the `saut\eacute' version. Another +% possible value is |text| and that is set in the starred version. You +% can also set three other types (any keyval setting of the type +% overrides the default and `starred' setting): |dk|, |dox| or |kvo|. +% +% |dk| stands for |\define@key| and is the type of \pk{xkeyval} +% definitions of keys (group \ref{dk type} commands). When detected, +% it scans furher code for an optional \arg[KVprefix], mandatory +% \arg{KVfamily} and mandatory \arg{key name}. The default \ +% is |KV|, as in \pk{xkeyval}. +% +% |dox| stands for |\DeclareOptionX| and launches scanning for an +% optional \arg[KVprefix], optional |<|\|>| and mandatory +% \arg{option name}. Here the default \ +% is also |KV| and the default \ is the input file name. If +% you want to set another default family (e.g. if the code of +% \file{foo.sty} actually is in file \file{bar.dtx}), use +% \TextUsage\DeclareDOXHead\arg{KVfamily}. This declaration has an +% optional first argument that is the default \ for +% |\DeclareOptionX| definitions. +% +% |kvo| stands for the \pk{kvoptions} package by Heiko Oberdiek. This +% package provides a~handful of option defining commands (the group +% \ref{DSOption} commands). Detection of such a~command launches +% a~scan for mandatory \arg{option name} and alternate indexing of +% a~CS |\|\|@|\. The default \ is +% the input file name. Again, if you want to set something else, you +% are given the \TextUsage\DeclareKVOFam\arg{KVOfamily} that sets the +% default family (and prefix: \|@|) for all the commands of +% group \ref{DSOption}. +% +% Next key recognized by |\DeclareDefining| is \TextUsage*{star}. It +% determines whether the starred version of a~defining command should +% be taken into account. For example, |\newcommand| should be +% declared with |[star=true]| while |\def| with +% |[star=false]|. You can also write just |[star]| instead of +% |[star=true]|. It's the default if the |star| key is omitted. +% +% There are also \TextUsage*{KVpref} and \TextUsage*{KVfam} keys if +% you want to redeclare the \pk{xkeyval} definitions with another +% default prefix and family. +% +% For example, if you wish |\@namedef| to be detected (the original +% \LaTeX\ version), declare +% \[|\DeclareDefining*[star=false]\@namedef|\] or +% \[|\DeclareDefining[type=text,star=false]\@namedef|\] (as stated +% above, |*| is equivalent |[type=text]|). +% +% On the other hand, if you want some of the commands listed above +% \emph{not} to be detected, write \TextUsage\HideDefining\ +% in the commentary. Later +% you can resume detection of it with +% \TextUsage\ResumeDefining\. +% +% If you wish to turn entire detection mechanism off, write +% \TextUsage\HideAllDefining\ in the narration layer. Then you can +% resume detection with \TextUsage\ResumeAllDefining. +% +% The basic definition command, |\def|, seems to me a~bit +% controversial. Definitely \emph{not always} it defines important +% macros. But first of all, if you |\def| a~CS excluded from indexing (see +% section \gmiflink{Index Ex/Inclusions}), it will not be marked even +% if detection of |\def| is on. But if the |\def|'s argument is not +% excluded from indexing and you still don't want it to be marked at +% this point, in the commentary before this |\def| write +% \TextUsage\UnDef. That will turn off the detection just for this one +% occurrence of |\def|. +% +% If you don't like |\def| to be detected more times, you may write +% |\HideDefining\def| of course, but there's a~shorthand for this: +% \TextUsage\HideDef. To resume detection of |\def| you are provided +% also a~shorthand, \TextUsage\ResumeDef\ (but |\ResumeDefining\def| +% also works). +% +% If you define things not with easily detectable commands, you can +% mark them `manually', with the |\Define| declaration described in +% the next section. +% +% +% +% \subdivision[Manual Marking the Macros and Environments]{^^B +% \gmhypertarget{Manual Marking the Macros and Environments}} % % The concept (taken from \docfm ) is to index virtually all the % control sequences occurring in the code. \gmdoc\ does that by @@ -710,7 +877,8 @@ % The next concept (also taken from \docfm) is to ditinguish some % occurrences of some control sequences by putting such a~sequence % into a~marginpar and by special formatting of its index entry. That -% is what I~call marking the macros. \gmdoc\ provides also +% is what I~call marking the macros. +% \gmdoc\ provides also % a~possibility of analogous marking for the environments' names and % other sequences such as |^^A|. % @@ -726,7 +894,7 @@ % or in the commentary. But all the definitions appear in the code, % I~suppose. Therefore the `def' marking macro is provided only for % the code case. So we have\gmhypertarget[textUsage]{} the -% \TextUsage\CodeDefine, \TextUsage\CodeUsage\ and +% \TextUsage\Define, \TextUsage\CodeUsage\ and % \TextUsage\TextUsage\ commands. % % All three take one argument and all three may be starred. The @@ -739,31 +907,32 @@ % precisely, they execute \TextUsage\MakePrivateLetters\ whatever % it does: At the default settings this command makes |*| % a~letter, too, so a~starred version of a~command is a~proper argument -% to any of the three `|\...Define/Usage| commands unstarred. +% to any of the three commands unstarred. % -% The two |\Code...| commands, if unstarred, mark the next scanned -% occurrence of their argument in the code. (By `scanned occurrence' -% I~mean a~situation of the CS having been scanned in the +% The |\Define| and |\CodeUsage| commands, if unstarred, mark the next +% scanned occurrence of their argument in the code. (By `scanned +% occurrence' I~mean a~situation of the CS having been scanned in the % code which happens iff its name was preceded by the char declared as -% |\CodeEscapeChar|). The starred versions of those commands -% mark just the next codeline and don't make \TeX\ looks for the -% scanned occurrence of their argument (which would never happen if -% the argument is not a~CS). Therefore, if you want to mark -% a~definition of an environment \env{foo}, you should put -% \[|%\CodeDefine*{foo}|\] +% |\CodeEscapeChar|). The starred versions of those commands mark just +% the next codeline and don't make \TeX\ looks for the scanned +% occurrence of their argument (which would never happen if the +% argument is not a~CS). Therefore, if you want to mark a~definition +% of an environment \env{foo}, you should put +% \[|%\Define*{foo}|\] % right before the code line % \[|\newenvironment{foo}{%|\]^^A] -% i.e., not separated by any code line. The starred versions of +% i.e., not separated by another code line. The starred versions of % the |\Code...| commands are also intended to mark implicit -% definitions of macros, e.g., |\CodeDefine*\@foofalse| before +% definitions of macros, e.g., |\Define*\@foofalse| before % the line % \[|\newif\if@foo|.\] % -% They both are |\outer|. +% They both are |\outer| to dicourage their use inside macros because +% they actually re|\catcode| before taking their arguments. % % The |\TextUsage| (one-argument) command is intended to mark usage of % a~verbatim occurrence of a~\TeX\ object in the commentary. Unlike -% the two |\Code...|s, it typesets its argument which means among others\ that +% |\CodeUsage| or |\Define|, it typesets its argument which means among others\ that % the marginpar appears usually at the same line as the text you % wanted to mark. This command also has the starred version primarily % intended for the environments names, and secondarily for @@ -808,7 +977,7 @@ % \stanza % On the other hand, if you don't want to put a~CS (or another % verbatim text) in a~marginpar but only to index it, then there are -% \TextUsage\CodeDefIndex\ and \TextUsage\CodeUsgIndex\ to declare +% \TextUsage\DefIndex\ and \TextUsage\CodeUsgIndex\ to declare % special formatting of an entry. The unstarred versions of these % commands look for their argument's scanned occurrence in the code % (the argument should be a~CS), and the starred ones just take the @@ -823,7 +992,7 @@ % a~not scanned stuff as a~usual entry? The \TextUsage\CodeCommonIndex*\ % comes in rescue, starred for the symmetry with the two previous commands % (without |*| it just gobbles -% it's argument). It's |\outer|. +% it's argument---it's indexed automatically anyway). It's |\outer|. % % Similarly, to index a~\TeX\ object occurring verbatim in the narrative, you % have \TextUsage\TextUsgIndex\ and \TextUsage\TextCommonIndex\ @@ -857,7 +1026,7 @@ % \env{evironment}.) % % -% \subdivision{Index Ex/Inclusions} +% \subdivision[Index Ex/Inclusions]{\gmhypertarget{Index Ex/Inclusions}} % % It's\label{IEIDeclarations} understandable\footnote{After reading ^^B( % \docfm's documentation ;-)\,.} that you don't @@ -910,7 +1079,7 @@ % ^^A due to the doctex mode who saw it and coloured all after with % ^^A~salmon. % the closing line |%|\ will be not. It doesn't seem to be -% hard to implement, I~only receive some message it's really useful +% hard to implement, if I~only receive some message it's really useful % for someone. % %^^A If you use the \TextUsage*{macrocode} environment, you don't have to @@ -975,6 +1144,23 @@ % mechanism is used for the change entries.) % \end{quotation} % +% In \gmdoc\ (unless you turn definitions detection off), you can put +% |\changes| after the line of definition of a~command to set the +% default argument of |\changes| to that command. For example, +%\begin{verbatim} +% \newcommand*\dodecaphonic{...} +% % \changes{v0.99e}{2007/04/29}{renamed from \cs{DodecaPhonic}} +%\end{verbatim} +% results with a~history (sub)entry: +% \deksmallskip +% v0.99e\par\hspace*{\parindent} (\dots)\par \hspace*{\parindent} +% \cs{dodecaphonic}: \par\hspace*{2\parindent} renamed from +% \cs{DodecaPhonic}, \textit{\arabic{page}} +% \deksmallskip +% +% Such a~setting is in force till the next definition and +% \emph{every} detected definition resets it. +% % In \gmdoc\ |\changes| is |\outer|. % % \stanza @@ -986,7 +1172,7 @@ % is defined as % \begin{verbatim} % \def\actualchar{=} \def\quotechar{!}% -% \def\levelchar{>} \edef\encapchar{\twelveclub} +% \def\levelchar{>} \edef\encapchar{\xiiclub} %\end{verbatim} % % Only if you @@ -1152,7 +1338,7 @@ % Analogously but for a~slightly different purpose, the % \TextUsage\AddtoPrivateOthers\ macro is provided here. It adds its % argument, which is supposed to be a~one-char CS, to the -% |\doprivateothers| list, whose r\^ole is to allow some special chars +% |\doprivateothers| list, whose r\ocircum le is to allow some special chars % to appear in the marking commands' arguments (the commands described % in section \gmiflink{Macros for Marking the Macros}). The default % contents of this list is | | (the space) and |^| so you may mark the @@ -1271,7 +1457,7 @@ % % \stanza % There's a~quadratus of commands taken from \docfm: -% \TextUsage\StopEventually, \TextUsage\Finale, +% \TextUsage\StopEventually, \TextUsage\Finale,\\ % \TextUsage\AlsoImplementation\ and \TextUsage\OnlyDescription\ that % should be % explained simultaneously (in a~polyphonic song @@ -1284,14 +1470,24 @@ % stuff to be executed anyway>|}| and |\Finale| should be typed % at the end of file. Then |\OnlyDescription| defines % |\StopEventually| to expand to its argument followed by |\endinput| -% and |\AlsoImplementation| defines |\StopEventually| to do nothing +% and\\ |\AlsoImplementation| defines |\StopEventually| to do nothing % but pass its argument to |\Finale|. % % % \subdivision{The Narration Macros} % % To print the control sequences' names you have the \TextUsage\verb\ macro and -% its `shortverb' version whatever you define. But they won't work if +% its `shortverb' version whatever you define (see the \pk{gmverb} +% package). +% +% For short verbatim texts in the inline comments \pk{gmdoc} provides +% the \TextUsage\inverb\\dots\ (the name stands for +% `inline verbatim') command that redefines the \pk{gmverb} breakables +% to break with |%| at the beginning of the +% lower line to avoid mistaking such a~broken verbatim commentary text +% for the code. +% +% But nor |\verb(*)| neither |\inverb| will work if % you put them in an argument of another macro. For such a~situation, % or if you just prefer, \gmdoc\ (\pk{gmutils}) provides a~robust command % \TextUsage\cs, which takes one obligatory argument, the macro's name @@ -1307,6 +1503,15 @@ % verbatim and without a~backslash, e.g., |\env{an environment}| % produces \env{an environment}. % +% And for line breaking at |\cs| and |\env| there is +% \TextUsage\nlpercent\ to ensure |%| if the line breaks at the +% beginning of a~|\cs| or |\env| and \TextUsage\+ to use inside their +% argument for a~discretionary hyphen that'll break to - at the end of +% the upper line and |%| at the beginning of the lower line. By +% default hyphenation of |\cs| and |\env| arguments is off, you can +% allow it only at |\-| or |\+|. +% +% \stanza % To print packages' names sans serif there is a~\TextUsage\pk\ % one-argument command, and the \TextUsage\file\ command intended for % the filenames. @@ -1320,10 +1525,9 @@ % I~wish my self-documenting code to be able to be typeset each % package separately or several in one document. Therefore I~need some % `flexible' sectioning commands and here they are: -% \TextUsage\division\ and \TextUsage\subdivision\ so far, that by -% default are |\let| to be |\section| and |\subsection| if such -% commands are defined in the documentclass. (If not, |\division| and -% |\subdivision| are |\let| to be |\relax|.) +% \TextUsage\division, \TextUsage\subdivision\ and +% \TextUsage\subsubdivision\ so far, that by default are |\let| to be +% |\section|, |\subsection| and |\subsubsection| respectively. % % \stanza % One more kind of flexibility is to allow using \pk{mwcls} or the @@ -1360,7 +1564,8 @@ % skipped in further chapters thanks to it. % % \stanza -% \gmdoc\ provides some \TeX-related logos:\\ +% \gmdoc\ (\pk{gmutils}, to be precise) provides some \TeX-related +% logos:\\ % \Describe\AmSTeX typesets \AmSTeX,\\ % \Describe\BibTeX\BibTeX,\\ % \Describe\SliTeX\SliTeX,\\ @@ -1368,13 +1573,13 @@ % \Describe\Web\Web,\\ % \Describe\TeXbook\TeXbook,\par^^A~without par there raised error % ^^A `too many unprocessed floats'. +% \noindent\Describe\TB\TB\par % \noindent\Describe\eTeX\eTeX,\\ % \Describe\pdfeTeX\pdfeTeX\\ % \Describe\pdfTeX\pdfTeX\\ -% \Describe\XeTeX\XeTeX\ (the first |E| will be reversed iff the -% \pk{graphics} package is loaded) and\\ +% \Describe\XeTeX\XeTeX\ (the first |E| will be reversed if the +% \pk{graphics} package is loaded or \XeTeX\ is at work) and\\ % \Describe\LaTeXpar\LaTeXpar.\par -% (The last logo is defined in \pk{gmutils}.) % % \noindent\Describe\ds\ds\ not quite a~logo, but still convenient. % @@ -1386,7 +1591,7 @@ % % To put an arbitrary text into a~marginpar and have it flushed right % just like the macros' names, you are provided the -% \TextUsage\gmdmarginpar\ macro that takes one and mandatory argument +% \TextUsage\gmdmarginpar\ macro that takes one mandatory argument % which is the contents of the marginpar. % % \stanza @@ -1408,12 +1613,7 @@ % by \cs{Pro\-vid\-es\-Class/Pack\-age/Fi\-le} declarations. The % information of the file you process with \gmdoc\ % is provided (and therefore getable) if the file is also loaded (or -% the |\Provide...| line occures in a~|\StraightEOL| scope). -% -% If you don't load the file the version of which you'd like to get, -% you may write \TextUsage\FileInfo\ in the comment layer, before the -% line containing |\ProvidesPackage/Class| and the file info will be -% written to the \file {.aux} file. +% the |\Provide...| line occurs in a~|\StraightEOL| scope). % % If the input file doesn't contain |\Provides...| in the code layer, % there are commands \TextUsage\ProvideFileInfo|{|\ +% |\VerbHyphen\|\ % declaration provided by \pk{gmverb}. % % \changes{v0.98c}{06/9/8}{\cs{CodeDelim} renamed from a~rather confusing @@ -1728,7 +1928,7 @@ % \changes{v0.99a}{06/12/1}{split into the starred and unstarred % versions} % -% \CodeDefine\CodeDelim \CodeDefine\code@delim +% \Define\code@delim \def\CodeDelim{\@ifstar\Code@Delim@St\Code@Delim} \def\Code@Delim#1{% @@ -1745,42 +1945,42 @@ % a~code delimiter. I~don't think it \emph{really} to be a~limitation. % % And let's assume you do as we all do: -\CodeDelim\% +\CodeDelim*\% % We'll play with |\everypar|, a~bit, and if you use such things as -% the |{itemize}| environment, an error would occure if we didn't +% the |{itemize}| environment, an error would occur if we didn't % store the previous value of |\everypar| and didn't restore it at % return to the narration. So let's assign a~|\toks| list to store the -% original |\everypar| -% \CodeDefIndex\gmd@preverypar +% original |\everypar|: + \newtoks\gmd@preverypar -% \CodeDefIndex\settexcodehangi \newcommand*\settexcodehangi{% \hangindent=\verbatimhangindent \hangafter=\@ne}% we'll use % it in the inline comment case. |\verbatimhangindent| is provided by the % \pk{gmverb} package and\equals3\,em by default. -% \CodeDefIndex\@@settexcodehangi +% \DefIndex\@@settexcodehangi \@ifdefinable\@@settexcodehangi{\let\@@settexcodehangi=\settexcodehangi} %^^A~\gmdeverycodeline{\@@settexcodehangi} % We'll play a~bit with |\leftskip|, so let the user have a~parameter % instead. For normal text (i.e.\ the comment): -% \CodeDefine\TextIndent + \newlength\TextIndent -% I~assume it's originally equal |\leftskip|, i.e.\ |\z@|. And for +% I~assume it's originally equal to |\leftskip|, i.e.\ |\z@|. And for % the \TeX\ code: +% \HideAllDefining \newlength\CodeIndent -%\label{CodeIndent} -% \CodeDefine\CodeIndent +% \label{CodeIndent} +% \Define\CodeIndent \CodeIndent=1,5em\relax % And the vertical space to be inserted where there are blank lines in the % source code: \@ifundefined{stanzaskip}{\newlength\stanzaskip}{} % I~use |\stanzaskip| in \pk{gmverse} package and -% derivates for typesetting poetry. A~computer program code \emph{is} +% derivatives for typesetting poetry. A~computer program code \emph{is} % poetry. -% \CodeDefine\stanzaskip +% \Define\stanzaskip \stanzaskip=\medskipamount \advance\stanzaskip by-.25\medskipamount% to preserve the stretch- and % shrinkability.\par @@ -1791,21 +1991,22 @@ \newskip\CodeTopsep \newskip\MacroTopsep -% And let's set them. For the \ae sthetical +% And let's set them. For \ae sthetic % minimality\StraightEOL\footnote{The terms `minimal' and `minimalist' % used in \gmdoc\ are among others\ inspired by the \emph{South Park} % cartoon's episode \emph{Mr.\ Hankey The~Christmas (\dots)}\/ in % which `Philip Glass, a~Minimalist New York composer' appears in % a~`non-denominational non-offensive Christmas play' ^^A( % ;-)\,. (Philip Glass composed the music to the \emph{Qatsi} -% trilogy among others)}\QueerEOL\ let's unify them and other most important +% trilogy among others)}\QueerEOL\ let's unify them and the other most important % vertical spaces used in \gmdoc. I~think a~macro that gathers all % these assignments may be handy. -% \CodeDefine\MacroTopsep -% \CodeDefine\CodeTopsep -% \CodeDefine\UniformSkips +% \ResumeAllDefining +% \Define\MacroTopsep +% \Define\CodeTopsep +% \Define\UniformSkips \def\UniformSkips{%\label{UniformSkips} - % \CodeDefine\CodeTopsep \CodeDefine\MacroTopsep + % \Define\CodeTopsep \Define\MacroTopsep \CodeTopsep=\stanzaskip \MacroTopsep=\stanzaskip \abovedisplayskip=\stanzaskip @@ -1838,7 +2039,6 @@ % declaration. That shall discard the unwanted setting already placed % in the |\begin{document}| hook. % -% \CodeDefine\NonUniformSkips \newcommand*\NonUniformSkips{\@relaxen\UniformSkips} % Why do we launch |\UniformSkips| twice then? The first time is % to set all the \gmdoc-specific glues \emph{somehow}, which allows @@ -1849,14 +2049,12 @@ % And let's define a~macro to insert a~space % for a~chunk of documentation, e.g., to mark the beginning of new % macro's explanation and code. -% \CodeDefine\chunkskip \newcommand*\chunkskip{% \skip0=\MacroTopsep \if@codeskipput\advance\skip0 by-\CodeTopsep\fi \par\addvspace{\skip0}\@codeskipputgtrue} % And, for a~smaller part of text, -% \CodeDefine\stanza \newcommand*\stanza{% \skip0=\stanzaskip \if@codeskipput\advance\skip0 by-\CodeTopsep\fi @@ -1865,7 +2063,6 @@ % Since the stanza skips are inserted automatically most often (cf.\ lines % \ref{codeskip}, \ref{codeskip2}, \ref{codeskip3}, \ref{codeskip4}, % \ref{codeskip5}), sometimes you may need to forbid them. -% \CodeDefine\nostanza \newcommand*\nostanza{% \@codeskipputgtrue\@afternarrgfalse\@aftercodegtrue}% In the `code % to narration' case the first switch is enough but in the countercase @@ -1874,8 +2071,6 @@ % % % To count the lines where they have begun not before them -% \CodeDefine\if@newline \CodeDefine*\@newlinegtrue -% \CodeDefine*\@newlinegfalse \newgif\if@newline % |\newgif| is |\newif| with global effect i.e., it defines |\...gtrue| % and |\...gfalse| switchers that switch respective Boolean switch @@ -1883,7 +2078,7 @@ % \stanza % % To handle the \ds\ directives not \emph{any} |%<...|. -% \CodeDefine*\if@dsdir +% \Define\if@dsdir \newgif\if@dsdir % This switch will be falsified at the first char of a~code line. (We % need a~switch independent of the one indicationg whether the line @@ -1896,18 +2091,17 @@ % Now we define main |\input|ing command that'll change catcodes. % The macros used by it are defined later. % -% \CodeDefine\DocInput \CodeDefine\Doc@Input -% \changes{v0.98}{06/09/05}{\cs{@makeother\protect\bslash_} added} \newcommand*\DocInput{\bgroup\@makeother\_\Doc@Input} \begingroup\catcode`\^^M=\active% \firstofone{\endgroup% \newcommand*{\Doc@Input}[1]{\egroup\begingroup% - % \CodeDefIndex\gmd@inputname + % \changes{v0.98}{06/09/05}{\cs{@makeother\protect\bslash_} added} + % \DefIndex\gmd@inputname \edef\gmd@inputname{#1}% we'll use it in some notifications. - % \CodeDefIndex\gmd@currentlabel@before - \let\gmd@currentlabel@before=\@currentlabel% we store it 'cause + % \DefIndex\gmd@currentlabel@before + \let\gmd@currentlabel@before=\@currentlabel% we store it because % we'll do |\xdef|s of |\@currentlabel| to make proper references % to the line numbers so we want to restore current % |\@currentlabel| after our group. @@ -1935,14 +2129,14 @@ \@beginputhook% my first use of it is to redefine |\maketitle| % just at this point not globally. \CodeUsgIndex\everypar \everypar=\@xa{\@xa\@codetonarrskip\the\everypar}% - % \CodeDefine*{^^M} + % \Define*{^^M} \let^^M=\gmd@textEOL% - % \CodeDefIndex\gmd@guardedinput + % \Define\gmd@guardedinput \edef\gmd@guardedinput{% \@nx\@@input #1\relax% |\@nx| is % |\noexpand|, see \pk{gmutils}.\DoNotIndex\@nx - % \nlpercent|\@@input| is the - % true \TeX's \nlpercent|\input|. \CodeUsgIndex\EOFMark + % \inverb|\@@input| is the + % true \TeX's \inverb|\input|. \CodeUsgIndex\EOFMark \gmd@iihook% cf.\ line \ref{iihook} \@nx\EOFMark% to pretty finish the input, see % line~\ref{eofMark}.\CodeUsgIndex\code@delim @@ -1979,10 +2173,9 @@ % will be used also for checking the |%^^M| case (|\@ifnextchar| % does |\ifx|). % -% \CodeDefine\gmd@textEOL \def\gmd@textEOL{ % a~space just like in normal \TeX. We put it first to - % cooperate with \nlpercent|\^^M|'s |\expandafter\ignorespaces|. It's no + % cooperate with \inverb|\^^M|'s |\expandafter\ignorespaces|. It's no % problem since a~space | |${}_{10}$ doesn't drive \TeX\ out of % the vmode. \ifhmode\@afternarrgtrue\@codeskipputgfalse\fi% being in @@ -2006,7 +2199,7 @@ % ^^A~the one brought from the narration but then, \gmd@setclubpenalty% Most paragraphs will be % one-line most probably. Since some sectioning commands may change - % \nlpercent|\clubpenalty|, we set it again here and also after this + % \inverb|\clubpenalty|, we set it again here and also after this % group. \aftergroup\gmd@setclubpenalty% \let\par\@@par% inside the verbatim group we wish |\par| to be genuine. @@ -2014,7 +2207,7 @@ \ttverbatim% it does |\tt| and makes specials % other or |\active|-and-breakable. \gmd@DoTeXCodeSpace% - \@makeother\|% 'cause |\ttverbatim| doesn't do that. + \@makeother\|% because |\ttverbatim| doesn't do that. \MakePrivateLetters% see line \ref{MPL}.\par \@xa\@makeother\code@delim% we are % almost sure the code comment char is among the chars having @@ -2036,12 +2229,10 @@ % \stanza % For convenient adding things to the begin- and endinput hooks: -% \CodeDefine\AtEndInput \CodeDefine\@endinputhook \def\AtEndInput{\g@addto@macro\@endinputhook} \def\@endinputhook{} %\label{@endinputhook} % Simili modo -% \CodeDefine\AtBegInput \CodeDefine\@beginputhook \def\AtBegInput{\g@addto@macro\@beginputhook} \def\@beginputhook{} @@ -2051,8 +2242,7 @@ % And let's use it instantly to avoid a~disaster while reading in the % table of contents. -% \CodeDefine\tableofcontents -% \CodeDefIndex\gmd@@toc +% \DefIndex\gmd@@toc \AtBegInput{\let\gmd@@toc\tableofcontents \def\tableofcontents{% \label{straighttoc} \@ifQueerEOL{\StraightEOL\gmd@@toc\QueerEOL}{\gmd@@toc}}} @@ -2061,36 +2251,34 @@ % use those two strange declarations to change and restore the very % special meaning of the line end. Without such changes % |\tableofcontents| would cause a~disaster (it did indeed). And to -% check the catcode of |^^M| is the r\^ole of |\@ifQueerEOL|: +% check the catcode of |^^M| is the r\ocircum le of |\@ifQueerEOL|: % % \changes{v0.98a}{06/09/06}{\cs{tableofcontents}, \cs{PrintIndex} % and \cs{PrintChanges} modified to work properly in the `queer line % ends' environment.} -% \CodeDefine\@ifQueerEOL -% \changes{v0.98a}{06/09/06}{added} -\long\def\@ifQueerEOL#1#2{% + +\long\def\@ifQueerEOL#1#2{%% \changes{v0.98a}{06/09/06}{added} \ifnum\the\catcode`\^^M=\active \afterfi{#1}\else\afterfi{#2}\fi} -% \CodeDefine\AtBegInputOnce The declaration below is useful if you +% The declaration below is useful if you % wish to put sth.\ just in the nearest input/included file and no % else: at the moment of putting the stuff it will erase it from the % hook. You may declare several |\AtBegInputOnce|s, they add up. -% \changes{v0.98a}{06/09/05}{The counter \cs[]{hook@oncecnt} added -% to number the self-destructing cs's (thence the hooks add up) and -% the prefix changed to \cs[]{gmd/AtBI/NeuroOncer}} -% -% \changes{v0.98l}{06/10/26}{After the Tiger's suggestion, defining -% a~unique macro for each use of \* substituted with just one macro in -% the begin input hook and adding to this macro.} % -%^^A CodeDefine*{hook@oncecnt} +%^^A Define*{hook@oncecnt} %^^A CodeDefIndex*\c@hook@oncecnt %^^A\newcounter{hook@oncecnt} -% \CodeDefine\gmd@ABIOnce +% \Define\gmd@ABIOnce \@emptify\gmd@ABIOnce \AtBegInput\gmd@ABIOnce \long\def\AtBegInputOnce#1{% +% \changes{v0.98a}{06/09/05}{The counter \cs[]{hook@oncecnt} added +% to number the self-destructing cs's (thence the hooks add up) and +% the prefix changed to \cs[]{gmd/AtBI/NeuroOncer}} +% \changes{v0.98l}{06/10/26}{After the Tiger's suggestion, defining +% a~unique macro for each use of \* substituted with just one macro in +% the begin input hook and adding to this macro.} %^^A \stepcounter{hook@oncecnt}% %^^A \@xa\long\@xa\edef% \CodeUsgIndex*{NeuroOncer} %^^A \csname gmd/AtBI/NeuroOncer\the\c@hook@oncecnt\endcsname{% @@ -2101,7 +2289,7 @@ % Many tries of finishing the input cleanly led me to setting the % guardians as in line \ref{guardians} and to -% \CodeDefine\EOFMark + \def\EOFMark{\} % \label{eofMark}Other solutions did print the last code delimiter or % would require managing a~special case for the macros typesetting @@ -2113,21 +2301,21 @@ % Due to the |codespacesblank| option in the line \ref{cspb} we launch % the macro defined below to change the meaning of a~\pk{gmdoc}-kernel % macro. -% \CodeDefIndex\gmd@DoTeXCodeSpace +% \DefIndex\gmd@DoTeXCodeSpace \begin{obeyspaces}% \gdef\gmd@DoTeXCodeSpace{% -\obeyspaces\let =\breakabletwelvespace}% +\obeyspaces\let =\breakablexiispace}% % \stanza -% \CodeDefine\CodeSpacesBlank +% \Define\CodeSpacesBlank % \changes{v0.98a}{06/09/06}{a~kernel \cs{gmd@verbatimspace} renamed % to \cs{gmd@texcodespace} and a~bug fixed.} % \CodeUsgIndex\gmobeyspaces -% \CodeDefIndex\gmd@texcodespace +% \DefIndex\gmd@texcodespace \gdef\CodeSpacesBlank{% \let\gmd@DoTeXCodeSpace\gmobeyspaces% \let\gmd@texcodespace=\ }% the latter |\let| is for the |\if...|s. %\stanza -% \CodeDefine\CodeSpacesSmall +% \Define\CodeSpacesSmall \gdef\CodeSpacesSmall{% \def\gmd@DoTeXCodeSpace{% \obeyspaces\def {\,\hskip\z@}}% @@ -2136,7 +2324,6 @@ \end{obeyspaces} % How the continuing of the narration should look like? -% \CodeDefIndex\gmd@continuenarration \def\gmd@continuenarration{% \endgroup \gmd@countnarrationline% see \gmiflink[countnarr]{below}. @@ -2151,7 +2338,6 @@ %\gmhypertarget[countnarr]{Whether} we count the narration lines % depends on the option |countalllines| which is off by default. -% \CodeDefIndex\gmd@countnarrationline \if@countalllines \def\gmd@countnarrationline{% \if@newline @@ -2167,14 +2353,14 @@ % should restore it. \hyperlabel@line {\LineNumFont\thecodelinenum}\,\ignorespaces - \fi}% \CodeDefIndex\gmd@countnarrationline + \fi}% \DefIndex\gmd@countnarrationline \else \@emptify\gmd@countnarrationline% \fi % And typesetting the \TeX\ code? \begingroup\catcode`\^^M=\active% -\firstofone{\endgroup% \CodeDefIndex\gmd@typesettexcode +\firstofone{\endgroup% \DefIndex\gmd@typesettexcode \def\gmd@typesettexcode{% \gmd@parfixclosingspace% it's to eat a~space closing the % paragraph, see \gmiflink[closingspace]{below}. It contains @@ -2185,12 +2371,12 @@ \everypar={\@@settexcodehangi}% At first attempt we thought % of giving the user a~|\toks| list to insert at the beginning of % every code line, but what for? - % \CodeDefine*{^^M}^^A + % \Define*{^^M}^^A \def^^M{% \@newlinegtrue% to |\refstep| the counter in proper place. \@dsdirgtrue% to handle the \ds\ directives. \global\gmd@closingspacewd=\z@% \label{noclosingspace}we - % don't wish to eat a~closing space after a~codeline, 'cause + % don't wish to eat a~closing space after a~codeline, because % there isn't any and a~negative rigid |\hskip| added to % |\parfillskip| would produce a~blank line. \ifhmode\par\@codeskipputgfalse\else% @@ -2205,7 +2391,7 @@ \@ifnextchar{\gmd@texcodespace}{% \@dsdirgfalse\gmd@dolspaces}{\gmd@charbychar}% }% end of |^^M|'s definition.\label{debug!2} - % \CodeDefIndex\gmd@texcodeEOL + % \DefIndex\gmd@texcodeEOL \let\gmd@texcodeEOL=^^M% for further checks inside |\gmd@charbychar|. \raggedright\leftskip=\CodeIndent% \if@aftercode\gmd@nocodeskip1{iaC}\else\if@afternarr% @@ -2221,7 +2407,7 @@ \if@newline\grefstepcounter{codelinenum}\@newlinegfalse% \fi% \printlinenumber% if we don't want the lines to be numbered, - % the respective option \nlpercent|\let|s this CS to |\relax|. + % the respective option \inverb|\let|s this CS to |\relax|. \hyperlabel@line% \mark@envir% index and/or marginize an environment if there is % some to be done so, see line \ref{mark@envir}. @@ -2260,25 +2446,25 @@ % line). If there'll be only |%|, we want just to continue the comment % or start a~new one. (We don't have to worry about whether we should % |\par| or not.) -% \CodeDefIndex\gmd@spacewd +% \DefIndex\gmd@spacewd \newlength\gmd@spacewd% to store the width of a~(leading) % | |\catother. -% \CodeDefIndex\gmd@ldspaceswd +% \DefIndex\gmd@ldspaceswd \newlength\gmd@ldspaceswd% to store total length of gobbled leading %spaces. % It costed me some time to reach that in my verbatim scope a~space % isn't \catother\ but \catactive, namely |\let| to -% |\breakabletwelvespace|. +% |\breakablexiispace|. % So let us |\let| for future: -% \CodeDefIndex\gmd@texcodespace -\let\gmd@texcodespace=\breakabletwelvespace +% \Define\gmd@texcodespace +\let\gmd@texcodespace=\breakablexiispace % And now let's try to deal with those spaces. -% \CodeDefIndex\gmd@dolspaces + \def\gmd@dolspaces{% \ifx\gmd@texcodespace\@let@token \@dsdirgfalse - \afterfi{\settowidth{\gmd@spacewd}{\twelvespace}% + \afterfi{\settowidth{\gmd@spacewd}{\xiispace}% \gmd@ldspaceswd=\z@ \gmd@eatlspace}% \else\afterfi{% about this smart macro and other of its family see @@ -2287,11 +2473,11 @@ \fi} % And now, the iterating inner macro that'll eat the leading spaces. -% \CodeDefIndex\gmd@eatlspace + \def\gmd@eatlspace#1{% \ifx\gmd@texcodespace#1% \advance\gmd@ldspaceswd by\gmd@spacewd% we don't - % |\advance| it |\global|ly 'cause the current group may be closed + % |\advance| it |\global|ly because the current group may be closed % iff we meet |%| and then we'll won't indent the line anyway. \afteriffifi\gmd@eatlspace \else @@ -2304,9 +2490,7 @@ % We want to know whether we were in hmode before reading current % |\code@delim|. We'll need to switch the switch globally. -% -% \CodeDefine\ifprevhmode \CodeDefine*\prevhmodegtrue -% \CodeDefine*\prevhmodegfalse + \newgif\ifprevhmode % \addvspace\medskipamount @@ -2314,7 +2498,7 @@ % And the main iterating inner macro which eats every single char of % verbatim text to check the end. The case |\%| should be excluded % and it is indeed. -% \CodeDefine*\gmd@charbychar + \newcommand*\gmd@charbychar[1]{% \ifhmode\prevhmodegtrue \else\prevhmodegfalse\fi @@ -2340,7 +2524,6 @@ % cases and it's very low level in one case because |\refstepcounter| and % |\stepcounter| added some stuff that caused blank lines, at % least with \pk {hyperref} package loaded. -% \CodeDefIndex\gmd@EOLorcharbychar \def\gmd@EOLorcharbychar#1{% \ifx\gmd@texcodeEOL#1% \if@newline @@ -2357,7 +2540,6 @@ % a~code |^^M| with no commentary. \fi} -% \CodeDefIndex\gmd@counttheline \def\gmd@counttheline{% \ifvmode \if@newline @@ -2375,10 +2557,10 @@ % If before reading current |%| char we were in horizontal mode, then % we wish to print |%| (or another code delimiter). -% \CodeDefIndex\gmd@percenthack + \def\gmd@percenthack{% \ifprevhmode\code@delim\aftergroup\space% We add a~space after |%|, - % 'cause I~think it looks better. It's done |\aftergroup| to make + % because I~think it looks better. It's done |\aftergroup| to make % the spaces possible after the |%| not to be % typeset. \else\aftergroup\gmd@narrcheckifds@ne% remember that @@ -2394,7 +2576,7 @@ % The macro below is used to look for the |%^^M| case to make % a~commented blank line make a~new paragraph. % Long searched and very simple at last. -% \CodeDefIndex\gmd@checkifEOL + \def\gmd@checkifEOL{% \gmd@countnarrationline \everypar=\@xa{\@xa\@codetonarrskip% we add the @@ -2412,7 +2594,7 @@ % In the `mixed' line case it should be a~bit more complex, though. On % the other hand, there's no need to checking for \ds\ directives. -% \CodeDefIndex\gmd@checkifEOLmixd + \def\gmd@checkifEOLmixd{% \gmd@countnarrationline \everypar=\@xa{\@xa\@codetonarrskip\the\gmd@preverypar}% @@ -2432,7 +2614,7 @@ % latter |\gmd@endpe| sets the parameters at the narration values. % In the other case both |\gmd@endpe|s do the same % and |\par| between them does nothing. - % \CodeDefIndex\par + % \DefIndex\par \def\par{% \ifhmode% (I~added this |\ifhmode| as a~result of a~heavy % debug.) @@ -2461,7 +2643,7 @@ % group and therefore we wish to restore normal |\leftskip| when back to % normal text i.e.\ the commentary. But, if normal text starts in the % same line as the code, then we still wish to indent such a~line. -% \CodeDefIndex\gmd@endpe + \def\gmd@endpe{% \ifprevhmode \settexcodehangi%\unskip ndent @@ -2485,18 +2667,16 @@ \@relaxen\gmd@resetlinecount% \dots\ we turn % resetting the counter by \cs{Doc\+In\+put} off\dots \newcommand*\resetlinecountwith[1]{% - % \CodeDefIndex*\c@codelinenum \newcounter{codelinenum}[#1]}% \dots\ and provide a~new % declaration of the counter. -\else% With the option turned off\dots \CodeDefine*{DocInputsCount} - \newcounter{DocInputsCount}% \CodeDefine*{codelinenum} +\else% With the option turned off\dots + \newcounter{DocInputsCount}% \newcounter{codelinenum}[DocInputsCount]% \dots\ we declare the % |\DocInput|s' number counter andthe codeline counter % to be reset with stepping of it. % \changes[\c@DocInputsCount]{v0.98c}{06/9/8}{added for fixing % duplication of \pk{hyperref} labels in the case of a~multiple % \cs{DocInput}} - % \CodeDefine\gmd@resetlinecount \newcommand*\gmd@resetlinecount{\stepcounter{DocInputsCount}}% \dots % and let the |\DocInput| increment the |\DocInput|s number count % and thus reset the codeline count. It's for unique naming of the @@ -2505,15 +2685,14 @@ % Let's define printing the line number as we did in \pk{gmvb} % package. -% \CodeDefIndex\printlinenumber \newcommand*\printlinenumber{% \leavevmode\llap{\rlap{\LineNumFont$\phantom{999}$\llap{\thecodelinenum}}% \hskip\leftskip}} -% \CodeDefine\LineNumFont + \def\LineNumFont{\normalfont\tiny} \if@linesnotnum\@relaxen\printlinenumber\fi -% \CodeDefIndex\hyperlabel@line + \newcommand*\hyperlabel@line{% \if@pageindex% It's good to be able to switch it any time not just % define it once according to the value of the switch set by the @@ -2530,7 +2709,7 @@ % between the code and the narration. Its parameter is % a~\gmhypertarget[relic parameter]{relic} of a~very heavy debug of % the automatic vspacing mechanism. Let it remain at least until this -% package is 2.0 version. \CodeDefIndex\gmd@codeskip +% package is 2.0 version. \newcommand*\gmd@codeskip[1]{\@@par\addvspace\CodeTopsep\@codeskipputgtrue} %\label{codeskip2} @@ -2541,14 +2720,12 @@ % not the `true' last skip. \Describe*{@codeskipput}Therefore we need % a~Boolean switch to keep the knowledge of putting similar vskip % before |\parskip|. -% \CodeDefine\if@codeskipput \CodeDefIndex*\@codeskipputgtrue -% \CodeDefIndex*\@codeskipputgfalse \CodeDefIndex*{@codeskipput} +% \Define\if@codeskipput \newgif\if@codeskipput % The below is another relic of the heavy debug of the automatic % vspacing. Let's give it the same removal clause as % \gmiflink[relic parameter]{above}. -% \CodeDefIndex\gmd@nocodeskip \newcommand*\gmd@nocodeskip[2]{} % And here is how the two relic macros looked like during the @@ -2564,20 +2741,17 @@ % We'll wish to execute |\gmd@codeskip| wherever a~codeline (possibly with % an inline comment) is followed by a~homogenic comment line or % reverse. Let us dedicate a~Boolean switch to this then. -% \CodeDefine\if@aftercode \CodeDefine*\@aftercodegtrue -% \CodeDefine*\@aftercodegfalse +% \Define\if@aftercode \newgif\if@aftercode % This switch will be set true in the moments when we are able to % switch from the \TeX\ code into the narration and the below one when % we are able to switch reversely. -% \CodeDefine\if@afternarr \CodeDefine*\@afternarrgtrue -% \CodeDefine*\@afternarrgfalse +% \Define\if@afternarr \newgif\if@afternarr % To insert vertical glue between the \TeX\ code and the narration % we'll be playing with |\everypar|. More precisely, we'll add a~macro % that the |\parindent| box shall move and the glue shall put. -% \CodeDefine\@codetonarrskip \long\def\@codetonarrskip{% \if@codeskipput\else \if@afternarr\gmd@nocodeskip4{iaN}\else @@ -2608,12 +2782,10 @@ % delimited parameters for a~macro: if we define a~two-parameter % macro, the first is undelimited so it has to be nonempty; it costed % me some one hour to understand it). -% \CodeDefine\@trimandstore -% \CodeDefIndex\@trimandstore@hash \long\def\@trimandstore#1\@trimandstore{% \def\@trimandstore@hash{#1}% \ifx\@trimandstore@hash\@empty% we check if |#1| is - % nonempty. The |\if|\nlpercent*|\relax#1\relax| trick is not + % nonempty. The |\if|\inverb*|\relax#1\relax| trick is not % recommended here because using it we couldn't avoid expanding |#1| % if it'd be expandable. \gmd@preverypar={}% @@ -2621,7 +2793,6 @@ \afterfi{\@xa\@trimandstore@ne\the\everypar\@trimandstore}% \fi} -% \CodeDefIndex\@trimandstore@ne \long\def\@trimandstore@ne#1#2\@trimandstore{%\label{@trimandstore} \def\trimmed@everypar{#2}% \ifx\@codetonarrskip#1% @@ -2645,9 +2816,10 @@ % define a~line-end eater: \catcode`\^^B=\active% note we re|\catcode| \ globally, for the % entire document. -\bgroup\catcode`\^^M=\active% -\firstofone{\egroup% \CodeDefIndex\QueerCharTwo \CodeDefine*{^^B} - \def\QueerCharTwo{\long\def^^B##1^^M{\ignorespaces}}} +\foone{\catcode`\^^M=\active}%% \Define*{^^B} + {\def\QueerCharTwo{% + \def^^B##1^^M{\ignorespaces}}% + } \QueerCharTwo @@ -2675,9 +2847,12 @@ % would cause disasters. So let's do it an |\active| way. \catcode`\^^A=\active% note we re|\catcode| \ globally, for the % entire document. -\bgroup\catcode`\^^M=\active% -\firstofone{\egroup% \CodeDefIndex\QueerCharOne \CodeDefine*{^^A} - \def\QueerCharOne{\long\def^^A##1^^M{\ignorespaces^^M}}} +\foone{\catcode`\^^M=\active}%%\DefIndex\QueerCharOne \Define*{^^A} + {\def\QueerCharOne{% + \def^^A{% + \bgroup\let\do\@makeother\dospecials\gmd@gobbleuntilM}}% + \def\gmd@gobbleuntilM#1^^M{\egroup\ignorespaces^^M}% + } \QueerCharOne @@ -2697,21 +2872,23 @@ % \changes{v0.98b}{06/09/07}{\cs{QueerM} and \cs{StraightM} renamed % to \cs{QueerEOL} and \cs{StraightEOL} and other (internal) macros % ending with \cs[]{M}} -% \CodeDefine\StraightEOL \def\StraightEOL{%\label{StraightEOL} - \catcode`\^^M=5\relax - \catcode`\^^A=14\relax - \catcode`\^^B=14\relax + \catcode`\^^M=5 + \catcode`\^^A=14 + \catcode`\^^B=14 \def\^^M{\ }} -% \CodeDefine\QueerEOL -\def\QueerEOL{%\label{QueerEOL} - \catcode`\^^M=\active - \catcode`\^^A=\active - \catcode`\^^B=\active% I~only re|\catcode| \ and \ - % hoping no one but me is \emph{that} perverse to make them - % |\active| and (re)define. (Let me know if I'm wrong at this point.) - \let\^^M=\gmd@bslashEOL} +\foone{\catcode`\^^M=\active}% +{\def\QueerEOL{%\label{QueerEOL} + \catcode`\^^M=\active% + \let^^M\gmd@textEOL% + % ^^A~ $$$$$$$$ + \catcode`\^^A=\active% + \catcode`\^^B=\active% I~only re|\catcode| \ and \ + % hoping no one but me is \emph{that} perverse to make them + % |\active| and (re)define. (Let me know if I'm wrong at this point.) + \let\^^M=\gmd@bslashEOL}% +} % \iffalse % They won't work in \verb+|verbatim|+ scopes but the clubs redefine @@ -2725,14 +2902,11 @@ % but has one uwelcome feature: if the line has nearly |\textwidth|, % this closing space may cause line breaking and setting a~blank line. % To fix this I~|\advance| the |\parfillskip|: -% \CodeDefIndex\gmd@parfixclosingspace \def\gmd@parfixclosingspace{{% \advance\parfillskip by-\gmd@closingspacewd\par}} % We'll put it in a~group surrounding |\par| but we need to check if % this |\par| is executed after narration or after the code, % i.e., whether the closing space was added or not. -% \CodeDefIndex\gmd@closingspacewd -% \CodeDefIndex\gmd@setclosingspacewd \newskip\gmd@closingspacewd \newcommand*\gmd@setclosingspacewd{% \global\gmd@closingspacewd=\fontdimen2\font% @@ -2742,9 +2916,8 @@ % case when no closing space is added. % And one more detail: -% \CodeDefIndex\gmd@bslashEOL \bgroup\catcode`\^^M=\active% -\firstofone{\egroup% \CodeDefIndex*{\^^M}\changes{v0.99c}{2007/03/30}{a~bug fix: redefinition of it left solely to \cs{QueerEOL}} +\firstofone{\egroup% \DefIndex*{\^^M}\changes{v0.99c}{2007/03/30}{a~bug fix: redefinition of it left solely to \cs{QueerEOL}} \def\gmd@bslashEOL{\ \@xa\ignorespaces^^M}} % The |\QueerEOL| declaration will |\let| it to |\^^M| to make % |\^^M| behave properly. If this definition was ommitted, |\^^M| @@ -2762,17 +2935,15 @@ % % To make \env{verbatim(*)} typeset its contents with the \TeX\ code's % indentation: -% \CodeDefIndex\@verbatim +% \Define\@verbatim \gaddtomacro\@verbatim{\leftskip=\CodeIndent} % And a~one more little definition to accomodate |\verb| and pals for the % lines commented out. -% \CodeDefIndex\check@percent \AtBegInput{\long\def\check@percent#1{% \@xa\ifx\code@delim#1\else\afterfi{#1}\fi}} % We also redefine \pk{gmverb}'s |\AddtoPrivateOthers| that has been % provided just with \pk{gmdoc}'s need in mind. -% \CodeDefine\AddtoPrivateOthers \def\AddtoPrivateOthers#1{% \@xa\def\@xa\doprivateothers\@xa{% \doprivateothers\do#1}}% @@ -2781,7 +2952,7 @@ % line end if a~line end char is met in a~short verbatim: we have to % check if we are in `queer' or `straight' EOLs area. \begingroup -\obeylines% \CodeDefIndex\gm@verb@eol +\obeylines% \DefIndex\gm@verb@eol \AtBegInput{\def\gm@verb@eol{\obeylines% \def^^M{\verb@egroup\@latex@error{% \@nx\verb ended by end of line}% @@ -2805,14 +2976,14 @@ % them. But here in \pk{gmdoc} we prefer no special style for the % index. -% \CodeDefine\actualchar \CodeDefine\quotechar \CodeDefine\encapchar -% \CodeDefine\levelchar +% \Define\actualchar \Define\quotechar \Define\encapchar +% \Define\levelchar % \changes[\actualchar]{v0.98e}{06/09/23}{a~bug fix: making the % \cs[]{@} \protect\catother\space again} \edef\actualchar{\string @} -\def\quotechar{"} -\edef\encapchar{\twelveclub} -\def\levelchar{!} +\edef\quotechar{\string "} +\edef\encapchar{\xiiclub} +\edef\levelchar{\string !} % However, for the glossary, i.e., the change history, a~special style % is required, e.g., \pk{gmglo.ist}, and the above macros are % redefined by the |\changes| command due to \pk{gmglo.ist} and @@ -2823,14 +2994,14 @@ % process them further are postponed till |\begin{document}|. % % -% \CodeDefine\CodeEscapeChar \CodeDefine\code@escape@char +% \Define\code@escape@char \def\CodeEscapeChar#1{% \begingroup \escapechar\m@ne \xdef\code@escape@char{\string#1}% \endgroup} % As you see, to make a~proper use of this macro you should give it -% the~|\|\ CS as an argument. It's an invariant assertion that +% a~|\|\ CS as an argument. It's an invariant assertion that % |\code@escape@char| stores `other' version of the code layer % escape char. % \CodeUsgIndex\CodeEscapeChar @@ -2838,7 +3009,6 @@ % As mentioned in \docfm, someone may have some chars \catletter ed. \@ifundefined{MakePrivateLetters}{%\label{MPL} - % \CodeDefine\MakePrivateLetters \def\MakePrivateLetters{\makeatletter\catcode`\*=11 }}{} % A~tradition seems to exist to write about e.g., `command |\section| and % command |\section*|' and such an uderstanding also of `macro' is @@ -2847,12 +3017,10 @@ % % \stanza % And you may wish some special chars to be \catother. -% \CodeDefine\MakePrivateOthers \def\MakePrivateOthers{\let\do=\@makeother \doprivateothers} -% This macro we use to re|\catcode| the space for marking the +% We use this macro to re|\catcode| the space for marking the % environments' names and the caret for marking chars such as |^^M|, see % line \ref{TextUsage}. So let's define the list: -% \CodeDefine\doprivateothers \def\doprivateothers{\do\ \do\^} % Two chars for the beginning, and also the |\MakeShortVerb| command % shall this list enlarge with the char(s) declared. @@ -2866,7 +3034,6 @@ % Now the main macro indexing a~macro's name. It would be a~verbatim % :-) copy of the \docfm 's one if I~didn't ommit some lines % irrelevant with my approach. -% \CodeDefine\scan@macro \def\scan@macro#1{% we are sure to scan at least one token and % therefore we define this macro as one-parameter.\par % Unlike in \docfm , here we have the escape char \catother\ so we @@ -2884,15 +3051,16 @@ % a~benchmark letter. \ifcat a\@nx#1% \quote@char#1% - \xdef\macro@iname{\maybe@quote#1}% global for symmetry with - % line \ref{x123}. + \xdef\macro@iname{\gmd@maybequote#1}% global for symmetry with + % line \ref{x474}. \xdef\macro@pname{\string#1}%\label{stringing0} we'll print entire % name of the macro later.\par % We |\string| it here and in the lines \ref{stringing1} and % \ref{stringing2} to be sure it is whole \catother\ for easy % testing for special indexentry formats, see line - % \ref{pnametestDef} etc. - \afterfi{\@ifnextcat{a}{\continue@macroscan}{\finish@macroscan}}% + % \ref{pnametestDef} etc. Here we are sure the result of |\string| + % is \catother\ since its argument is \catletter. + \afterfi{\@ifnextcat{a}{\gmd@finishifstar#1}{\finish@macroscan}}% \else% |#1| is not a~letter, so we have just scanned a~one-char % CS.\par % Another reasonable |\catcode|s assumption seems to be that the @@ -2901,39 +3069,52 @@ % trick to be sure that the char we write as the macro's name is % \catother. {\uccode`9=`#1% - \uppercase{\xdef\macro@iname{9}}% - }%\label{x123} + \uppercase{\xdef\macro@iname{9}}%\label{x474} + }% \quote@char#1% - \xdef\macro@iname{\maybe@quote\macro@iname}% + \xdef\macro@iname{\gmd@maybequote\macro@iname}% \xdef\macro@pname{\xiistring#1}%\label{stringing1} \afterfi \finish@macroscan \fi} -% This is the end\dots\ beautiful friend, the end\dots\ of -% |\scan@macro|'s |\def| the end\dots\ % The |\xiistring| macro, provided by \pk{gmutils}, is used instead of -% original |\string| because we wish to get the space \catother. +% original |\string| because we wish to get | |\catother (`other' space). % % \stanza % Now, let's explain some details, i.e., let's define them. We call % the following macro having known |#1| to be \catletter. -% \CodeDefIndex\continue@macroscan \def\continue@macroscan#1{% \quote@char#1% - \xdef\macro@iname{\macro@iname \maybe@quote#1}% - \xdef\macro@pname{\macro@pname \string#1}%\label{stringing2} - \@ifnextcat{a}{\continue@macroscan}{\finish@macroscan}% + \xdef\macro@iname{\macro@iname \gmd@maybequote#1}% + \xdef\macro@pname{\macro@pname \string#1}%\label{stringing2} we know + % \inverb*|#1| to be \catletter, so + % we don't need \inverb|\xiistring|. + \@ifnextcat{a}{\gmd@finishifstar#1}{\finish@macroscan}% } -% The |\@ifnextcat| macro is defined analogously to |\@ifnextchar| but -% the test done by it is not |\ifx| but |\ifcat|. (Note it would'nt +% As you may guess, |\@ifnextcat| is defined analogously to |\@ifnextchar| but +% the test it does is |\ifcat| (not |\ifx|). (Note it wouldn't % work for an active char as the `pattern'.) -% \CodeDefIndex\quote@char +%\stanza +% We treat the star specially since in usual \LaTeX\ it should finish +% the scanning of a~CS name---we want to avoid scanning +% |\command*argum| as one CS. + +\def\gmd@finishifstar#1{% + \if*\@nx#1\afterfi\finish@macroscan% note we protect |#1| against + % expansion. In \pk{gmdoc} verbatim scopes some chars are active + % (e.g. \inverb|\|\,). + \else\afterfi\continue@macroscan + \fi} + +% If someone \emph{really} uses |*| as a~letter please let me know. + \def\quote@char#1{{\uccode`9=`#1% at first I~took digit 1 for this % |\uccode|ing but then |#1| meant |#|\<\#1> in |\uppercase|'s % argument, of course. - \uppercase{% - \@ifismember 9\of \indexcontrols\glet\maybe@quote\quotechar% - \else\g@emptify\maybe@quote% - \fi}% + \uppercase{% \DefIndex\gmd@maybequote + \gmd@ifinmeaning 9\of \indexcontrols + {\glet\gmd@maybequote\quotechar}% + {\g@emptify\gmd@maybequote}% + }% }} % And now let's take care of the MakeIndex control characters. We'll @@ -2942,99 +3123,132 @@ % some special MakeIndex style and in such a~case to redefine the four % MakeIndex controls' macros. We enrich this list with the backslash % because sometimes MakeIndex didn't like it unquoted. -% \CodeDefine\indexcontrols +% \Define\indexcontrols % \changes{v0.98d}{06/9/15}{relativized to the index control macros: % previously the controls were given explicitly as the standard ones.} \AtBeginDocument{\xdef\indexcontrols{% \bslash\levelchar\encapchar\actualchar\quotechar}} - % \CodeDefine\@ifismember - \long\def \@ifismember#1\of#2{% - \long\def\in@@##1#1##2\in@@{% - \if\@nx^^A##2\@nx^^A\afterfi\gmd@@iffalse - \else\afterfi\gmd@@iftrue - \fi}% - \@xa\in@@#2#1\in@@}% - -% To hide the Booleans from \TeX\ in some contexts define -% \CodeDefine\gmd@@iftrue \CodeDefine\gmd@@iffalse -\def\gmd@@iftrue{\iftrue} -\def\gmd@@iffalse{\iffalse} -% A~try to |\let| instead of |\def| resulted with the `incomplete if' -% error: \TeX\ looks at the meanings not the names while counting -% |\if|s. - -% A~word of commentary. \docfm\ in another situation solves the -% problem of checking similar way, but a~little more complexely. On -% the other hand, \docfm 's solution is more general: here a~trouble -% may arise if the list begins with |^^A|. It seems little possible to -% me, though. Btw., this macro is used only for catching chars that are -% MakeIndex's controls so far. How does it work? + +\long\def \gmd@ifinmeaning#1\of#2#3#4{% explained in the text + % paragraph below. \changes{v0.99g}{2007/11/06}{made more elegant: + % \cs{if} changed to \cs{ifx} made four parameters and not expanding + % to an open \cs{iftrue/false}. Also renamed from \cs{@ifismember}} + \long\def\gmd@in@@##1#1##2\gmd@in@@{% + \ifx^^A##2^^A\afterfi{#4}% + \else\afterfi{#3}% + \fi}% + \@xa\gmd@in@@#2#1\gmd@in@@}% + +%^^A % To hide the Booleans from \TeX\ in some contexts define +%^^A \def\gmd@@iftrue{\iftrue} +%^^A \def\gmd@@iffalse{\iffalse} +%^^A \def\gmd@@fi{\fi} +%^^A % A~try to |\let| instead of |\def| resulted with the `incomplete if' +%^^A % error: \TeX\ looks at the meanings not the names while counting +%^^A % |\if|s. + +% This macro is used for catching chars that are +% MakeIndex's controls. How does it work? % % |\quote@char| sort of re|\catcode|s its argument through the % |\uccode| trick: assigns the argument as the uppercase code of the % digit 9 and does further work in the |\uppercase|'s scope so the % digit 9 (a~benchmark `other') is substituted by |#1| but the -% |\catcode| remains so thus the |\@ifismember| macro gets -% |\quote@char|'s |#1| `other'ed as the first argument. -% -% |\@ifismember| is defined to take two parameters separated by |\of|. -% In |\quote@char| the second argument for it is |\indexcontrols| -% defined as the (expanded) sequence of the MakeIndex controls. -% |\@ifismember| defines its inner macro |\in@@| to take two -% parameters separated by the first and the second |\@ifismember|'s -% parameter, which are here the char investigated by |\quote@char| and -% the |\indexcontrols| list. The inner macro's parameter string is -% delimited by the macro itself, why not. |\in@@| is put before -% a~string consisting of |\@ifismember|'s second and first parameters -% (in such a~reversed order) and |\in@@| itself. In such a~sequence it -% looks for something fitting its parameter pattern. |\in@@| is sure -% to find the parameters delimiter (|\in@@| itself) and the separator, +% |\catcode| remains so |\gmd@ifinmeaning| gets |\quote@char|'s |#1| +% `other'ed as the first argument. +% +% The meaning of the |\gmd@ifinmeaning| parameters is as follows: +%\begin{enumargs}^^B +%\item the token(s) whose presence we check, +%\item the macro in whose meaning we search |#1| (the first token of +% this argument is expanded one level with |\expandafter|), +%\item the `if found' stuff, +%\item the `if not found' stuff. +%\end{enumargs} +% +% In |\quote@char| the second argument for |\gmd@ifinmeaning| is +% |\indexcontrols| defined as the (expanded and `other') sequence of +% the MakeIndex controls. |\gmd@ifinmeaning| defines its inner macro +% |\gmd@in@@| to take two parameters separated by the first and the +% second |\gmd@ifinmeaning|'s parameter, which are here the char +% investigated by |\quote@char| and the |\indexcontrols| list. The +% inner macro's parameter string is delimited by the macro itself, why +% not. |\gmd@in@@| is put before a~string consisting of +% |\gmd@ifinmeaning|'s second and first parameters (in such a~reversed +% order) and |\gmd@in@@| itself. In such a~sequence it looks for +% something fitting its parameter pattern. |\gmd@in@@| is sure to find +% the parameters delimiter (|\gmd@in@@| itself) and the separator, % |\ifismember|'s |#1| i.e., the investigated char, because they are % just there. But the investigated char may be found not near the end, % where we put it, but among the MakeIndex controls' list. Then the % rest of this list and |\ifismember|'s |#1| put by us become the -% secong argument of |\in@@|. What |\in@@| does with its arguments, is -% just a~check whether the second one is empty. This may happen \emph{iff} -% the investigated char hasn't been found among the MakeIndex controls' -% list and then |\in@@| shall expand to |\iffalse|, otherwise it'll -% expand to |\iftrue|. (The |\after...| macros are employed not to -% (mis)match just got |\if...| with the test's |\fi|.) ``(Deep -% breath.) You got that?'' If not, try \docfm 's explanation of -% |\ifnot@excluded|, pp.\,36--37 of the v2.1b dated 2004/02/09 -% documentation, where a~similar construction is attributed to Michael -% Spivak. - -% \CodeDefIndex\finish@macroscan -\newcommand*\finish@macroscan{%\par - % We have the macro's name for indexing in |\macro@iname| and +% secong argument of |\gmd@in@@|. What |\gmd@in@@| does with its +% arguments, is just a~check whether the second one is empty. This may +% happen \emph{iff} the investigated char hasn't been found among the +% MakeIndex controls' list and then |\gmd@in@@| shall expand to +% |\iffalse|, otherwise it'll expand to |\iftrue|. (The |\after...| +% macros are employed not to (mis)match just got |\if...| with the +% test's |\fi|.) ``(Deep breath.) You got that?'' If not, try +% \docfm's explanation of |\ifnot@excluded|, pp.\,36--37 of the v2.1b +% dated 2004/02/09 documentation, where a~similar construction is +% attributed to Michael Spivak. +% +% Since version 0.99g |\gmd@ifinmeaning| is used also in testing +% whether a~detector is already present in the carrier in the +% mechanism of automatic detection of definitions (line \ref{550}). + +\newif\ifgmd@glosscs% we use this switch to keep the information +% whether a~history entry is a~CS or not. + +\newcommand*\finish@macroscan{%\label{506}\par + % First we check if the current CS is not just being defined. The + % switch may be set true in line \ref{519} + \ifgmd@adef@cshook% if so, we throw it into marginpar and index as + % a~def entry\dots + \@ifundefined{gmd/iexcl/\macro@pname}{% \dots\ if it's not excluded + % from indexing. + \@xa\Code@MarginizeMacro\@xa{\macro@pname}% + \@xa\@defentryze\@xa{\macro@pname}{1}}{}%% here we declare the kind of + % index entry and define |\last@defmark| used by \cs{changes} + \global\gmd@adef@cshookfalse% we falsify the hook that was set + % true just for this CS. + \fi + % We have the CS's name for indexing in |\macro@iname| and % for print in |\macro@pname|. So we index it. We do it a~bit % countercrank way because we wish to use more general indexing % macro. - \if\verbatimchar\macro@pname% it's important that |\verbatimchar| comes before the macro's - % name: when it was reverse, the |\tt| CS turned this test true - % and left the |\verbatimchar| what resulted with `|\+tt|' - % typeset. Note that this test should turn true iff the scanned - % macro name shows to be the default |\verb|'s delimiter. In such - % a~case we give |\verb| another delimiter, namely |$|: + \if\verbatimchar\macro@pname% \label{3039}it's important that |\verbatimchar| + % comes before the macro's name: when it was reverse, the |\tt| CS + % turned this test true and left the |\verbatimchar| what resulted + % with `|\+tt|' typeset. Note that this test should turn true iff + % the scanned macro name shows to be the default + % |\verb|'s delimiter. In such a~case we give + % |\verb| another delimiter, namely |$|: \def\im@firstpar{[$]}%^^A$ \else\def\im@firstpar{}\fi \@xa \index@macro\im@firstpar\macro@iname\macro@pname + % \label{3049} \maybe@marginpar\macro@pname \macro@pname - \gmd@charbychar + \let\next\gmd@charbychar + \gmd@detectors% \label{519} for automatic detection of + % definitions. Defined and + % explained in the next section. It redefines + % |\next| if detects a~definition command amd thus + % sets the switch of line \ref{506} true. + \next } % Now, the~macro that checks whether the just scanned macro should be % put into a~marginpar: it checks the meaning of a~very special CS: % whose name consists of |gmd/2marpar/| and of the examined macro's % name. -% \CodeDefIndex\maybe@marginpar \def\maybe@marginpar#1{% %^^A\ifx#1\mname@tomarginpar \@ifundefined{gmd/2marpar/#1}{}{% - \@xa\Text@Marginize\@xa{\bslash#1}% |\expandafter|s - % \possfil'cause the |\Text@Marginize| command applies |\string| to its - % argument. \nlpercent |\macro@pname|, which will be the only possible + \@xa\Text@Marginize\@xa{\bslash#1}% |\expandafter|s + % \possfil because the |\Text@Marginize| command applies |\string| to its + % argument. \inverb |\macro@pname|, which will be the only possible % argument to % \cs{may\+be\+@mar\+g\+in\+par}, % contains the macro's name @@ -3043,6 +3257,689 @@ \@xa\g@relaxen\csname gmd/2marpar/#1\endcsname% we reset the switch. }} +% Since version 0.99g we introduce automatic detection of definitions, +% it will be implemented in the next section. The details of indexing +% CSs are implemented in the section after it. +% +% \subdivision{Automatic detection of definitions} +% +% To begin with, let's introduce a~general declaration of a~defining +% command. |\DeclareDefining| comes in two flavours: `saut\eacute', +% and with star. The `saut\eacute' version without an optional +% argument declares a~defining command of the kind of |\def| and +% |\newcommand|: whether wrapped in braces or not, its main argument +% is a~CS. The star version without the optional argument declares +% a~defining command of the kind of |\newenvironment| and +% |\DeclareOption|: whose main mandatory argument is text. Both +% versions provide an optional argument in which you can set the keys. +% Probably the most important key is |star|. It determines whether the +% starred version of a~defining command should be taken into account. +% For example, |\newcommand| should be declared with |[star=true]| +% while |\def| with |[star=false]|. You can also write just |[star]| +% instead of |[star=true]|. It's the default if the |star| key is +% omitted. +% +% Another key is |type|. Its possible values are the (backslashless) +% names of the defining commands, see below. +% +% We provide now more keys for the \pk{xkeyval}ish definitions: +% |KVpref| (the key prefix) and |KVfam| (the key family). If not set by +% the user, they are assigned the default values as in \pk{xkeyval}: +% |KVpref| letters |KV| and |KVfam| the input file name. The latter +% assignment is done only for the |\DeclareOptionX| defining command +% because in other \pk{xkeyval} definitions (|\define@(...)key|) the +% family is mandatory. +% +%\stanza +% Let's make a~version of |\@ifstar| that would work with +% |*|\catletter. It's analogous to |\@ifstar|. +\foone{\catcode`\*=11 } + {\def\@ifstarl#1{\@ifnextchar *{\@firstoftwo{#1}}}} +% +% \subsubdivision{\cs{DeclareDefining} and the detectors} +% +% Note that the main argument of the next declaration should be a~CS +% \emph{without star}, unless you wish to declare only the starred +% version of a~command. The effect of this command is always global. +\outer\def\DeclareDefining{\begingroup + \MakePrivateLetters + \@ifstarl + {\gdef\gmd@adef@defaulttype{text}\Declare@Dfng}% + {\gdef\gmd@adef@defaulttype{cs}\Declare@Dfng}% +} + +% The keys except |star| depend of |\gmd@adef@currdef|, therefore we +% set them having known both arguments +\newcommand*\Declare@Dfng[2][]{% + \endgroup + \Declare@Dfng@inner{#1}{#2}% + \ifgmd@adef@star% this swith may be set false in first + % \inverb|\Declare@Dfng@inner| (it's the |star| key). + \Declare@Dfng@inner{#1}{#2*}% The catcode of |*| doesn't matter since + % it's in \inverb|\csname|\nlpercent\dots\inverb|\endcsname| + % everywhere. + \fi} + +% \Define\gmd@adef@currdef +\def\Declare@Dfng@inner#1#2{% + \edef\gmd@resa{% + \@nx\setkeys[gmd]{adef}{type=\gmd@adef@defaulttype}}% + \gmd@resa + {\escapechar\m@ne + \xdef\gmd@adef@currdef{\string#2}% + }% + \gmd@adef@setkeysdefault + \setkeys[gmd]{adef}{#1}% + \@xa\gmd@ifinmeaning + \csname gmd@detect@\gmd@adef@currdef\endcsname + % \label{550} + \of\gmd@detectors{}{% + \@xa\gaddtomacro\@xa\gmd@detectors\@xa{% + \csname gmd@detect@\gmd@adef@currdef\endcsname}}% we add a~CS\\ + % |%| |\gmd@detect@|\ (a~\textbf{detector})to the + % meaning of the \textbf{detectors' carrier}. And we define it to + % detect the \inverb|#2| command. + \@xa\xdef\csname gmd@detectname@\gmd@adef@currdef\endcsname{% + \gmd@adef@currdef}% + \edef\@tempa{% this |\edef| is to expand |\gmd@adef@TYPE|. + \global\@nx\@namedef{gmd@detect@\gmd@adef@currdef}{% + \@nx\ifx + \@xa\@nx\csname gmd@detectname@\gmd@adef@currdef\endcsname + \@nx\macro@pname + \@nx\n@melet{next}{gmd@adef@\gmd@adef@TYPE}% + \@nx\n@melet{gmd@adef@currdef}{gmd@detectname@\gmd@adef@currdef}% + \@nx\fi}}% + \@tempa + \SMglobal\StoreMacro*{gmd@detect@\gmd@adef@currdef}% we store the CS to + % allow its temporary discarding later. +} + + +\def\gmd@adef@setkeysdefault{% + \setkeys[gmd]{adef}{star,prefix,KVpref}} +% Note we don't set |KVfam|. We do not so because for +% |\define@key|-likes family is a~mandatory argument and for +% |\DeclareOptionX| the default family is set to the input file name +% in line \ref{defDOXfam}. + +\define@boolkey[gmd]{adef}{star}[true]{} + +% The |prefix@|\ keyvalue will be used to create additional +% index entry for detected definiendum (a~\textbf{definiendum} is the +% thing defined, e.g. in |\newenvironment{foo}| the env.\ \env{foo}). +% For instance, |\newcounter| is declared with |[prefix=\bslash c@]| +% in line \ref{newcounter} and therefore |\newcounter{foo}| occurring +% in the code will index both |foo| and |\c@foo| (as definition +% entries). \UnDef +\define@key[gmd]{adef}{prefix}[]{% + \edef\gmd@resa{% + \def\@xa\@nx\csname gmd@adef@prefix@\gmd@adef@currdef \endcsname{% + #1}}% + \gmd@resa} + + +\def\gmd@KVprefdefault{KV}% in a~separate macro because we'll need + % it in \cs{ifx}. + + +% A~macro |\gmd@adef@KVprefixset@|\ if defined, will falsify +% an \cs{ifnum} test that will decide whether create additional index +% entry together with the tests for |prefix|\ and +% \UnDef +\define@key[gmd]{adef}{KVpref}[\gmd@KVprefdefault]{% + \edef\gmd@resa{#1}% + \ifx\gmd@resa\gmd@KVprefdefault + \else + \@namedef{gmd@adef@KVprefixset@\gmd@adef@currdef}{1}% + \gmd@adef@setKV% whenever the |KVpref|fix is set (not default), the + % declared command is assumed to be \pk{keyval}ish. + \fi + \edef\gmd@resa{#1}% because |\gmd@adef@setKV| redefined it. + \edef\gmd@resa{% + \def\@xa\@nx\csname gmd@adef@KVpref@\gmd@adef@currdef\endcsname{% + \ifx\gmd@resa\empty + \else#1@\fi}}% as in \pk{xkeyval}, if the KV prefix is not + % empty, we add \inverb|@| to it. + \gmd@resa} + + +% Analogously to |KVpref|, |KVfam| declared in |\DeclareDefining| +% will override the family scanned from the code and, in +% |\DeclareOptionX| case, the default family which is the input file +% name (only for the command being declared). +\define@key[gmd]{adef}{KVfam}[]{% + \edef\gmd@resa{#1}% + \@namedef{gmd@adef@KVfamset@\gmd@adef@currdef}{1}% + \edef\gmd@resa{% + \def\@xa\@nx\csname gmd@adef@KVfam@\gmd@adef@currdef\endcsname{% + \ifx\gmd@resa\empty + \else#1@\fi}}% + \gmd@resa + \gmd@adef@setKV}% whenever the |KVfam|ily is set, the declared command is + % assumed to be \pk{keyval}ish. + + +\define@choicekey[gmd]{adef}{type} + [\gmd@adef@typevals\gmd@adef@typenr] + {% the list of possible types of defining commands + def, + newcommand, + cs,% equivalent to the two above, covers all the cases of defining + % a~CS, including the \PlainTeX\ \inverb|\new...| and + % \LaTeX\ |\newlength|. + newenvironment, + text,% equivalent to the one above, covers all the commands defining + % its first mandatory argument that should be text, + % \inverb|\DeclareOption| e.g. + define@key,% special case of more arguments important; covers the + % \pk{xkeyval} defining commands. + dk,% a~shorthand for the one above. + DeclareOptionX,% another case of special arguments configuration, + % covers the \pk{xkeyval} homonym. + dox,% a~shorthand for the one above. + kvo% one of option defining commands of the \pk{kvoptions} package + % by Heiko Oberdiek (a~package available o~CTAN in the + % \pk{oberdiek} bundle). + } + {% In fact we collapse all the types just to four so far: + \ifcase\gmd@adef@typenr% if |def| + \gmd@adef@settype{cs}{0}% + \or% when |newcommand| + \gmd@adef@settype{cs}{0}% + \or% when |cs| + \gmd@adef@settype{cs}{0}% + \or% when |newenvironment| + \gmd@adef@settype{text}{0}% + \or% when |text| + \gmd@adef@settype{text}{0}% + \or% when |define@key| + \gmd@adef@settype{dk}{1}% + \or% when |dk| + \gmd@adef@settype{dk}{1}% + \or% when |DeclareOptionX| + \gmd@adef@settype{dox}{1}% + \or% when |dox| + \gmd@adef@settype{dox}{1}% + \or% when |kvo| + \gmd@adef@settype{text}{1}%% The \pk{kvoptions} option + %% definitions take first mandatory + % argument as the option name and they define a~\pk{keyval} key + % whose macro's name begins with the prefix/family, either default or + % explicitly declared. The \pk{kvoptions} prefix/family is + % supported in \pk{gmdoc} with \inverb|[KVpref=, KVfam=|\|]|. + \fi} + +\def\gmd@adef@settype#1#2{% + \def\gmd@adef@TYPE{#1}% + \ifnum1=#2 % now we define (or not) a~quasi-switch that fires for + % the \pk{keyval}ish definition commands. + \gmd@adef@setKV + \fi} + +\def\gmd@adef@setKV{% + \edef\gmd@resa{% + \def\@xa\@nx\csname gmd@adef@KV@\gmd@adef@currdef\endcsname{1}% + }% + \gmd@resa} + + +% We initialize the carrier of detectors: +\emptify\gmd@detectors + + +% The definiendum of a~command of the |cs| type is the next control +% sequence. Therefore we only need a~self-relaxing hook in +% |\finish@macroscan|. +\newif\ifgmd@adef@cshook + +\def\gmd@adef@cs{\global\gmd@adef@cshooktrue\gmd@charbychar} + +% For other kinds of definitions we'll employ active chars of their +% arguments' opening braces, brackets and seargants. In \pk{gmdoc} +% code layer scopes the left brace is active so we only add a~hook to +% its meaning (see line \ref{gm@lbracehook} in \pk{gmverb}) and \ref and here +% we switch it according to the type of detected definition. + +\def\gmd@adef@text{\gdef\gmd@lbracecase{1}\gmd@charbychar} + +\foone{% + \catcode`\[\active + % ^^A>\] + \catcode`\<\active} +{%\par + % The detector of \pk{xkeyval} |\define@(...)key|: + \def\gmd@adef@dk{% + \let[\gmd@adef@scanKVpref + \catcode`\[\active + % ^^A\]] + \gdef\gmd@lbracecase{2}% + \gmd@adef@dfKVpref\gmd@KVprefdefault% We set the default value of + % the \pk{xkeyval} prefix. Each time again because an assignment + % in \inverb|\gmd@adef@dfKVpref| is global. + \gmd@adef@checklbracket} + + % The detector of \pk{xkeyval} |\DeclareOptionX|: + \def\gmd@adef@dox{% + \let[\gmd@adef@scanKVpref + \let<\gmd@adef@scanDOXfam + \catcode`[\active + % ^^A]] + \catcode`<\active + \gdef\gmd@lbracecase{1}% + \gmd@adef@dfKVpref\gmd@KVprefdefault% We set the default values of + % the \pk{xkeyval} prefix\dots + \edef\gmd@adef@fam{\gmd@inputname}% \dots\ and family. + \gmd@adef@dofam + % \label{defDOXfam} + \gmd@adef@checkDOXopts}% +} + +% The case when the right bracket is next to us is special because it +% is already touched by |\futurelet| (of CSs scanning macro's +% \cs{@ifnextcat}), therefore we need a~`future' test. +\def\gmd@adef@checklbracket{% + \@ifnextchar[{\gmd@adef@scanKVpref}\gmd@charbychar}% note that +% the prefix scanning macro gobbles its first argument (undelimited) +% which in this case is |[|. +%^^A]]} + +% After a~|\DeclareOptionX|-like defining command not only the prefix +% in square brackets may occur but also the family in +% seargants. Therefore we have to test presence of both of them. +\def\gmd@adef@checkDOXopts{% + \@ifnextchar[{\gmd@adef@scanKVpref}%^^A}] + {\@ifnextchar<{\gmd@adef@scanDOXfam}\gmd@charbychar}} + + +%^^A[ +\def\gmd@adef@scanKVpref#1#2]{% + \gmd@adef@dfKVpref{#2}% + [#2]\gmd@charbychar} + + +\def\gmd@adef@dfKVpref#1{% + \ifnum1=0\csname gmd@adef@KVprefixset@\gmd@adef@currdef\endcsname + \relax + \else + \edef\gmu@resa{% + \gdef\@xa\@nx + \csname gmd@adef@KVpref@\gmd@adef@currdef\endcsname{% + \ifx\relax#1\relax + \else#1@% + \fi}}% + \gmu@resa + \fi} + + +\def\gmd@adef@scanDOXfam{% + \ifnum12=\catcode`\>\relax + \let\next\gmd@adef@scanfamoth + \else + \ifnum13=\catcode`\>\relax + \let\next\gmd@adef@scanfamact + \else + \PackageError{gmdoc}{> neither `other' nor `active'! Make it + `other' with \bslash AddtoPrivateOthers\bslash\>.}% + \fi + \fi + \next} + +\def\gmd@adef@scanfamoth#1>{% + \edef\gmd@adef@fam{\@gobble#1}% there is always + % \cs{gmd@charbychar} first. + \gmd@adef@dofam + <\gmd@adef@fam>% + \gmd@charbychar} + +\foone{\catcode`\>\active} + {\def\gmd@adef@scanfamact#1>{% + \edef\gmd@adef@fam{\@gobble#1}% there is always + % \cs{gmd@charbychar} first. + \gmd@adef@dofam + <\gmd@adef@fam>% + \gmd@charbychar}% + } + + +% The hook of the left brace consists of \cs{ifcase} that logically +% consists of three subcases: +% \begin{itemize}^^B +% \item [0]---the default: do nothing in particular; +% \item [1]---the detected defining command has one mandatory +% argument (is of the |text| type, including \pk{kvoptions} option definition); +% \item [2--3]---we are after detection of a~|\define@key|-like command +% so we have to scan \emph{two} mandatory arguments (case 2 is for +% the family, case 3 for the key name). +% \end{itemize} +% +% +\def\gm@lbracehook{% + \ifcase\gmd@lbracecase\relax + \or% when 1 + \afterfi{% + \gdef\gmd@lbracecase{0}% + \gmd@adef@scanname}% + \or% when 2---the first mandatory argument of two (|\define@(...)key|) + \afterfi{% + \gdef\gmd@lbracecase{3}% + \gmd@adef@scanDKfam}% + \or% when 3---the second mandatory argument of two (the key name). + \afterfi{% + \gdef\gmd@lbracecase{0}% + \gmd@adef@scanname}% + \fi} + +\def\gmd@lbracecase{0}% we initialize the hook caser. + + +% And we define the inner left brace macros: + +\foone{\catcode`\[1 \catcode`\]2 \catcode`\}12 } + [% Note that till line \ref{738} the square brackets are grouping + % and the right brace is `other'. ^^A{ +%\par Define the macro that reads and processes the |\define@key| +%family argument. It has the parameter delimited with `other' right +%brace. An active left brace that has launched this macro had been +%passed through iterating |\gmd@charbychar| that now stands next right +%to us. + \def\gmd@adef@scanDKfam#1}[%^^A{ + \edef\gmd@adef@fam[\@gobble#1]% there is always + % \cs{gmd@charbychar} first. + \gmd@adef@dofam + \gmd@adef@fam}% + \gmd@charbychar] + + % ^^A{ + \def\gmd@adef@scanname#1}[%^^A{ + \@makeother\[%^^A\] + \@makeother\<% + % The scanned name begins with |\gmd@charbychar|, we have to be + % careful. + \gmd@adef@deftext[#1]% + \@gobble#1}% + \gmd@charbychar] + ] + + +\def\gmd@adef@dofam{% + \ifnum1=0\csname gmd@adef@KVfamset@\gmd@adef@currdef\endcsname + \relax% a~family declared with |\DeclareDefining| overrides the + % one currently scanned. + \else + \edef\gmu@resa{% + \gdef\@xa\@nx + \csname gmd@adef@KVfam@\gmd@adef@currdef\endcsname + {\ifx\gmd@adef@fam\empty + \else\gmd@adef@fam @% + \fi}}% + \gmu@resa + \fi} + +\def\gmd@adef@deftext#1{% + \edef\macro@pname{\@gobble#1}% we gobble |\gmd@charbychar|, cf. above. + \@xa\Text@Marginize\@xa{\macro@pname}% + \gmd@adef@indextext + \edef\gmd@adef@altindex{% + \csname gmd@adef@prefix@\gmd@adef@currdef \endcsname}% + %\hskip-\parindent and we add the \pk{xkeyval} header if we are in \pk{xkeyval} + % definition. + \ifnum1=0\csname gmd@adef@KV@\gmd@adef@currdef \endcsname\relax% The\\ CS + % \inverb|\gmd@adef@KV@|\ is defined |{1}| (so \cs{ifnum} + % gets |1=01\relax|---\hskip0sptrue) iff \ is a~\pk{keyval} + % definition. In that case we check for the \inverb|KVpref|ix and + % \inverb|KVfam|ily. (Otherwise |\gmd@adef@KV@|\ is undefined + % so \cs{ifnum} gets |1=0\relax|---false.) + \edef\gmd@adef@altindex{% + \gmd@adef@altindex + \csname gmd@adef@KVpref@\gmd@adef@currdef \endcsname}% + \edef\gmd@adef@altindex{% + \gmd@adef@altindex + \csname gmd@adef@KVfam@\gmd@adef@currdef \endcsname}% + \fi + \ifx\gmd@adef@altindex\empty + \else% we make another index entry of the definiendum with prefix/KVheader. + \edef\macro@pname{\gmd@adef@altindex\macro@pname}% + \gmd@adef@indextext + \fi} + +\def\gmd@adef@indextext{% + \@xa\@defentryze\@xa{\macro@pname}{0}% declare the definiendum has to + % have a~definition entry and in the changes history should appear + % without backslash. + \gmd@doindexingtext% redefine |\do| to an indexing macro. +% \label{gmd@doindexingtext 2nd use} + \@xa\do\@xa{\macro@pname}} + + +%^^A %\iffalse if we decided to manage \verbatimchar +%^^A \iffalse +%^^A \if\verbatimchar\macro@pname% cf. lines \ref{3039}--\ref{3049} +%^^A \def\im@firstpar{[$]}%^^A$ +%^^A \else\def\im@firstpar{}% +%^^A \fi +%^^A \@xa \index@macro\im@firstpar\macro@iname\macro@pname +%^^A \fi +%^^A %\fi +%^^A % +% \stanza + +% So we have implemented automatic detection of definitions. Let's now +% introduce some. +% +% \subsubdivision{Default defining commands} + +% Some commands are easy to declare as defining: +% \HideAllDefining +% \DeclareDefining\DeclareDefining + +%^^A\DeclareDefining[type=dox, star=false]\def +\DeclareDefining[star=false]\def +%^^A\show\gmd@detectors + +% \ResumeAllDefining But |\def| definitely \emph{not always} defines +% an important macro. Sometimes it's just a~scratch assignment. +% Therefore we define the next declaration. It turns the next +% occurence of |\def| off (only the next one). + +\def\UnDef{% + \gdef\gmd@detect@def{% + \ifx\gmd@detectname@def\macro@pname + \def\next{\SMglobal\RestoreMacro\gmd@detect@def}% ^^A we define + % ^^A \inverb|\next| not restore the macro here just in case of + % ^^A multiple declaration of |\def| (in that case there would be + % ^^A multiple occurences of the macro to be restored in the carrier + % ^^A \inverb|\gmd@detectors| and we wish + % ^^A all of them not to fire this one time) That's probably too + % ^^A much care since there's the test in line \ref{550}. + \fi}% + } + +\StoreMacro\UnDef% because the `hiding' commands relax it. + +\def\HideDef{\HideDefining\def\relaxen\UnDef} + +\def\ResumeDef{\ResumeDefining\def\RestoreMacro\UnDef} + + +% Note that I~\emph{don't} declare |\gdef|, |\edef| neither +% |\xdef|. In my opinion their use as `real' definition is very rare +% and then you may use |\Define| implemented later. +% \HideAllDefining \DeclareDefining\DeclareDefining +\DeclareDefining[star=false]\newcount +\DeclareDefining[star=false]\newdimen +\DeclareDefining[star=false]\newskip +\DeclareDefining[star=false]\newif +\DeclareDefining[star=false]\newtoks +\DeclareDefining[star=false]\newbox +\DeclareDefining[star=false]\newread +\DeclareDefining[star=false]\newwrite +\DeclareDefining[star=false]\newlength + +\DeclareDefining\newcommand +\DeclareDefining\renewcommand +\DeclareDefining\providecommand +\DeclareDefining\DeclareRobustCommand +\DeclareDefining\DeclareTextCommand +\DeclareDefining\DeclareTextCommandDefault + +\DeclareDefining*\newenvironment +\DeclareDefining*\renewenvironment +\DeclareDefining*\DeclareOption +%|%\DeclareDefining*\@namedef| + +% \HideDefining\DeclareDefining +% \DeclareDefining\bslash + +\DeclareDefining*[prefix=\bslash c@]\newcounter% \label{newcounter} +% this prefix provides indexing also |\c@|\. + +\DeclareDefining[type=dk, prefix=\bslash]\define@key +\DeclareDefining[type=dk, prefix=\bslash if]\define@boolkey% the + % alternate index entry will be + % \cs{if}\|@|\|@|\ +\DeclareDefining[type=dk, prefix=\bslash]\define@choicekey + +\DeclareDefining[type=dox, prefix=\bslash]\DeclareOptionX% the +% alternate index entry will be \cs{}\|@|\|@|\ -%%<+ist>delim_0 "\\pfill " -%%<+ist>delim_1 "\\pfill "2 -%%<+ist>delim_2 "\\pfill " -%%<*package> -%\end{verbatim} -% % skipped definitions of dotted fills\fi -% +%^^A% % \iffalse +%^^A%% % \begin{quotation} +%^^A%% % The following definitions provide the |\pfill| command; if this is +%^^A%% % specified in the index style file to MakeIndex as the delimiter to +%^^A%% % appear after index items, then the intervening space before the +%^^A%% % referenced page numbers will be filled with dots, with a little +%^^A%% % white space interpolated at each end of the dots. If the line is +%^^A%% % broken the dots will show up on both lines.\end{quotation} +%^^A%% \def\dotfill{\leaders\hbox to.6em{\hss .\hss}\hskip\z@ plus 1fill}% +%^^A%% \def\dotfil{\leaders\hbox to.6em{\hss .\hss}\hfil}% +%^^A%% \def\pfill{\unskip~\dotfill\penalty500\strut\nobreak +%^^A%% \dotfil~\ignorespaces}% +%^^A%%% +%^^A%%%\begin{verbatim} +%^^A%%% +%^^A%%%<+ist>delim_0 "\\pfill " +%^^A%%%<+ist>delim_1 "\\pfill "2 +%^^A%%%<+ist>delim_2 "\\pfill " +%^^A%%%<*package> +%^^A%%\end{verbatim} +%^^A%% % skipped definitions of dotted fills\fi % % \subdivision{The Checksum} % @@ -4753,13 +5599,13 @@ % on the terminal) % whether you have typed the right number. If you don't type |\CheckSum|, % \TeX\ anyway will tell you how much it is. -% \CodeDefine\check@sum \CodeDefine\CheckSum \newcount\check@sum + \def\CheckSum#1{\@bsphack\global\check@sum#1\relax\@esphack} -% \CodeDefine*{CheckSum} \CodeDefIndex*\c@CheckSum + \newcounter{CheckSum} % \label{checksum} -% \CodeDefIndex\step@checksum + \newcommand*\step@checksum{\stepcounter{CheckSum}} % And we'll use it in the line \ref{checksumUse} (|\stepcounter| is % |\global|). See also the |\chschange| declaration, @@ -4778,7 +5624,7 @@ % a~check sum % is not necessary for checking the completness of a~file but % I~like it as a~marker of file development and this more than -% that is its r\^ole in \gmdoc.} +% that is its r\ocircum le in \gmdoc.} % \end{StraightEOL} % % @@ -4790,7 +5636,6 @@ \AtEndInput{\check@checksum} % Based on the lines 723--741 of \pk{doc.dtx}. -% \CodeDefine\check@checksum \def\check@checksum{\relax \ifnum\check@sum=\z@ \typeout{**********************************}% @@ -4823,22 +5668,21 @@ % growth. Therefore I~provide a~macro that produces a~line on the % terminal to be put somewhere at the % beginning of the source file's commentary for instance. -% \CodeDefIndex\gmd@chschangeline \def\gmd@chschangeline{% - \typeout{\twelvepercent\space\string\chschange{% + \typeout{\xiipercent\space\string\chschange{% \fileversion}{\the\year/\the\month/\the\day}{\the\c@CheckSum}} - \typeout{\twelvepercent\space\string\chschange{\fileversion}{% + \typeout{\xiipercent\space\string\chschange{\fileversion}{% \@xa\@gobbletwo\the\year/\the\month/\the\day}{%\relax % with two di\-g\-it year in case you use |\ChangesStart|. \the\c@CheckSum}}} % And here the meaning of such a~line is defined: \newcommand*\chschange[3]{%\label{chschange} - \csname changes\endcsname{#1}{#2}{CheckSum #3}% |\csname...| 'cause - % \nlpercent\cs{cha\+n\+g\+es} is \nlpercent|\outer|. + \csname changes\endcsname{#1}{#2}{CheckSum #3}% |\csname...| because + % \nlpercent\cs{cha\+n\+g\+es} is \inverb|\outer|. \CheckSum{#3}} % It will make a~`General' entry in the change history unless -% used in some |\CodeDefine|'s scope or inside a~\env{macro} +% used in some |\Define|'s scope or inside a~\env{macro} % environment. It's intended to be put % somewhere at the beginning of the documented file. % @@ -4858,7 +5702,6 @@ % % The next page setup declaration is intended to be used % with the \pk{article}'s default Letter paper size. But since -% \CodeDefine\ltxPageLayout \newcommand*\ltxPageLayout{% %\begin{quotation}Increase the text width slightly so that width the standard fonts % 72 columns of code may appear in a |macrocode| environment.\end{quotation} @@ -4908,23 +5751,21 @@ % % \changes{v0.98}{06/09/05}{\cs{@makeother\protect\bslash_} added} \newcommand*\DocInclude{\bgroup\@makeother\_\Doc@Include}% First, we -% make \nlpercent|_| `other' in order to allow it in the filenames. +% make \inverb|_| `other' in order to allow it in the filenames. -% \CodeDefine\Doc@Include \newcommand*{\Doc@Include}[2][]{% originally it took just one % argument. Here we make it take two, first of which is intended to - % be the path (with the closing \nlpercent |/|). This is intended not to print + % be the path (with the closing \inverb |/|). This is intended not to print % the path in the page footers only the filename.\par - % \CodeUsage\HLPrefix \CodeDefine\EntryPrefix + % \CodeUsage\HLPrefix \egroup% having the arguments read, we close the group opened by the % previous macro for |_|\catother. \gdef\HLPrefix{\filesep}% \gdef\EntryPrefix{\filesep}% we define two rather kernel parameters % to expand to the file marker. The first will bring the information - % to one of the default \nlpercent|\IndexPrologue|'s + % to one of the default \inverb|\IndexPrologue|'s % |\if|s. Therefore the % definition is global. The latter is such for symmetry. - % \CodeDefine\GeneralName \def\GeneralName{#2\actualchar\pk{#2} }% \label{GeneralName} for the % changes'history main level entry. \relax @@ -4955,7 +5796,6 @@ \else \@docinclude{#1}#2 \fi}% Why is |#2| delimited with | | not % braced as we are used to, one may ask. -% \CodeDefine\@docinclude % \changes[\DocInclude]{v0.97}{06/09/03}{\cs{@docinclude} gets 2 params % in order to \cs{includeonly} work as expected, with only the names % (w.o. the paths)} @@ -5017,7 +5857,6 @@ % \end{macro} % % (Two is a~sufficient number of iterations to define a~macro for.) -% \CodeDefine\xdef@filekey \def\xdef@filekey{{\@relaxen\ttfamily% \label{LetTTFRelax}This % assignment is very trickly crafted: it makes \emph{all} % |\ttfamily|s present in the |\filekey|'s expansion unexpandable @@ -5027,7 +5866,7 @@ % To allow |_| in the filenames we must assure |_| will be \catother\ % while reading the filename. Therefore define -% \CodeDefIndex\gmd@writemauxinpaux +% \DefIndex\gmd@writemauxinpaux \def\gmd@writemauxinpaux#1{% \label{gmd@writemauxinpaux} % this name comes from `\emph{write} outto \emph main % \emph{\pk{.aux}} to \emph{in}put \emph partial @@ -5049,7 +5888,7 @@ % allow |_| in the file name. % \changes[\DocInclude]{v0.98a}{06/09/06}{\cs{@writeckpt} wrapped % with \cs{firstofone} hack to allow \cs[]{_} in the file names.} -% \CodeDefIndex\gmd@writeckpt +% \DefIndex\gmd@writeckpt \def\gmd@writeckpt#1{% \immediate\write\@partaux{% \string\bgroup\string\@makeother\string\_% @@ -5057,7 +5896,6 @@ \@writeckpt{#1}% \immediate\write\@partaux{\@charrb}} -%\CodeDefine\gmd@doIndexRelated \def\gmd@doIndexRelated{% \do\tableofcontents \do\makeindex \do\EnableCrossrefs \do\PrintIndex \do\printindex \do\RecordChanges \do\PrintChanges @@ -5067,7 +5905,7 @@ \@emptify\filesep % The \pk{ltxdoc} class establishes a~special number format for % multiple file documentation numbering needed to document the \LaTeX\ -% sources. I~like it too, so\CodeDefine\aalph \CodeDefine\@aalph +% sources. I~like it too, so \def\aalph#1{\@aalph{\csname c@#1\endcsname}} \def\@aalph#1{% \ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or @@ -5078,7 +5916,6 @@ X\or Y\or Z\else\@ctrerr\fi} % A~macro that initialises things for |\DocInclude|. -% \CodeDefine\docincludeaux \def\docincludeaux{% % We set the things for including the files only once. \global\@relaxen\docincludeaux @@ -5146,22 +5983,24 @@ % redefine the name of the proper division to `File'. \ifx\filediv\section \let\division=\subsection - \let\subdivision=\subsubsection% If |\filediv| is higher than - % |\section| we don't change the two divisions (they are - % |\section| and |\subsection| by default). |\section| seems - % to me the lowest reasonable sectioning command for the file. If - % |\filediv| is lower you should rather rethink the level of - % a~file in your documentation not redefine the two divisions. + \let\subdivision=\subsubsection + \let\subsubdivision=\paragraph + % If |\filediv| is higher than + % |\section| we don't change the three divisions (they are + % |\section|, |\subsection| and |\subsubsection| by default). + % |\section| seems to me the lowest reasonable sectioning command + % for the file. If |\filediv| is lower you should rather rethink + % the level of a~file in your documentation not redefine the two + % divisions. \fi}% end of |\docincludeaux|. % The |\filediv| and |\filedivname| macros should always be set % together. Therefore provide a~macro that takes care of both at % once. Its |#1| should be a~sectioning name without the backslash. -% \CodeDefine\SetFileDiv -% \changes{v0.98c}{06/9/10}{added and a~bug fixed in \cs{docincludeaux}} \def\SetFileDiv#1{% \edef\filedivname{#1}% \@xa\let\@xa\filediv\csname#1\endcsname} +% \changes{v0.98c}{06/9/10}{added and a~bug fixed in \cs{docincludeaux}} % \subdivision{\cs{SelfInclude}} % @@ -5171,16 +6010,15 @@ % We define it immediately i.e., % without the |\catcode|s trick because it uses |\jobname| inside so % the filename will be all \catother\ anyway. -% \CodeDefine\SelfInclude -% \changes{v0.98a}{06/09/06}{added in response to the needs} \newcommand*{\SelfInclude}[2][.tex]{% As you guess, the optional |#1| % is the jobname's extension. The second parameter is \emph{not} for % the filename (note \emph{it's known:} as |\jobname|!), but % \emph{for the stuff to be put at begin input.} + % \changes{v0.98a}{06/09/06}{added in response to the needs} \AtBegInputOnce{#2}% \gdef\HLPrefix{\filesep}% \gdef\EntryPrefix{\filesep}% we define two rather kernel parameters - % etc.\ as in \nlpercent|\DocInclude|. + % etc.\ as in \inverb|\DocInclude|. \relax %^^A\if@ltxDocInclude \clearpage @@ -5199,7 +6037,7 @@ % particular case |\string\jobname| would do, but anyway we % provide a~more general solution. Note the \pk{.auxx} extension % used instead of \pk{.aux}. This is done to avoid an infinite - % recurrence of \nlpercent|\input|s. + % recurrence of \inverb|\input|s. \fi \@tempswatrue \if@partsw \@tempswafalse\edef\@tempb{\jobname}% @@ -5250,9 +6088,6 @@ % \pk{gmdocc.cls} e.g.), so we put % those preparations into a~declaration. % -% \CodeDefine\ltxLookSetup -% \CodeDefIndex\if@ltxDocInclude \CodeDefIndex*\@ltxDocIncludetrue -% \CodeDefIndex*\@ltxDocIncludefalse \newif\if@ltxDocInclude \newcommand*\ltxLookSetup{% @@ -5270,29 +6105,27 @@ \@emptify\currentfile% for the pages outside the % |\DocInclude|'s scope. In force for all includes. % -% \iffalse -% % \stanza -% % But it may be not a~usual situation to include the source files -% % as with \pk{ltxdoc} but with the \emph{new} |\DocInput| macro. So -% % let's |\def| -% % \CodeDefine\ltxMultidocOldSetup -% \newcommand*\ltxMultidocOldSetup{% -% \ltxMultidocSetup -% \let\incl@DocInput=\OldDocInput} -% -% \@onlypreamble\ltxMultidocOldSetup -% -% And, for the symmetry, if you prefer the look offered by -% me, but -% \fi +%^^A \iffalse +%^^A % \stanza +%^^A % But it may be not a~usual situation to include the source files +%^^A % as with \pk{ltxdoc} but with the \emph{new} |\DocInput| macro. So +%^^A % let's |\def| +%^^A % \Define\ltxMultidocOldSetup +%^^A \newcommand*\ltxMultidocOldSetup{% +%^^A \ltxMultidocSetup +%^^A \let\incl@DocInput=\OldDocInput} +%^^A +%^^A \@onlypreamble\ltxMultidocOldSetup +%^^A +%^^A And, for the symmetry, if you prefer the look offered by +%^^A me, but +%^^A \fi % If you want to |\Doc/SelfInclude| \docfm-likes: -% \CodeDefine\olddocIncludes \newcommand*\olddocIncludes{% \let\incl@DocInput=\OldDocInput} % And, if you have set the previous and want to set it back: -% \CodeDefine\gmdocIncludes \newcommand*\gmdocIncludes{% \let\incl@DocInput=\DocInput \AtBegInput{\QueerEOL}}% to move back the |\StraightEOL| declaration put @@ -5313,8 +6146,7 @@ % any earlier such setting!\end{quotation} % But here in \pk{gmdoc} we'll do it locally for (each) input % not to change the main title settings if there are any. -% \CodeDefine\maketitle -\AtBegInput{% +\AtBegInput{%^^A~ why provide not just \cs{def}? \providecommand*\maketitle{\par \begingroup \def \thefootnote {\fnsymbol {footnote}}% \setcounter {footnote}\z@ @@ -5346,7 +6178,6 @@ % without it at \TeX ing with \pk{mwbk.cls} because this class with the % default options does not define |\@maketitle|. The below definitions % are taken from \pk{report.cls} and \pk{mwrep.cls}. - % \CodeDefine\@maketitle \providecommand*\@maketitle{% \newpage\null \vskip 2em\relax% \begin{center}% @@ -5365,21 +6196,18 @@ % We'd better restore the primary meanings of the macros making % a~title. (\LaTeXe\ source, File F: ltsect.dtx Date: 1996/12/20 Version % v1.0z, lines 3.5.7.9--12.14--17.) - % \CodeDefine\title \CodeDefine\author \CodeDefine\date - % \CodeDefine\thanks \providecommand*\title[1]{\gdef\@title{#1}} \providecommand*\author[1]{\gdef\@author{#1}} \providecommand*\date[1]{\gdef\@date{#1}} \providecommand*\thanks[1]{\footnotemark \protected@xdef\@thanks{\@thanks \protect\footnotetext[\the\c@footnote]{#1}}% - }%\CodeDefIndex\and + }% \providecommand*\and{%| % \begin{tabular}| \end{tabular}% \hskip 1em \@plus.17fil% \begin{tabular}[t]{c}}%| % \end{tabular}| % And finally, let's initialize \cs{tit\+le\+set\+up} if it is not yet. - % \CodeDefine\titlesetup \providecommand*\titlesetup{}% }% end of |\AtBegInput|. % @@ -5404,17 +6232,16 @@ % Now, we redefine |\maketitle| and its relatives. % -% \CodeDefine\InclMaketitle -% \changes{v0.98a}{06/09/05}{renamed from \cs{incl@maketitle} 'cause -% I~needed it in self-input hacks.} -\def\InclMaketitle{%\par\CodeDefIndex\and +\def\InclMaketitle{% + % \changes{v0.98a}{06/09/05}{renamed from \cs{incl@maketitle} because + % I~needed it in self-input hacks.} {\def\and{, }% we make |\and| just a~comma. {\let\thanks=\@gobble% for the toc version of the heading we % discard |\thanks|.\tOnLine \protected@xdef\incl@titletotoc{\@title\if@fshda\protect\space (\@author)\fi}% we add the author iff the `files have % different authors' \nlpercent(|@fshda|) - }% \CodeDefine\thanks + }% \def\thanks##1{\footnotemark \protected@xdef\@thanks{\@thanks% to keep the previous |\thanks| % if there were any. @@ -5462,11 +6289,8 @@ % multi-documented files have the same author(s). % And with the account of the other possibility I~provide % the below switch and declaration. -% -% \CodeDefIndex\if@fshda -% \CodeDefIndex*\@fshdatrue -% \CodeDefIndex*\@fshdafalse -% \CodeDefine\PrintFilesAuthors + + \newif\if@fshda % \label{@fshda} (its name comes from \textit file\textit s % \textit have \textit different \textit authors). @@ -5481,7 +6305,6 @@ % Define |\filedate| and friends from info in the % |\ProvidesPackage| etc.\ commands. -% \CodeDefine\GetFileInfo \def\GetFileInfo#1{% \def\filename{#1}% \def\@tempb##1 ##2 ##3\relax##4\relax{% @@ -5500,14 +6323,12 @@ % action but we remain strictly \TeX nical and do it with writing to % a~file and inputting that file. -%\CodeDefine\FileInfo -% \changes{v0.99d}{2007/04/26}{added} - \newcommand*\FileInfo{% \bgroup \let\do\@makeother \do\ \do\{\do\}\do\^^M\do\\% \gmd@fileinfo} +% \changes{v0.99d}{2007/04/26}{added} \bgroup \catcode`!\z@ @@ -5525,19 +6346,17 @@ >% \CodeEscapeChar\\ > -% \CodeDefine\gmd@writeFI \def\gmd@writeFI#1#2#3{% \immediate\write\@auxout{% \global\@nx\@namedef{% ver@#2.\if P\@firstofmany#1\@@nil sty\else cls\fi}{#3}}} -% \CodeDefine\gmd@docrescan \def\gmd@docrescan#1{% \newwrite\gmd@docrescanfile \immediate\openout\gmd@docrescanfile=\jobname.docrescan\relax {\newlinechar=`\^^M% \immediate\write\gmd@docrescanfile{% - \twelvepercent#1\twelvepercent\@nx\NoEOF}% + \xiipercent#1\xiipercent\@nx\NoEOF}% }% \immediate\closeout\gmd@docrescanfile \@@input\jobname.docrescan @@ -5548,16 +6367,16 @@ % a~macro for explicit providing the file % info. It's written in analogy to |\ProvidesFile|, \pk{source ^^B % 2${}_\epsilon$}, file L v1.1g, l.\,102. -% \CodeDefine\ProvideFileInfo -% \changes{v0.98a}{06/09/06}{added} + \def\ProvideFileInfo#1{% \begingroup \catcode`\ 10 \catcode\endlinechar 10 % \@makeother\/\@makeother\&% \kernel@ifnextchar[{\gmd@providefii{#1}}{\gmd@providefii{#1}[]}%^^A] } +% \changes{v0.98a}{06/09/06}{added} - % \CodeDefIndex\gmd@providefii + % \DefIndex\gmd@providefii \def\gmd@providefii#1[#2]{%\\ % (we \emph{don't} write the file info to \pk{.log}) \@xa\xdef\csname ver@#1\endcsname{#2}% @@ -5565,15 +6384,12 @@ % And a~self-reference abbreviation (intended for providing file info % for the driver): -% \CodeDefine\ProvideSelfInfo \def\ProvideSelfInfo{\ProvideFileInfo{\jobname.tex}} % A~neat conventional statement used in \docfm's documentation e.g., % to be put in |\thanks| to the title or in a~footnote: -% \CodeDefine\filenote \newcommand*\filenote{This file has version number \fileversion{} dated \filedate{}.} % And exactly as |\thanks|: -% \CodeDefine\thfileinfo \newcommand*\thfileinfo{\thanks\filenote} @@ -5585,18 +6401,18 @@ % another one in \docfm\ and it looks very reasonably: % \gmhypertarget[IndexInput]{\cs{IndexInput}}. Let's make analogous one % here: -% \CodeDefine\IndexInput -% \changes{v0.98b}{06/09/07}{\cs{StoreMacro}ing and \cs{RestoreMacro}ing -% \cs{code@delim} added} -\bgroup\obeylines -\firstofone{\egroup - \def\IndexInput#1{% +\foone{\obeylines}% +{% + \def\IndexInput#1{% \changes{v0.98b}{06/09/07}{\cs{StoreMacro}ing + %% and \cs{RestoreMacro}ing + % \cs{code@delim} added} \StoreMacro\code@delim% - \CodeDelim*\^^Z% + \CodeDelim\^^Z% \def\gmd@iihook{% \label{iihook}this hook is |\edef|ed! \@nx^^M% \code@delim\relax\@nx\let\@nx\EOFMark\relax}%^^A\@nx^^M - \DocInput{#1}\RestoreMacro\code@delim}} + \DocInput{#1}\RestoreMacro\code@delim}% +} % How does it work? We assume in the input file is no explicit % \. This char is chosen as the code delimiter and will be put % at the end of input. So, entire file contents will be scanned char @@ -5612,12 +6428,10 @@ % and in the |\skipgmlonely| declaration's scope it gobbles its % contents. % -% \CodeDefine*{gmlonely} -% \CodeDefine\skipgmlonely \newenvironment{gmlonely}{\StraightEOL}{} \newcommand\skipgmlonely[1][]{% - \def\@tempa{%\CodeDefIndex\gmd@skipgmltext + \def\@tempa{%\DefIndex\gmd@skipgmltext \def\gmd@skipgmltext{\g@emptify\gmd@skipgmltext#1}}% \@tempa \@xa\AtBegInput\@xa{\@tempa}% @@ -5630,23 +6444,20 @@ % I~need to say some char is of category 12 (`other sign'). This I'll % mark just as \catother\ got by |\catother|. % -% \CodeDefine\catother -\bgroup\catcode`\_=8 % we ensure the standard |\catcode| of |_|. -\firstofone{\egroup + +\foone{\catcode`\_=8 }% we ensure the standard |\catcode| of |_|. +{ \newcommand*\catother{${}_{12}$}%\par -% Similarly, if we need to say some char is of category 13 (`active'), -% we'll write \catactive, got by |\catactive| -% \CodeDefine\catactive + % Similarly, if we need to say some char is of category 13 (`active'), + % we'll write \catactive, got by |\catactive| \newcommand*\catactive{${}_{13}$}%\par -% and a~letter, \catletter -% \CodeDefine\catletter + % and a~letter, \catletter \newcommand*\catletter{${}_{11}$}%. } % % For the copyright note first I~used just \env{verse} but it requires % marking the line ends with |\\| and indents its contents while % I~prefer the copyright note to be flushed left. So -% \CodeDefine*{copyrnote} \newenvironment*{copyrnote}{% \StraightEOL\everypar{\hangindent3em\relax\hangafter1 }% \par\addvspace\medskipamount\parindent\z@\obeylines}{% @@ -5654,91 +6465,84 @@ % % I~renew the \env{quotation} environment to make the fact of quoting % visible -% \CodeDefine*{quotation} \renewenvironment{quotation}{\par``\ignorespaces}{\unskip''\par} % \chunkskip % For some mysterious reasons |\noindent| doesn't work with the first % (narrative) paragraph after the code so let's work it around: -% \CodeDefine\gmdnoindent \newcommand*\gmdnoindent{\leavevmode\hskip-\parindent} % -% When a~verbatim text occurres in an inline comment, it's advisable to +% When a~verbatim text occurs in an inline comment, it's advisable to % precede it with |%| if it begins a~not first line of such a~comment -% not to mistake it for a~part of code. For this purpose provide -% \CodeDefine\nlpercent -\newcommand*\nlpercent{% - \@ifstar{\def\@tempa{{\tt\twelvepercent}}% - \@emptify\@tempb\nl@percent}% +% not to mistake it for a~part of code. Moreover, if such a~short verb +% breaks in its middle, it should break with the percent at the +% beginning of the new line. For this purpose provide +\newcommand*\inverb{% + % \changes{v0.99g}{2007/11/12}{added} + \@ifstar{% + \def\@tempa{{\tt\xiipercent}}% + \@emptify\@tempb% here and in the paralell points of the other + % case and \inverb|\nlpercent| I~considered an \inverb|\ifhmode| + % test but it's not possible to be in vertical mode while in an + % inline comment. If there happens vertical mode, the commentary + % begins to be `outline' (main text). + \gmd@inverb}% {\@emptify\@tempa - \def\@tempb{\gmboxedspace}\nl@percent}} + \def\@tempb{\gmboxedspace}% + \gmd@inverb}} \newcommand*\gmboxedspace{\hbox{\normalfont{ }}} -\newcommand*\nl@percent[1][]{% +\newcommand*\gmd@nlperc[1][]{% \unskip - \discretionary{\@tempa}{{\tt\twelvepercent\gmboxedspace}}{\@tempb}% + \discretionary{\@tempa}{{\tt\xiipercent\gmboxedspace}}{\@tempb}% \penalty10000\hskip0sp\relax} -% As you see, |\nlpercent| inserts a~discretionary that breaks to |%| + +\newcommand*\gmd@inverb[1][]{% + \gmd@nlperc + \ifmmode\hbox\else\leavevmode\null\fi + \bgroup + \ttverbatim + \def\breakablexiispace{% + \discretionary{\xiispace}{\xiipercent\gmboxedspace}{\xiispace}}% + \def\breakbslash{% + \discretionary{}{\xiipercent\gmboxedspace\bslash}{\bslash}}% + \def\breaklbrace{% + \discretionary + {\xiilbrace\verbhyphen}% + {\xiipercent\gmboxedspace}% + {\xiilbrace}}% + \gm@verb@eol + % ^^A \@ifstar {\@sverb@chbsl} + % ^^A~ {\gmobeyspaces\frenchspacing\@sverb@chbsl} + \@sverb@chbsl% It's always with visible spaces. +} + +\newcommand*\nlpercent{% + \@ifstar{\def\@tempa{{\tt\xiipercent}}% + \@emptify\@tempb + \gmd@nlperc}% + {\@emptify\@tempa + \def\@tempb{\gmboxedspace}% + \gmd@nlperc}} + +% As you see, |\inverb| and |\nlpercent| insert a~discretionary that +% breaks to |%| % at the beginning of the lower line. Without the break it's a~space % (alas at its natural width i.e., not flexible) or, with the starred % version, nothing. The starred version puts |%| also at the end of -% the upper line. +% the upper line. Then |\inverb| starts sth. like +% |\verb*| but the breakables of it break to |%| in the +% lower line. % % TODO: make the space flexible (most probably it requires using sth.\ % else than |\discretionary|). %\stanza % % An optional hyphen for CSs in the inline comment: -% \CodeDefine\+ \@ifundefined{+}{}{\typeout{^^Jgmdoc.sty: redefining \bslash+.}} -\def\+{\discre{{\normalfont-}}{{\tt\twelvepercent\gmboxedspace}}{}} +\def\+{\discre{{\normalfont-}}{{\tt\xiipercent\gmboxedspace}}{}} % % -% And finally, some logos: -% \begin{quotation} Here are a few definitions which can usefully be -% employed when documenting -% package files: now we can readily refer to \AmSTeX, \BibTeX\ and \SliTeX, as well -% as the usual \TeX\ and \LaTeX. There's even a \PlainTeX\ and -% a~\Web.\end{quotation} -% \CodeDefine\AmSTeX \CodeDefine\BibTeX \CodeDefine\SliTeX -% \CodeDefine\PlainTeX \CodeDefine\Web \CodeDefine\TeXbook -% \CodeDefine\eTeX \CodeDefine\pdfeTeX \CodeDefine\pdfTeX -% \CodeDefine\XeTeX \CodeDefine\ds -\@ifundefined{AmSTeX} - {\def\AmSTeX{\leavevmode\hbox{$\mathcal A\kern-.2em\lower.376ex% - \hbox{$\mathcal M$}\kern-.2em\mathcal S$-\TeX}}}{} - -\DeclareLogo\BibTeX{{\rmfamily B\kern-.05em% - \textsc{i\kern-.025em b}\kern-.08em% - \TeX}} - - -\DeclareLogo\SliTeX{{\rmfamily S\kern-.06emL\kern-.18em\raise.32ex\hbox - {\scshape i}\kern -.03em\TeX}} - -\DeclareLogo\PlainTeX{\textsc{Plain}\kern2pt\TeX} - -\DeclareLogo\Web{\textsc{Web}} -% There's also the \LaTeXpar\ logo got with the |\LaTeXpar| macro -% provided by \pk{gmutils}. And here \TeXbook's logo: -\DeclareLogo[The TeX book]\TeXbook{The \TeX book} - -\DeclareLogo\eTeX{$\varepsilon$\TeX}% The \eTeX\ manual -% uses `$\varepsilon$-\TeX' but that would look strange in \pdfeTeX. - -\DeclareLogo\pdfeTeX{pdf\eTeX} - -\DeclareLogo\pdfTeX{pdf\TeX} - -\DeclareLogo\XeTeX{X\kern-.125em\relax - \@ifundefined{reflectbox}{% - \lower.5ex\hbox{E}\kern-.1667em\relax}{% - \lower.5ex\hbox{\reflectbox{E}}\kern-.1667em\relax}% - \TeX}% As you see, if -% \TeX\ doesn't recognize \nlpercent\cs{re\+flect\+box} (\pk{graphics} -% isn't loaded), the first |E| will not be reversed. This version of -% the command is intended for non-\XeTeX\ usage. With \XeTeX, the -% reversed |E| you get as the Unicode Latin Letter Reversed E. \@ifundefined{ds}{\def\ds{DocStrip}}{} @@ -5746,35 +6550,29 @@ % files playing with |%|'s % catcode(s). Instead of |%| I~used |&|. They may be at the end % because they're used in the commented thread i.e.\ after package's -% |\usepackage|. \CodeDefine\CDAnd +% |\usepackage|. \newcommand*\CDAnd{\CodeDelim\&} -% \CodeDefine\CDPerc -\newcommand*\CDPerc{\CodeDelim\%} + +\newcommand*\CDPerc{\CodeDelim*\%} % And for documenting in general: % % A~general sectioning command because I~foresee a~possibility of % typesetting the same file once as independent document and another % time as a~part of bigger whole. -\@ifdefinable\division{}% just to test (this \LaTeX\ check issues an -% error if the first argument is already defined). \CodeDefine\division -\@ifundefined{section}{% - \@relaxen\division}{% \CodeDefine\division - \let\division=\section} +% \Define\division +\let\division=\section -\@ifdefinable\subdivision{}% just to test (see above). \CodeDefine\subdivision -\@ifundefined{subsection}{% - \@relaxen\subdivision}{% \CodeDefine\subdivision - \let\subdivision=\subsection} -% The |\let|s are inside |\@ifundefined|s because I'm not sure -% whether you will typeset a~documentation with usual classes. Maybe -% too much care. +% \Define\subdivision +\let\subdivision=\subsection + +% \Define\subsubdivision +\let\subsubdivision=\subsubsection % % % \stanza % To kill a~tiny little bug in \file{doc.dtx} (in line 3299 |\@tempb| and % |\@tempc| are written plain not verbatim): -% \CodeDefIndex*{gmd@mc} \CodeDefine\AfterMacrocode \newcounter{gmd@mc} \def\gmd@mchook{\stepcounter{gmd@mc}% \label{gmd@mchook} @@ -5791,7 +6589,6 @@ % One more detail to expalin and define: the |\gmd@mcdiag| macro may % be defined to type out a~diagnostic message (the % \env{macrocode(*)}'s number, code line number and input line number). -% \CodeDefine\gmd@mcdiag \CodeDefine\mcdiagOn \CodeDefine\mcdiagOff \@emptify\gmd@mcdiag \def\mcdiagOn{\def\gmd@mcdiag{% @@ -5800,6 +6597,15 @@ \def\mcdiagOff{\@emptify\gmd@mcdiag} % +% An environment to display the meaning of macro parameters: its +% items are automatically numbered as |#1|, |#2| etc. +\newenvironment*{enumargs} + {\enumerate + \@namedef{label\@enumctr}{% + \cs[]{\#\csname the\@enumctr\endcsname }}} + {\endenumerate} + + % % \subdivision[\docfm-Compatibility]{\gmhypertarget[doccompa]{\docfm-Compatibility}} % @@ -5820,8 +6626,7 @@ % At the very beginning of a~\docfm-prepared file we meet a~nice % command \cs{Char\-act\-er\-Tab\-le}. My \TeX\ Guru says it's a~bit old % fashioned these days so let's just make it notify the user: -% \CodeDefine\CharacterTable -% \CodeDefIndex\Character@Table + \def\CharacterTable{\begingroup \@makeother\{\@makeother\}% \Character@Table} @@ -5850,13 +6655,11 @@ % Let us now look over other original \docfm's control sequences and % let's `domesticate' them if they are not yet. % -% \gmdmarginpar{kici kici} % The \TextUsage\DescribeMacro\ and \TextUsage\DescribeEnv\ commands % seem to correspond with my |\TextUsage| macro in its plain and starred % version respectively except they don't typeset their arguments in the text % i.e., they do two things of the three. So let's |\def| them to do these % two things in this package, too: -% \CodeDefine\DescribeMacro \outer\def\DescribeMacro{% \begingroup\MakePrivateLetters \gmd@ifonetoken\Describe@Macro\Describe@Env} @@ -5864,27 +6667,27 @@ % a~(possibly starred) control sequence, then as an environment's name % shall it be processed \emph{except} the \cs{Mak\-ePriv\-at\-e\-Oth\-ers} % re|\catcode|ing shall not be done to it. -% \CodeDefine\DescribeEnv \outer\def\DescribeEnv{% \begingroup\MakePrivateOthers\Describe@Env} % Actually, I've used the |\Describe...| commands myself a~few times, so % let's |\def| a~common command with a~starred -% version:\CodeDefine\Describe -\outer\def\Describe{% +% version: +\outer\def\Describe{% It doesn't typeset its argument in the point of + % occurrence. \begingroup\MakePrivateLetters \@ifstarl{\MakePrivateOthers\Describe@Env}{\Describe@Macro}} % The below two definitions are adjusted \*s of |\Text@UsgMacro| and % |\Text@UsgEnvir|. -% \CodeDefIndex\Describe@Macro +% \DefIndex\Describe@Macro \long\def\Describe@Macro#1{% \endgroup \strut\Text@Marginize#1% \@usgentryze#1% we declare kind of formatting the entry \text@indexmacro#1\ignorespaces} -% \CodeDefIndex\Describe@Env +% \DefIndex\Describe@Env \def\Describe@Env#1{% \endgroup \strut\Text@Marginize{#1}% @@ -5912,13 +6715,13 @@ % We have provided \TextUsage\CodeIndent\ in line % \ref{CodeIndent}. And it corresponds with \docfm's % \Describe\MacroIndent\cs{Mac\-ro\-In\-dent} so -% \CodeDefine\MacroIndent +% \Define\MacroIndent \let\MacroIndent\CodeIndent -% And similarly the other skips: \CodeDefine\MacrocodeTopsep +% And similarly the other skips: \Define\MacrocodeTopsep \let\MacrocodeTopsep\CodeTopsep % Note that \TextUsage\MacroTopsep\ is defined in \gmdoc\ and has -% the same r\^ole as in \docfm. - +% the same r\ocircum le as in \docfm. +% \Define\SpecialEscapechar \let\SpecialEscapechar\CodeEscapeChar % \TextUsage\theCodelineNo\ is not used in @@ -5941,7 +6744,6 @@ % % \stanza % For further notifications let's define a~shorthand: -% \CodeDefine\noeffect@info \def\noeffect@info#1{\@ifundefined{#1}{}{\PackageInfo{gmdoc}{^^J% The \bslash#1 macro is not supported by this package^^J and therefore has no effect but this notification.^^J @@ -5981,20 +6783,17 @@ % correspond with the \pk{gmdoc}'s default and the |pageindex| option % respectively. % Therefore let's |\let| -% \CodeDefine\CodelineIndex \let\CodelineIndex\@pageindexfalse \@onlypreamble\CodelineIndex -% \CodeDefine\PageIndex \let\PageIndex\@pageindextrue % \label{PageIndex} \@onlypreamble\PageIndex % The next two declarations I~find useful and -% smart:\CodeDefine\DisableCrossrefs +% smart: \def\DisableCrossrefs{\@bsphack\gag@index\@esphack} -% \CodeDefine\EnableCrossrefs \def\EnableCrossrefs{\@bsphack\ungag@index \def\DisableCrossrefs{\@bsphack\@esphack}\@esphack} % The latter definition is made due to the footnote 6 on p.\,8 of the @@ -6003,7 +6802,7 @@ % % \stanza % The subsequent few lines I~copy almost verbatim ;-) from the lines -% 611--620.\CodeDefine\AlsoImplementation +% 611--620. \newcommand*\AlsoImplementation{\@bsphack% \long\def\StopEventually##1{\gdef\Finale{##1}}% we define % \cs{Fi\+n\+a\+le} just to expand to the argument of |\StopEventually| not @@ -6023,7 +6822,7 @@ % \begin{quotation} When the user places an |\OnlyDescription| % declaration in the driver file the document should only be typeset % up to |\StopEventually|. We therefore have to redefine this -% macro.\end{quotation} \CodeDefine\OnlyDescription +% macro.\end{quotation} \def\OnlyDescription{\@bsphack\long\def\StopEventually##1{% % \begin{quotation} In this case the argument of |\StopEventually| @@ -6046,16 +6845,14 @@ % \stanza % Most of \docfm's indexing commands have already been `almost % defined' in \pk{gmdoc}: -% \CodeDefine\SpecialMainIndex -\let\SpecialMainIndex=\CodeDefIndex +\let\SpecialMainIndex=\DefIndex % \DoNotIndex\endcsname* -% \CodeDefine\SpecialMainEnvIndex \def\SpecialMainEnvIndex{\csname CodeDefIndex\endcsname*}% we don't -% type |\CodeDefIndex| explicitly here 'cause it's |\outer|, remember? +% type |\DefIndex| explicitly here because it's |\outer|, remember? -% \CodeDefine\SpecialIndex \CodeDefine\SpecialUsageIndex -% \CodeDefine\SpecialEnvIndex \CodeDefine\SortIndex +% \Define\SpecialIndex \Define\SpecialUsageIndex +% \Define\SpecialEnvIndex \Define\SortIndex \let\SpecialIndex=\CodeCommonIndex \let\SpecialUsageIndex=\TextUsgIndex @@ -6077,29 +6874,27 @@ % may have to redefine |\verbatimchar| if you use (and index) the |\+| % control sequence. \pk{gmdoc} does a~check for the analogous situation % (i.e., for processing |\&|) and -% if it occures it takes |$| as the |\verb*|'s delimiter. So strange +% if it occurs it takes |$| as the |\verb*|'s delimiter. So strange % delimiters are chosen deliberately to allow any `other' chars in the % environments' names. If this would cause problems, please % notify me and we'll think of adjustments. % -% \CodeDefine\verbatimchar +\def\verbatimchar{&} % \changes{v0.98c}{06/9/10}{put into all indexing macros for the % accordance of the `macro' and the `environment' index entries; the % \cs[]{\$} sign set as its alternative} -\def\verbatimchar{&} % One more a~very neat macro provided by \docfm. I~copy it % verbatim and put into \pk{gmutils}, too. (|\DeclareRobustCommand| % doesn't issue an error if its argument has been defined, it only % informs about redefining.) -% \CodeDefine\*\changes{v0.98}{06/09/05}{made robust.} \DeclareRobustCommand*\*{\leavevmode\lower.8ex\hbox{$\,\widetilde{\ }\,$}} +% \changes{v0.98}{06/09/05}{made robust.} % \TextUsage\IndexPrologue\ is defined in line % \ref{IndexPrologue}. And other \docfm\ index commands too. -% \CodeDefine\main \CodeDefine\usage \@ifundefined{main}{}{\let\DefEntry=\main} \@ifundefined{usage}{}{\let\UsgEntry=\usage} @@ -6110,29 +6905,27 @@ % doesn't count the modules' nesting. Therefore if we dont want an % error while \pk{gmdoc}umenting \docfm-prepared files, better let's % define \docfm's counter for the modules' depths. -% \CodeDefine*{StandardModuleDepth} \newcounter{StandardModuleDepth} % \stanza % For now let's just mark the macro for further development -% \CodeDefine*\DocstyleParms +% \Define*\DocstyleParms \noeffect@info{DocstyleParms} % For possible further development or to notify the user once and % forever: -% \CodeDefine\DontCheckModules \CodeDefine\CheckModules +% \Define\DontCheckModules \Define\CheckModules \@emptify\DontCheckModules \noeffect@info{DontCheckModules} \@emptify\CheckModules \noeffect@info{CheckModules} % The \TextMarginize\Module|\Module| macro \emph{is} provided exactly % as in \docfm. -% \CodeDefine\AltMacroFont +% \Define\AltMacroFont \@emptify\AltMacroFont \noeffect@info{AltMacroFont} % \begin{quotation} And finally the most important bit: we change the % |\catcode| of |%| so that it is ignored (which is how we are able to % produce this \pk{doc}ument!). We provide two commands to do the % actual switching.\end{quotation} -% \CodeDefine\MakePercentIgnore \CodeDefine\MakePercentComment \def\MakePercentIgnore{\catcode`\%9\relax} \def\MakePercentComment{\catcode`\%14\relax} % @@ -6166,22 +6959,23 @@ % % \changes[\OldMakeShortVerb]{v0.98a}{06/09/05}{and pals moved to % \pk{gmverb}.} -%\CodeDefine\OldDocInput +%\Define\OldDocInput % \changes{v0.98}{06/09/05}{\cs{@makeother\protect\bslash_} added} % \changes{v0.98a}{06/09/05}{\cs{AtBegInput} changed into % \cs{AtBegInputOnce}.} % \changes{v0.98b}{06/09/07}{enrichments of the \env{macrocode(*)} % definitions moved to the default definitions of these envs.} -\def\OldDocInput{% +\def\OldDocInput{% \changes{v0.99g}{2007/11/11}{obsolete redefinition + % of the \env{macro} environment removed} \AtBegInputOnce{\StraightEOL \let\@MakeShortVerb=\old@MakeShortVerb - %\label{oldmkshvrrb}\CodeDefIndex\gmd@@macro - \let\gmd@@macro\macro - \def\macro{\let\gmd@ifonetoken\@secondoftwo\gmd@@macro}% (Of course, - % na\-\"\i{}\-ve - % \nlpercent|\exp...\let\exp...\macro\cs...\macro*\endcs...| caused - % an infinite loop since in the definition of \env{macro*} the - % |\macro| macro occures.) + %\label{oldmkshvrrb}^^A\DefIndex\gmd@@macro +%^^A \let\gmd@@macro\macro +%^^A \def\macro{\let\gmd@ifonetoken\@secondoftwo\gmd@@macro}% (Of course, +%^^A % na\-\idiaeres\-ve +%^^A % \inverb|\exp...\let\exp...\macro\cs...\macro*\endcs...| caused +%^^A % an infinite loop since in the definition of \env{macro*} the +%^^A % |\macro| macro occurs.) \VerbMacrocodes}% \bgroup\@makeother\_% it's to allow |_| in the filenames. The next % macro will close the group. @@ -6217,13 +7011,13 @@ % to be shown verbatim as an example source must have been `additionally' % verbatimized for \gmdoc\ with the shortverb chars e.g. You may also % change the code delimiter for a~while, e.g., the line -% \CodeDelim*\. +% \CodeDelim\. % \AVerySpecialMacro % delete the first % when.\unskip|..|\par\CDPerc % % \gmdnoindent\label{AVerySpecialMacro} % was got with % \begin{verbatim} -%\CodeDelim*\. +%\CodeDelim\. %% \AVerySpecialMacro % delete the first % when.\unskip|..|\CDPerc %\end{verbatim} % @@ -6253,7 +7047,7 @@ % now let's assume this option is for draft versions so hasn't be % perfect. % -% Marcin Woli\'nski suggests to add the marginpar clauses for the +% Marcin Woli\nacute ski suggests to add the marginpar clauses for the % AMS classes as we did for the standard ones in the lines % \ref{mparclause1}--\ref{mparclause2}. Most probably I~can do it on % request when I~only know the classes' names and their `marginpar @@ -6279,7 +7073,7 @@ % documentations? If so, I~should `EOL-straighten' them like % |\tableofcontents|, I~suppose (cf.\ line \ref{straighttoc}). % -% Some lines of non-printing stuff such as |\CodeDefine...| and +% Some lines of non-printing stuff such as |\Define...| and % |\changes| connecting the narration with the code resulted with % unexpected large vertical space. Adding a~fully blank line between % the printed narration text and not printed stuff helped. @@ -6292,6 +7086,7 @@ % About the \ds\ \gmiflink{verbatim mode directive} see above. % % \end{bulletpars} +% \ \par\vspace*{-\baselineskip} % % \def\EOFMark{\} % \division{(No) \EOFMark} If the user doesn't wish the @@ -6301,18 +7096,16 @@ % Pearl Session where he presented \cs{input}ing a~file inside ^^B % \cs{edef}.}: % -% \CodeDefine\NoEOF -% \changes{v0.98}{06/09/05}{extended to add it the \cs{endinput} effect} -% \changes{v0.98l}{06/10/27}{divided in two macros first of which -% makes queer EOL and the latter gobbles the stuff till the EOL to -% suppress possible \cs{endinput} when used in \cs{StopEventually}} \bgroup\catcode`\^^M\active \firstofone{\egroup% \def\@NoEOF#1^^M{% \@relaxen\EOFMark\@xa\@nx\endinput^^M}} \def\NoEOF{\QueerEOL\@NoEOF} - +% \changes{v0.98}{06/09/05}{extended to add it the \cs{endinput} effect} +% \changes{v0.98l}{06/10/27}{divided in two macros first of which +% makes queer EOL and the latter gobbles the stuff till the EOL to +% suppress possible \cs{endinput} when used in \cs{StopEventually}} % \label{NoEOF} As you probably see, |\NoEOF| has also the % |\endinput| effect. @@ -6324,12 +7117,13 @@ % % %^^A~place for general changes: +% \ChangesGeneral % % \changes{v0.98a}{06/09/06}{\cs{AtBeginput}, \cs{AtEndinput}, % \cs{AtBeginputOnce} renamed to \cs{AtBegInput}, \cs{AtEndInput} % \cs{AtBegInputOnce} respect.} % -% \changes{v0.98c}{06/9/9}{making \cs{CodeDefine} and \cs{CodeUsage} +% \changes{v0.98c}{06/9/9}{making \cs{Define} and \cs{CodeUsage} % markers to add up; bug fixes in indexing macros and change of % concept of \cs{Code(Define$\quotechar|$Usage)*}: hence they serve not only for % environments but also for implicit def/use of macros} @@ -6387,6 +7181,15 @@ % \changes{v0.99e}{2007/04/29}{a~bug fixed in \cs{DocInput} and % \cs{IndexInput}} % +% \changes{v0.99g}{2007/11/12}{The bundle goes \XeTeX. The +% \TeX-related logos now are moved to \pk{gmutils}. \hathat{A} +% becomes more comment-like thanks to re\cs{catcode}'ing. Automatic +% detection of definitions implemented} +% +% \changes{v0.99h}{2007/11/16}{Fixed behaviour of sectioning commands +% (optional two heading skip check) of \pk{mwcls/gmutils} and +% respective macro added in \pk{gmdocc}. I~made a~\file{tds} archive} +% % % \Finale diff --git a/Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls b/Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls index b224ba6173d..c1dd06eb6aa 100644 --- a/Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls +++ b/Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls @@ -6,10 +6,10 @@ % % \begin{copyrnote} % -%%Written by Natror (Grzegorz Murzynowski), -%% natror at o2 dot pl +%% Written by Natror (Grzegorz Murzynowski), +%% natror at o2 dot pl %% -%% \copyright\,2006 by Natror (Grzegorz Murzynowski). +%% \copyright\,2006, 2007 by Natror (Grzegorz Murzynowski). %% %% This program is subject to the \LaTeX\ Project Public License. %% See ^^A @@ -30,11 +30,13 @@ % \chschange{v0.72}{06/11/14}{122} % \chschange{v0.73}{06/12/1}{128} % \chschange{v0.75}{2007/3/2}{130} -% +% \chschange{v0.76}{2007/11/13}{257} +% \chschange{v0.77}{2007/11/16}{262} +% \chschange{v0.78}{2007/11/19}{267} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{gmdocc} - [2007/03/02 v0.75 a class for gmdoc driver files (GM)] + [2007/11/19 v0.78 a class for gmdoc driver files (GM)] % % \division{Intro} @@ -45,7 +47,7 @@ %% probably you may use another document class you like. %% %% By default this class loads \pk{mwart} class with a4paper (default) -%% option and \pk{lmodern} package with QX fontencoding. It loads also +%% option and \pk{lmodern} package with T1 fontencoding. It loads also %% my \pk{gmdoc} documenting package which loads some auxiliary %% packages of mine and the standard ones. %% @@ -59,7 +61,7 @@ % % For the ideas and details of \pk{gmdoc}ing of the \LaTeXpar\ files % see the \pk{gmdoc.sty} file's documentation (chapter \ref{gmd}). The -% r\^ole of the \pk{gmdocc} document class is rather auxiliary and +% r\ocircum le of the \pk{gmdocc} document class is rather auxiliary and % exemplary. Most probably, you may use your favourite document class % with the settings you wish. This class I~wrote to meet my needs of % fine formatting, such as not numbered sections and sans serif demi @@ -101,7 +103,7 @@ % \dekmedskip % % The default base document class loaded by \pk{gmdocc.cls} is Marcin -% Woli\'nski's \pk{mwart}. If you have not installed it on your +% Woli\nacute ski \pk{mwart}. If you have not installed it on your % computer, the standard \pk{article} will be used. % % Moreover, if you like MW's classes (as I~do) and need |\chapter| @@ -114,76 +116,148 @@ % The existence test is done for any MW class option as it is in the % default case. % +% Since version 0.99g (November 2007) the bundle goes \XeTeX\ and that +% means you can use the system fonts if you wish, just specify the +% \TextUsage*{sysfonts} option and the three basic \XeTeX-related +% packages (\pk{fontspec}, \pk{xunicode} and \pk{xltxtra}) will be +% loaded and then you can specify fonts with the \pk{fontspec} +% declarations. For use of them check the driver of this documentation +% where the \TeX\ Gyre Pagella font is specified as the default Roman. +% % \stanza -% The \TextUsage\EOFMark\ is in this class typesets like this (of +% The \TextUsage\EOFMark\ in this class typesets like this (of % course, you can redefine it as you wish):\par\EOFMark % % \StopEventually\NoEOF % % \division{The Code} -% \CodeDefIndex\gmcc@baseclass -\def\gmcc@baseclass{mwart}% the default is Marcin Woli\'nski's class (\pk{mwcls}) -% analogous to \pk{article}. - -% Since you can choose the standard \pk{article} class, we'd better -% provide a~Boolean switch to keep the score of what was chosen. It's -% to avoid unused options if \pk{article} is chosen. -%\CodeDefIndex*{gmcc@mwcls} +\RequirePackage{xkeyval} + +% A~shorthands for options processing (I~know \pk{xkeyval} to little +% to redefine the default prefix and family). +% \HideDefining\DeclareOptionX +\newcommand*\gm@DOX{\DeclareOptionX[gmcc]<>} +\newcommand*\gm@EOX{\ExecuteOptionsX[gmcc]<>} +% \ResumeDefining\DeclareOptionX +% \DeclareDefining*[prefix=\bslash gmcc@]\gm@DOX + +% We define the |class| option. I~prefer the \pk{mwcls}, but you can +% choose anything else, then the standard \pk{article} is loaded. +% Therefore we'd better provide a~Boolean switch to keep the score of +% what was chosen. It's to avoid unused options if \pk{article} is +% chosen. \newif\ifgmcc@mwcls -\gmcc@mwclstrue -% \CodeDefine*{mwart} -\DeclareOption{mwart}{\def\gmcc@baseclass{mwart}}% The \pk{mwart} class may also + +% Note that the following option defines |\gmcc@class#1|. +\gm@DOX{class}{% the default will be Marcin Woli\nacute ski class + % (\pk{mwcls}) analogous to \pk{article}, see line \ref{EOXmwart}. + \def\gmcc@CLASS{#1}% + \@for\gmcc@resa:=mwart,mwrep,mwbk\do {% + \ifx\gmcc@CLASS\gmcc@resa\gmcc@mwclstrue\fi}% +} + + + +\gm@DOX{mwart}{\gmcc@class{mwart}}% The \pk{mwart} class may also % be declared explicitly. -% \CodeDefine*{mwrep} -\DeclareOption{mwrep}{\def\gmcc@baseclass{mwrep}}% If you need -% chapters, this option chooses an MW's class that corresponds to + +\gm@DOX{mwrep}{\gmcc@class{mwrep}}% If you need +% chapters, this option chooses an MW class that corresponds to % \pk{report}, -% \CodeDefine*{mwbk} -\DeclareOption{mwbk}{\def\gmcc@baseclass{mwbk}}% and this MW's class + +\gm@DOX{mwbk}{\gmcc@class{mwbk}}% and this MW class % corresponds to \pk{book}. -% \CodeDefine*{article} -\DeclareOption{article}{\gmcc@mwclsfalse}% you can also + +\gm@DOX{article}{\gmcc@class{article}}% you can also % \emph{choose} \pk{article}. +% A~meta-remark: When I~tried to do the most natural thing, to +% |\ExecuteOptionsX| inside such declared option, an error occured: +% 'undefined control sequence \inverb|\XKV@resa -> \@nil|'. -% \CodeDefine*{outeroff} -\DeclareOption{outeroff}{\let\outer\relax}% This option allows + +\gm@DOX{outeroff}{\let\outer\relax}% This option allows % |\outer|-prefixed macros to be \pk{gmdoc}-processed with all the % bells and whistles. -% \CodeDefine\if@debug \newif\if@debug -% \CodeDefine*{debug} -\DeclareOption{debug}{\@debugtrue}% This option causes \pk{trace} to + +\gm@DOX{debug}{\@debugtrue}% This option causes \pk{trace} to % be loaded and the Boolean switch of this option may be used to hide % some things needed only while debugging. -% \CodeDefine*{noindex} -\DeclareOption{noindex}{% - \PassOptionsToPackage{\CurrentOption}{gmdoc}}% This + +\gm@DOX{noindex}{% + \PassOptionsToPackage{noindex}{gmdoc}}% This % option turns the writing outto \file{.idx} file off. -% \CodeDefIndex\if@gmccnochanges -% \CodeDefIndex*\@gmccnochangestrue -% \CodeDefIndex*\@gmccnochangesfalse + \newif\if@gmccnochanges -% \CodeDefine*{nochanges} -\DeclareOption{nochanges}{\@gmccnochangestrue}% This option turns the + +\gm@DOX{nochanges}{\@gmccnochangestrue}% This option turns the % writing outto \file{.glo} file off. -% \CodeDefine*{gmeometric} -\def\gmTheGeometry{geometry} -\DeclareOption{gmeometric}{% - \IfFileExists{gmeometric.sty}{% - \def\gmTheGeometry{gmeometric}}{}}% It's an experimental option -% that causes the |\geometry| macro provided by \pk{geometry} package -% is not restricted to the preamble. This option causes the -% \pk{gmeometric} package is loaded (if available) that works the -% limitation around. +\gm@DOX{gmeometric}{}% The \pk{gmeometric} package +% causes the |\geometry| macro provided by \pk{geometry} package +% is not restricted to the preamble. +% +% Since version 0.99g of \pk{gmdoc} the bundle goes \XeTeX\ and that +% means \pk{geometry} should be loaded with |dvipdfm| option and the +% |\pdfoutput| counter has to be declared and that's what +% \pk{gmeometric} does by default if with \XeTeX. And \pk{gmeometric} +% has passed enough practical test. Therefore the |gmeometric| option +% becomes obsolete and the package is loaded always instead of +% original \pk{geometry}. +% +% \stanza As already mentioned, since version +% 0.99g the \pk{gmdoc} bundle goes \XeTeX. That means that if \XeTeX\ +% is detected, we may load the \pk{fontspec} package and the other two +% of basic three \XeTeX-related, and then we |\fontspec| the fonts. +% But the default remains the old way and the new way is given as the +% option below. + +\newif\ifgmcc@oldfonts +\gmcc@oldfontstrue +\gm@DOX{sysfonts}{\gmcc@oldfontsfalse} + +% Now we define a~key-val option that sets the version of marginpar +% typewriter font definition (relevant only with the |sysfonts| +% option). 0 for OpenType LMTT LC visible for the system (not on my +% computer), 1 for LMTT LC specially on my computer, any else number to avoid an +% error if you don't have OpenType LMTT LC installed (and leave the +% default \pk{gmdoc}'s definition of |\marginpartt|; all the versions +% allow the user to define marginpar typewriter \himher self). +\gm@DOX{mptt}[17]{\def\mpttversion{#1}}% the default value (17) works if +% the user puts the |mptt| option with no value. In that case leaving +% the default \pk{gmdoc}'s definition of marginpar typewriter and +% letting the user to redefine it \himher self seemed to me most natural. + +\def\gmcc@setfont#1{% + \gmcc@oldfontsfalse% note that if we are not in \XeTeX, this switch + % will be turned true in line \ref{ofstrue} + \AtBeginDocument{% + \@ifXeTeX{% + % ^^A \def\f@encoding{U}\selectfont + \setromanfont[Mapping=tex-text]{#1}% + \let\sl\it \let\textsl\textit + }{}}% +} + +\gm@DOX{minion}{\gmcc@setfont{Minion Pro}} +\gm@DOX{pagella}{\gmcc@setfont{TeX Gyre Pagella}} + + + +\gm@EOX{class=mwart}% \label{EOXmwart}We set the default basic class to +% be \pk{mwart}. + +\gm@EOX{mptt=0}% We default to set the marginpar typewriter font to +% OpenType LMTT LC. + +\ProcessOptionsX[gmcc]<> -\ProcessOptions % \newif\ifSecondClass^^A~to assure \TeX knows ifSecondClass % ^^A switch and therefore it counts the fis properly. @@ -197,42 +271,93 @@ \ifSecondClass\else %\fi\fi \ifgmcc@mwcls - \IfFileExists{\gmcc@baseclass.cls}{}{\gmcc@mwclsfalse}% As + \IfFileExists{\gmcc@CLASS.cls}{}{\gmcc@mwclsfalse}% As % announced, we do the ontological test to any \pk{mwcls}. \fi \ifgmcc@mwcls + \XKV@ifundefined{XeTeXdefaultencoding}{}{% + \XeTeXdefaultencoding "cp1250"}% \pk{mwcls} are encoding-sensitive + % because MW uses Polish diacritics in the commentaries. \LoadClass[fleqn, oneside, noindentfirst, 11pt, withmarginpar, - sfheadings]{\gmcc@baseclass}% + sfheadings]{\gmcc@CLASS}% + \XKV@ifundefined{XeTeXdefaultencoding}{}{% + \XeTeXdefaultencoding "utf-8"}% \else \LoadClass[fleqn, 11pt]{article}% Otherwise the standard \pk{article} is % loaded. \fi +% \iffalse\iffalse +\fi +% of ifSecondClass'es \cs{else} (a~feature under construction).\fi + +\RequirePackage{gmutils}% earlier to provide |\@ifXeTeX|. + +\ifgmcc@mwcls\afterfi\ParanoidPostsec\fi + +\@ifXeTeX{}{\gmcc@oldfontstrue} +% \label{ofstrue} \AtBeginDocument{\mathindent=\CodeIndent} -% The |fleqn| option makes displayed formuals be flushed left and +% The |fleqn| option makes displayed formul\ae\ be flushed left and % |\mathindent| is their indentation. Therefore we ensure it is always % equal |\CodeIndent| just like |\leftskip| in \env{verbatim}. Thanks % to that and the |\edverbs| declaration below you may display single % verbatim lines with |\[...\]|: % \[\verb+\[|\verbatim\stuff|\]+\,.\] -\IfFileExists{lmodern.sty}{% We also examine the ontological status of - % this package - \RequirePackage{lmodern}% and if it shows to be satisfactory (the - % package shows \emph{to be}), we load it and set the proper - % font encoding. - \RequirePackage[QX]{fontenc}% -}{} -%\iffalse\iffalse +\ifgmcc@oldfonts + \IfFileExists{lmodern.sty}{% We also examine the ontological status of + % this package + \RequirePackage{lmodern}% and if it shows to be satisfactory (the + % package shows \emph{to be}), we load it and set the proper + % font encoding. + \RequirePackage[T1]{fontenc}% + }{}% +% A~couple of diacritics I~met while \pk{gmdocing} these files and The +% Source etc. Somewhy the accents didn't want to work at my \XeTeX\ +% settings so below I~define them for \XeTeX\ as respective chars. + \def\agrave {\`a}% + \def\cacute {\'c}% + \def\eacute {\'e}% + \def\idiaeres{\"\i}% + \def\nacute {\'n}% + \def\ocircum {\^o}% + \def\oumlaut {\"o}% + \def\uumlaut {\"u}% +\else% this case hapens only with \XeTeX. + \let\do\relaxen + \do\Finv\do\Game\do\beth\do\gimel\do\daleth% these five caused the + % `already defined' error. + \XeTeXthree + %^^A \setromanfont{LMRoman12}% Regular +%^^A \setsansfont{LMSans10}% Regular +%^^A \setmonofont{LMTypewriter10}% Regular + \let\fontencoding\@gobble + \def\agrave {\char"00E0 }% + \def\cacute {\char"0107 }% Note the space to be sure the number + % ends here. + \def\eacute {\char"00E9 }% + \def\idiaeres{\char"00EF }% + \def\nacute {\char"0144 }% + \def\oumlaut {\char"00F6 }% + \def\uumlaut {\char"00FC }% + \def\ocircum {\char"00F4 }% + \AtBeginDocument{% + \def\ae{\char"00E6 }% + \def\l {\char"0142 }% + \def\oe{\char"0153 }% + }% \fi -% of ifSecondClass (a~feature under construction).\fi - -\RequirePackage[margin=2.7cm, left=4cm, - right=2.2cm]{\gmTheGeometry}% Now we set the -% page layout. +% Now we set the page layout. +\RequirePackage{gmeometric} \def\gmdoccMargins{% - \geometry{margin=2.7cm, left=4cm, right=2.2cm}} + \geometry{top=77pt, height=687pt, % =53 lines but the |lines| option + % seems not to work 2007/11/15 with \TeX\ Live 2007 and \XeTeX\ + % 0.996-patch1 + left=4cm, right=2.2cm}} +\gmdoccMargins + \if@debug% For debugging we load also the \pk{trace} package that was % very helpful to me. @@ -240,18 +365,38 @@ \errorcontextlines=100 % And we set an error info parameter. \fi -%\CodeDefine\ifdtraceon -%\CodeDefine\ifdtraceoff \newcommand*\ifdtraceon{\if@debug\afterfi\traceon\fi} \newcommand*\ifdtraceoff{\if@debug\traceoff\fi} % We load the core package: \RequirePackage{gmdoc} -\@ifpackageloaded{lmodern}{% The Latin Modern font family provides - % a~light condensed typewriter font that seems to be the most - % suitable for the marginpar CS marking. - \def\marginpartt{\normalfont\fontseries{lc}\ttfamily}}% +\ifgmcc@oldfonts + \@ifpackageloaded{lmodern}{% The Latin Modern font family provides + % a~light condensed typewriter font that seems to be the most + % suitable for the marginpar CS marking. + \def\marginpartt{\normalfont\fontseries{lc}\ttfamily}}{}% +\else + \IfFileExists{/media/BleuDeParis/texmf/tex/xelatex/crop.cfg}% + {\def\mpttversion{1}}{}% my system doesn't see LMTT LC, so on my + % computer I~have to tell \XeTeX explicitly where the font is. + \ifcase\mpttversion + \font\marginpartt= lmtypewriter10-lightcondensed.otf at 10.95pt + \or% (when =1, on my computer that is) + \font\marginpartt= % + [/home/natror/.fonts/lmtypewriter10-lightcondensed.otf] at 10.95pt + \else % other values allow you to define |\marginpartt| yourself. + \fi +%^^A~ \iffontchar \marginpartt 32 \show\relax \else \show\par\fi +%^^A~ +%^^A~ LMTypewriter10-LightCondensed.pfb at 10.95pt +%^^A~ "LMTypewriter10:style=LightCondensed" +%^^A~ "LMTypewriter10 LightCond,LMTypewriter10\bslash-LightCond:style=Regular" +%^^A~ "LMTypewriter10:style=LightCondensed" +%^^A~ Garamond +%^^A~ LMTypewriter10-Light.pfb +%^^A~ /home/natror/.fonts/lmtypewriter10-lightcondensed.otf +\fi % ^^A\setcounter{IndexColumns}{2} narrow columns do spare space and @@ -298,13 +443,26 @@ \def\EOFMark{\rightline{\ensuremath{\square}}} + \endinput % \changes{v0.677}{06/9/23}{Added checkings if \pk{mwart.cls} and -% \pk{lmodern.sty} are available and more standard behaviour if they -% are not} +% \pk{lmodern.sty} are available and more standard behaviour if they +% are not} % % \changes{v0.70}{06/10/10}{Added some options and Latin Modern Light -% Condensed to the marginpar CSs.} +% Condensed to the marginpar CSs.} +% +% \changes{v0.76}{2007/10/30}{The \cs[]{gmeometric} option made +% obsolete and the \pk{gmeometric} package is loaded always, for +% \XeTeX-compatibility. And the class options go \pk{xkeyval}.} +% +% \changes{v0.77}{2007/11/16}{Bug fix of sectioning commands in +% \pk{mwcls} and the default font encoding for \TeX ing old way +% changed from \acro{QX} to \acro{T1} because of the `corrupted +% \acro{NTFS} tables' error} +% +% \changes{v0.78}{2007/11/19}{Added the \env{pagella} option not to +% use Adobe Minion Pro that is not freely licensed} % % \Finale diff --git a/Master/texmf-dist/tex/latex/gmdoc/gmoldcomm.sty b/Master/texmf-dist/tex/latex/gmdoc/gmoldcomm.sty new file mode 100644 index 00000000000..e4bcc16cbf5 --- /dev/null +++ b/Master/texmf-dist/tex/latex/gmdoc/gmoldcomm.sty @@ -0,0 +1,92 @@ +% +% \GetFileInfo{gmoldcomm.sty} +% \title{The \pk{gmoldcomm} Package\thfileinfo} +% \author{Natror (Grzegorz Murzynowski)} +% \date{\today} +% \maketitle +% +% +% This is a~package +% for handling the old comments in \LaTeXe\ Source Files when \LaTeX^^B +% ing them with the \pk{gmdoc} package. +% +% Written by Natror (Grzegorz Murzynowski) 2007/11/10. +% +% It's a~part of the \pk{gmdoc} bundle and as such a~subject to the +% \LaTeX\ Project Public License. +% +% +% \stanza +% Scan CSs and put them in tt. If at beginning of line, precede them +% with |%|. Obey lines in the commentary. + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{gmoldcomm} + [2007/11/10 v0.99 LaTeX old comments handling (GM)] + +\newenvironment{oldcomments}{% + \catcode`\\=\active + \let\do\@makeother + \do\$% Not only CSs but also special chars happen in the old comments. + \do\|\do\#\do\{\do\}\do\^\do\_\do\&% + \gmoc@defbslash + \obeylines + \StoreMacro\finish@macroscan + \def\finish@macroscan{% + \@xa\gmd@ifinmeaning\macro@pname\of\gmoc@notprinted% + {}{{\tt\ifvmode\%\fi\bslash\macro@pname}}% + \gmoc@checkenv + }% +}{} + +{\escapechar\m@ne +\xdef\gmoc@notprinted{\string\begin,\string\end}} + +\def\gmoc@maccname{macrocode} +\def\gmoc@ocname{oldcomments} + + +\foone{% + \catcode`\[=1 \catcode`\]=2 + \catcode`\{=12 \catcode`\}=12 } +[\def\gmoc@checkenv[% + \@ifnextchar{%^^A} + [\gmoc@checkenvinn][]]% +% +\def\gmoc@checkenvinn{#1}[% + \def\gmoc@resa[#1]% + \ifx\gmoc@resa\gmoc@maccname + \def\next[% + \begingroup + \def\@currenvir[macrocode]% + \RestoreMacro\finish@macroscan + \catcode`\\=\z@ + \catcode`\{=1 \catcode`\}=2 + \macrocode]% + \else + \ifx\gmoc@resa\gmoc@ocname + \def\next[\end[oldcomments]]% + \else + \def\next[% + % ^^A \typeout[**** detected environment [#1]]% + \{#1\}% + % ^^A \show\relax + ]% + \fi + \fi + \next]% +] + +\foone{% + \catcode`\/=\z@ + \catcode`\\=\active} +% \CodeEscapeChar\/ +{/def/gmoc@defbslash{% + /let\/scan@macro}} +% \CodeEscapeChar\\ + +\def\task#1#2{} + +\endinput + +%\NoEOF -- cgit v1.2.3