diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty | 582 |
1 files changed, 357 insertions, 225 deletions
diff --git a/Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty b/Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty index cee0aa6b911..494b00382bc 100644 --- a/Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty +++ b/Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty @@ -1,7 +1,7 @@ % % \GetFileInfo{gmdoc.sty} % \title{The \pk{gmdoc.sty} Package\thfileinfo} -% \author{Grzegorz `Natror' Murzynowski} +% \author{Natror (Grzegorz Murzynowski)} % \date{\today} % \maketitle % \label{gmd} @@ -13,10 +13,10 @@ %% % \begin{copyrnote} % -%% Written by Grzegorz `Natror' Murzynowski, +%% Written by Natror (Grzegorz Murzynowski), %% natror at o2 dot pl %% -%% \copyright\,2006 by Grzegorz `Natror' Murzynowski. +%% \copyright\,2006 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 @@ -47,14 +47,19 @@ % \chschange{v0.98l}{06/10/27}{4401} % \chschange{v0.98m}{06/11/14}{4349} % \chschange{v0.99}{06/11/29}{4462} -% \chschange{v0.99a}{2006/12/1}{4479} +% \chschange{v0.99a}{2006/12/01}{4479} +% \chschange{v0.99b}{07/01/01}{4479} +% \chschange{v0.99c}{07/3/2}{4486} +% \chschange{v0.99c}{07/3/30}{4475} +% \chschange{v0.99d}{07/4/26}{4555} +% \chschange{v0.99e}{2007/4/29}{4574} % %^^A \docstrip %<package> \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{gmdoc} - [2006/12/30 v0.99a a documenting package (GM)] + [2007/04/29 v0.99e a documenting package (GM)] % % @@ -157,6 +162,27 @@ % \pk{mwcls}, the standard \pk{article.cls} class would be used. % \end{gmlonely} % +% \subdivision{Dependencies} +% +% The \pk{gmdoc} bundle depends on some other packages of mine: +% \begin{verse} +% \pk{gmutils.sty},\\ +% \pk{gmverb.sty},\\ +% \pk{gmiflink.sty}\\ +% \pk{gmeometric} (for the driver of The \LaTeXe\ Source)\\ +% \end{verse} +% and also on some standard packages: +% \begin{verse} +% \pk{hyperref.sty},\\ +% \pk{color.sty},\\ +% \pk{geometry.sty},\\ +% \pk{multicol.sty},\\ +% \pk{lmodern.sty},\\ +% \pk{fontenc.sty}\\ +% \end{verse} +% that should +% be installed on your computer by default. +% % % % \subdivision{Bonus: \file{base} Drivers} % @@ -170,7 +196,7 @@ % \pk{doc_gmdoc.tex} % % \pk{oldcomm.sty}\\ -% \pk{gmeometric.sty} +% (\pk{gmsource2e.ist} is generated from \pk{source2e_gmdoc.tex})\\ % \end{verse} % % These drivers typeset the respective files from the @@ -272,12 +298,12 @@ % % \subdivision{Preparing the Source File} % -% When \LaTeXpar\ with \pk{gmdoc.sty} package loaded typesets the +% When \LaTeXpar\ with \pk{gmdoc.sty} package loaded typesets the % comment lines, the code delimiter is ommitted. If the comment % continues a~codeline, the code delimiter is printed. It's done so -% because ending a~\TeX\ code line with a~|%| is often very important -% and significant. Comments longer than one line are typeset -% continuously with the code delimiters ommitted. +% because ending a~\TeX\ code line with a~|%| is just a~concatenation +% with the next line sometimes. Comments longer than one line are +% typeset continuously with the code delimiters ommitted. % % The user should just write \hisher\ splendid code and brilliant % commentary. In the latter \heshe\ may use usual \LaTeXpar\ commands. @@ -317,8 +343,9 @@ % people's good. And, as I~try to show with the \cs{QueerEOL} and % \cs{StraightEOL} declarations, `queer' may be very useful and % recommended while `straight' is the standard but not necessarily -% normative. (Remember also Alice's in the Wonderland exclamations -% ``What a~queer day is today''.)}^^A +% normative. ^^A% (Remember also Alice's in the Wonderland exclamations +% ^^A % ``What a~queer day is today''.) +% }^^A % \QueerEOL % \gmdoc's meaning of the line end. It OCSR, too. One more point to use % |\StraightEOL| is where you wish some code lines to be executed @@ -619,7 +646,7 @@ % declaration % that takes a~one-char control sequence as the only argument and % turns the char used into a~short verbatim delimiter, e.g., after -% \[\hbox{\verb+\MakeShortVerb*\|+}\] +% \[\verb+\MakeShortVerb*\|+\] % (as you see, the declaration has the starred version, which is for % visible spaces, and non-starred for blank spaces) to get % |\mylittlemacro| you may type \verb+|\mylittlemacro|+ instead of @@ -723,14 +750,14 @@ % 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 -% \[ \hbox{|%\CodeDefine*{foo}|} \] +% \[|%\CodeDefine*{foo}|\] % right before the code line -% \[\hbox{|\newenvironment{foo}{%|}\]^^A] +% \[|\newenvironment{foo}{%|\]^^A] % i.e., not separated by any code line. The starred versions of % the |\Code...| commands are also intended to mark implicit % definitions of macros, e.g., |\CodeDefine*\@foofalse| before % the line -% \[\hbox{|\newif\if@foo|.}\] +% \[|\newif\if@foo|.\] % % They both are |\outer|. % @@ -843,7 +870,7 @@ % indexed. The items of this list may be separated with commas, as in % \docfm , but it's not obligatory. The whole list should come in % curly braces (except when it's one-element), e.g., -% \[\hbox{\verb+\DoNotIndex{\some@macros,\are* \too\auxiliary\?}+}\] +% \[|\DoNotIndex{\some@macros,\are* \too\auxiliary\?}|\] % (The spaces after the control sequences are ignored.) % You may use as many |\DoNotIndex|es as you wish (about half as many as % many CSs may be declared, because for each CS excluded from indexing @@ -859,7 +886,7 @@ % wish to undo just a~couple of them, you are given \TextUsage\DoIndex\ % declaration (OCSR) that removes a~ban on all the CSs given in the % argument, e.g., -% \[\hbox{\verb+\DoIndex{\par \@@par \endgraf}+}\] +% \[|\DoIndex{\par \@@par \endgraf}|\] % % Moreover, you are provided the \TextUsage\DefaultIndexExclusions\ % and \Describe\UndoDefaultIndexExclusions^^A @@ -878,11 +905,13 @@ % recognition (MW told it's not that important.) % % So far \gmhypertarget{verbatim mode directive} is only -% half-handled. That is, a~line beginning with |%<<|\<END-TAG> will be -% typeset as a~\ds\ directive, but -% the closing line |%|\<END-TAG> will be not. It doesn't hard to -% implement, I~only receive some message it's really useful for -% someone. +% half-handled. That is, a~line beginning with |%<||<|\<END-TAG> will be +% typeset as a~\ds\ directive, but ^^A~The magical directive divided +% ^^A due to the doctex mode who saw it and coloured all after with +% ^^A~salmon. +% the closing line |%|\<END-TAG> will be not. It doesn't seem to be +% hard to implement, I~only receive some message it's really useful +% for someone. % %^^A If you use the \TextUsage*{macrocode} environment, you don't have to %^^A add any CS to get \ds\ directive typeset properly: within @@ -916,7 +945,7 @@ % To maintain a change history within the file, the |\changes| command may % be placed amongst the description part of the changed code. It takes three % arguments, thus: -% \[\hbox{|\changes{|\<version>|}{|\<YYYY/MM/DD date>|}{|\<text>|}|}\] +% \[|\changes{|\<version>|}{|\<YYYY/MM/DD date>|}{|\<text>|}|\] % % The changes may be used to produce an auxiliary file (\LaTeX's % |\glossary| mechanism is used for this) which may be printed after @@ -972,7 +1001,7 @@ % is later than the date stored in the counter % \TextUsage*{ChangesStartDate}. You may set this counter with a % \Describe\ChangesStart^^B -% \[\hbox{|\ChangesStart{|\<version>|}{|\<year>|/|\<month>|/|\<day>|}|}\] +% \[|\ChangesStart{|\<version>|}{|\<year>|/|\<month>|/|\<day>|}|\] % declaration. % % If the \env{ChangesStartDate} is set to a~date contemporary to \TeX\ @@ -987,7 +1016,7 @@ % establish two threads of the changes history: the one for the users, % dated with four digit year, and the other for yourself only, dated % with two or three digit year. If you declare -% \[\hbox{|\ChangesStart{|\<version?>|}{1000/00/00}|}\] +% \[|\ChangesStart{|\<version?>|}{1000/00/00}|\] % or so, the changes entries dated with less-than-four digit year % shall be ommitted and no notification shall be issued of that. % @@ -1074,7 +1103,7 @@ % \TextUsage\EOFMark\ macro. If you don't like such an ending, you % should end the source file with the \TextUsage\NoEOF\ macro in % a~comment, i.e., -% \[\hbox{|%|\<some text, why not>|\NoEOF|}\] +% \[|%|\<some text, why not>|\NoEOF|\] % This macro redefines |\EOFMark| and suppresses the End % Of File token to close the input properly. It also has the % |\endinput| effect so you may put some text you don't want to @@ -1097,9 +1126,8 @@ % your mind you should express it with a~new |\CodeDelim| % declaration. % -% The plain (unstarred) version of |\CodeDelim| changes also the verb -% `hyphen', the char appearing at the verbatim line breaks that is. If -% you don't want to change the verb `hyphen', use |\CodeDelim*|. +% The starred version of |\CodeDelim| changes also the verb +% `hyphen', the char appearing at the verbatim line breaks that is. % % \stanza % Talking of special chars, the escape char, |\| by default, is also @@ -1343,7 +1371,7 @@ % \noindent\Describe\eTeX\eTeX,\\ % \Describe\pdfeTeX\pdfeTeX\\ % \Describe\pdfTeX\pdfTeX\\ -% \Describe\XeTeX\XeTeX\ (the first |E| will be reversed if the +% \Describe\XeTeX\XeTeX\ (the first |E| will be reversed iff the % \pk{graphics} package is loaded) and\\ % \Describe\LaTeXpar\LaTeXpar.\par % (The last logo is defined in \pk{gmutils}.) @@ -1382,7 +1410,12 @@ % is provided (and therefore getable) if the file is also loaded (or % the |\Provide...| line occures in a~|\StraightEOL| scope). % -% Since you may wish to process also files that you don't load, +% 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. +% +% If the input file doesn't contain |\Provides...| in the code layer, % there are commands \TextUsage\ProvideFileInfo|{|\<file name with ^^B % extension>|}[|\<info>|]| and % \TextUsage\ProvideSelfInfo|[|\<info>|]|. (\<info> should consist of: @@ -1463,7 +1496,7 @@ %%\end{macrocode} %\end{verbatim} % and |\blaargh|'s definition is |{foo}|, you'll get -%\[\hbox{|\alittlemacro %| change it to foo}\] +%\[|\alittlemacro %| change it to foo\] % (Note that `my' \env{macrocode} doesn't require % the magical |% \end|.) % @@ -1632,7 +1665,7 @@ % We require another package of mine that provides some tricky macros % analogous to the \LaTeX\ standard ones, such as |\newgif| and % |\@ifnextcat|. -\RequirePackage{gmutils} +\RequirePackage{gmutils}[2007/04/24] % A~standard package for defining colours, \RequirePackage{color} @@ -1657,7 +1690,7 @@ \RequirePackage{gmiflink} % And a~slight redefinition of \env{verbatim}, |\verb(*)| and % providing of |\MakeShortVerb(*)|. -\RequirePackage{gmverb} +\RequirePackage{gmverb}[2007/04/24] \if@noindex \AtBeginDocument{\gag@index}% for the latter macro see line @@ -1696,11 +1729,12 @@ % versions} % % \CodeDefine\CodeDelim \CodeDefine\code@delim -\def\CodeDelim{\@ifstar{\Code@Delim}{\Code@Delim@St}} +\def\CodeDelim{\@ifstar\Code@Delim@St\Code@Delim} \def\Code@Delim#1{% {\escapechar\m@ne - \expandafter\gdef\expandafter\code@delim\expandafter{\string#1}}} + \@xa\gdef\@xa\code@delim\@xa{\string#1}}} +% (|\@xa| is |\expandafter|, see \pk{gmutils}.)\DoNotIndex\@xa \def\Code@Delim@St#1{\Code@Delim{#1}\VerbHyphen{#1}} @@ -1893,30 +1927,38 @@ % due to the \cs{co\+de\+spa\+ces\+blank} option. \catcode`\^^M=\active% % \CodeUsgIndex\code@delim - \expandafter\@makeother\code@delim% + \@xa\@makeother\csname\code@delim\endcsname% % \CodeUsgIndex\gmd@resetlinecount \gmd@resetlinecount% due to the option |uresetlinecount| % we reset the linenumber counter or do nothing. % \CodeUsgIndex\@beginputhook \@beginputhook% my first use of it is to redefine |\maketitle| % just at this point not globally. \CodeUsgIndex\everypar - \everypar=\expandafter{\expandafter\@codetonarrskip\the\everypar}% + \everypar=\@xa{\@xa\@codetonarrskip\the\everypar}% % \CodeDefine*{^^M} \let^^M=\gmd@textEOL% % \CodeDefIndex\gmd@guardedinput \edef\gmd@guardedinput{% - \noexpand\@@input #1\relax% it's true \TeX's - % |\input|. \CodeUsgIndex\EOFMark - \noexpand\EOFMark% to pretty finish the input, see + \@nx\@@input #1\relax% |\@nx| is + % |\noexpand|, see \pk{gmutils}.\DoNotIndex\@nx + % \nlpercent|\@@input| is the + % true \TeX's \nlpercent|\input|. \CodeUsgIndex\EOFMark + \gmd@iihook% cf.\ line \ref{iihook} + \@nx\EOFMark% to pretty finish the input, see % line~\ref{eofMark}.\CodeUsgIndex\code@delim - \noexpand^^M\code@delim% + \@nx\CodeDelim\@xa\@nx\csname\code@delim\endcsname% to + % ensure the code delimiter is the same as at the beginning of + % input. + % \changes[\DocInput]{v0.99c}{2007/03/02}{added ensuring the + % code delimiter to be the same at the end as at the beginning} + \@nx^^M\code@delim% % \label{guardians} }% we add guardians after % |\input|ing a~file; somehow an error occurred without them. \catcode`\%=9 % for \docfm -compatibility.\label{ignorePercent} \setcounter{CheckSum}{0}% we initialize the counter for the number % of the escape chars (the assignment is |\global|). - \expandafter\expandafter\expandafter^^M\gmd@guardedinput%\label{eeeEOL} + \@xa\@xa\@xa^^M\gmd@guardedinput%\label{eeeEOL} \par% % \CodeUsgIndex\@endinputhook \@endinputhook% It's a~hook to let postpone @@ -1953,7 +1995,7 @@ \@newlinegtrue% to |\refstep| the lines' counter at the proper % point. \@dsdirgtrue% to handle the \ds\ directives. - \expandafter\@trimandstore\the\everypar\@trimandstore%we store the + \@xa\@trimandstore\the\everypar\@trimandstore%we store the % previous value of |\everypar| register to restore it at % a~proper point. See line \ref{@trimandstore} for the details. \begingroup%^^A ##### maybe we prefer to restore the genuine |\par| @@ -1974,7 +2016,7 @@ \gmd@DoTeXCodeSpace% \@makeother\|% 'cause |\ttverbatim| doesn't do that. \MakePrivateLetters% see line \ref{MPL}.\par - \expandafter\@makeother\code@delim% we are + \@xa\@makeother\code@delim% we are % almost sure the code comment char is among the chars having % been \catother ed already. For `almost' see the % \gmiflink[IndexInput]{\cs{IndexInput}} macro's definition.\par @@ -1983,7 +2025,7 @@ % process the leading spaces supposed there are any and, if after % them is a~|%|, we just continue the commentary as in the % previous case or else we typeset the \TeX\ code. - \expandafter\@ifnextchar\expandafter{\code@delim}{%\label{ifContNarr} + \@xa\@ifnextchar\@xa{\code@delim}{%\label{ifContNarr} % \CodeUsgIndex\gmd@continuenarration \gmd@continuenarration}{% \CodeUsgIndex\gmd@dolspaces \gmd@dolspaces% it will launch |\gmd@typesettexcode|. @@ -2003,6 +2045,10 @@ \def\AtBegInput{\g@addto@macro\@beginputhook} \def\@beginputhook{} +% For the index input hooking now declare a~macro, we define it +% another way at line \ref{iihook}. +\emptify\gmd@iihook + % And let's use it instantly to avoid a~disaster while reading in the % table of contents. % \CodeDefine\tableofcontents @@ -2023,7 +2069,7 @@ % \CodeDefine\@ifQueerEOL % \changes{v0.98a}{06/09/06}{added} \long\def\@ifQueerEOL#1#2{% - \ifnum\the\catcode`\^^M=\active \afterelsefi#1\else\afterfi#2\fi} + \ifnum\the\catcode`\^^M=\active \afterfi{#1}\else\afterfi{#2}\fi} % \CodeDefine\AtBegInputOnce The declaration below is useful if you % wish to put sth.\ just in the nearest input/included file and no @@ -2046,11 +2092,11 @@ \long\def\AtBegInputOnce#1{% %^^A \stepcounter{hook@oncecnt}% -%^^A \expandafter\long\expandafter\edef% \CodeUsgIndex*{NeuroOncer} +%^^A \@xa\long\@xa\edef% \CodeUsgIndex*{NeuroOncer} %^^A \csname gmd/AtBI/NeuroOncer\the\c@hook@oncecnt\endcsname{% -%^^A \noexpand\glet\csname gmd/AtBI/NeuroOncer\the\c@hook@oncecnt\endcsname\relax}% -%^^A \expandafter\addtomacro\csname gmd/AtBI/NeuroOncer\the\c@hook@oncecnt\endcsname{#1}% -%^^A \expandafter\AtBegInput\csname gmd/AtBI/NeuroOncer\the\c@hook@oncecnt\endcsname +%^^A \@nx\glet\csname gmd/AtBI/NeuroOncer\the\c@hook@oncecnt\endcsname\relax}% +%^^A \@xa\addtomacro\csname gmd/AtBI/NeuroOncer\the\c@hook@oncecnt\endcsname{#1}% +%^^A \@xa\AtBegInput\csname gmd/AtBI/NeuroOncer\the\c@hook@oncecnt\endcsname \gaddtomacro\gmd@ABIOnce{\g@emptify\gmd@ABIOnce#1}} % Many tries of finishing the input cleanly led me to setting the @@ -2094,9 +2140,9 @@ \def\gmd@continuenarration{% \endgroup \gmd@countnarrationline% see \gmiflink[countnarr]{below}. - \expandafter\@trimandstore\the\everypar\@trimandstore - \everypar=\expandafter{\expandafter\@codetonarrskip\the\everypar}% - \expandafter\gmd@checkifEOL\@gobble} + \@xa\@trimandstore\the\everypar\@trimandstore + \everypar=\@xa{\@xa\@codetonarrskip\the\everypar}% + \@xa\gmd@checkifEOL\@gobble} % Simple, isn't it? (We gobble the `other' code delimiter. Despite of % |\egroup| it's \catother\ because it was touched by |\futurelet| % contained in |\@ifnextchar| in line \ref{ifContNarr}. And in line @@ -2113,8 +2159,8 @@ % |\grefstepcounter| macro, defined in \pk{gmverb}, is a~global % version of |\refstepcounter|, observing the redefinition made % to |\refstepcounter| by \pk{hyperref}. - \everypar=\expandafter{% - \expandafter\@codetonarrskip\the\gmd@preverypar}%^^A + \everypar=\@xa{% + \@xa\@codetonarrskip\the\gmd@preverypar}%^^A % the \cs{hy\+p\+er\+lab\+el\+@\+li\+ne} macro puts % a~hypertarget in a~|\raise| i.e., drives \TeX\ into the % horizontal mode so |\everypar| shall be issued. Therefore we @@ -2182,12 +2228,12 @@ \hskip\gmd@ldspaceswd% \advance\hangindent by\gmd@ldspaceswd% \xdef\settexcodehangi{% - \noexpand\hangindent=\the\hangindent% and also set the + \@nx\hangindent=\the\hangindent% and also set the % hanging indent setting for the same line comment case. BTW., % this |%| or rather lack of it costed me five hours of % debugging and rewriting. Active lineends require extreme % caution. - \noexpand\hangafter=1\space}%^^A~\noexpand\relax + \@nx\hangafter=1\space}%^^A~\@nx\relax \else% \glet\settexcodehangi=\@@settexcodehangi%\\ %|%| |\printlinenumber| here produced line numbers for blank lines @@ -2232,12 +2278,12 @@ \def\gmd@dolspaces{% \ifx\gmd@texcodespace\@let@token \@dsdirgfalse - \afterelsefi\settowidth{\gmd@spacewd}{\twelvespace}% + \afterfi{\settowidth{\gmd@spacewd}{\twelvespace}% \gmd@ldspaceswd=\z@ - \gmd@eatlspace% - \else\afterfi% about this smart macro and other of its family see - % \pk{gmutils} sec.\,3. - \par\gmd@typesettexcode + \gmd@eatlspace}% + \else\afterfi{% about this smart macro and other of its family see + % \pk{gmutils} sec.\,3. + \par\gmd@typesettexcode}% \fi} % And now, the iterating inner macro that'll eat the leading spaces. @@ -2247,12 +2293,12 @@ \advance\gmd@ldspaceswd by\gmd@spacewd% we don't % |\advance| it |\global|ly 'cause the current group may be closed % iff we meet |%| and then we'll won't indent the line anyway. - \afterelseiffifi\gmd@eatlspace + \afteriffifi\gmd@eatlspace \else - \if\code@delim\noexpand#1% + \if\code@delim\@nx#1% \gmd@ldspaceswd=\z@ \gmd@continuenarration#1%\label{ContNarr2} - \else \afterfifi\gmd@typesettexcode#1% + \else \afterfifi{\gmd@typesettexcode#1}% \fi \fi}% @@ -2272,19 +2318,19 @@ \newcommand*\gmd@charbychar[1]{% \ifhmode\prevhmodegtrue \else\prevhmodegfalse\fi - \if\code@delim\noexpand#1% - \afterelseiffifi\gmd@percenthack% to typeset |%| if a~comment + \if\code@delim\@nx#1% + \afteriffifi{\gmd@percenthack% to typeset |%| if a~comment % continues the~codeline. \endgroup% - \gmd@checkifEOLmixd% to see if next is |^^M| and then do |\par|. + \gmd@checkifEOLmixd}% to see if next is |^^M| and then do |\par|. \else% i.e., we've not met the code delimiter - \if\code@escape@char\noexpand#1% + \if\code@escape@char\@nx#1% \@dsdirgfalse% yes, just here not before the whole |\if| because % then we would discard checking for \ds\ directives doable by % the active |%| at the `old macrocode' setting. - \afterelsefifi\gmd@counttheline#1\scan@macro + \afterfifi{\gmd@counttheline#1\scan@macro}% \else - \afterfifi\gmd@EOLorcharbychar#1% + \afterfifi{\gmd@EOLorcharbychar#1}% \fi \fi} @@ -2301,10 +2347,10 @@ \if@countalllines\global\advance\c@codelinenum by\@ne \@newlinegfalse\fi \fi - \afterelsefi#1%\label{printhashone1}here we print |#1|. + \afterfi{#1}%\label{printhashone1}here we print |#1|. \else% i.e., |#1| is \emph{not} a~(very active) line end, \afterfi - \gmd@counttheline#1\gmd@charbychar% \label{printhashone2}or here + {\gmd@counttheline#1\gmd@charbychar}% \label{printhashone2}or here % we print |#1|. Here we would also possibly mark an environment % but there's no need of it because declaring an environment to % be marked requires a~bit of commentary and here we are after @@ -2343,7 +2389,7 @@ \def\gmd@narrcheckifds@ne#1{%^^A\typeout{narr@ne if ds \on@line}% \@dsdirgfalse\@ifnextchar<{% - \expandafter\gmd@docstripdirective\@gobble}{#1}} + \@xa\gmd@docstripdirective\@gobble}{#1}} % The macro below is used to look for the |%^^M| case to make % a~commented blank line make a~new paragraph. @@ -2351,7 +2397,7 @@ % \CodeDefIndex\gmd@checkifEOL \def\gmd@checkifEOL{% \gmd@countnarrationline - \everypar=\expandafter{\expandafter\@codetonarrskip% we add the + \everypar=\@xa{\@xa\@codetonarrskip% we add the % macro that'll insert a~vertical space if we leave the code and % enter the narration. \the\gmd@preverypar}% @@ -2361,7 +2407,7 @@ % We check if it's |%<|, a~\ds\ directive that is. \def\gmd@narrcheckifds{%^^A\typeout{narr if ds \on@line}% \@dsdirgfalse\@ifnextchar<{% - \expandafter\gmd@docstripdirective\@gobble}{\ignorespaces}} + \@xa\gmd@docstripdirective\@gobble}{\ignorespaces}} % In the `mixed' line case it should be a~bit more complex, though. On @@ -2369,7 +2415,7 @@ % \CodeDefIndex\gmd@checkifEOLmixd \def\gmd@checkifEOLmixd{% \gmd@countnarrationline - \everypar=\expandafter{\expandafter\@codetonarrskip\the\gmd@preverypar}% + \everypar=\@xa{\@xa\@codetonarrskip\the\gmd@preverypar}% % % \label{longlinethatshouldbebroken} \@afternarrgfalse\@aftercodegtrue @@ -2403,8 +2449,8 @@ \prevhmodegfalse\gmd@endpe% when taken out of |\ifhmode|, this % line caused some codeline numbers were typeset with % |\leftskip|${}=0$. - \everypar=\expandafter{% - \expandafter\@codetonarrskip\the\gmd@preverypar}% + \everypar=\@xa{% + \@xa\@codetonarrskip\the\gmd@preverypar}% \let\par\@@par% %^^A else %^^A \typeout{par of 1766 in NOT hmode \on@line}% @@ -2424,8 +2470,8 @@ \else \leftskip=\TextIndent \hangindent=\z@ - \everypar=\expandafter{% - \expandafter\@codetonarrskip\the\gmd@preverypar}% + \everypar=\@xa{% + \@xa\@codetonarrskip\the\gmd@preverypar}% %^^A \typeout{gmd@endpe in not prevhmode \on@line}% \fi} @@ -2572,16 +2618,16 @@ % if it'd be expandable. \gmd@preverypar={}% \else - \afterfi\expandafter\@trimandstore@ne\the\everypar\@trimandstore + \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% - \gmd@preverypar=\expandafter{\trimmed@everypar}% + \gmd@preverypar=\@xa{\trimmed@everypar}% \else - \gmd@preverypar=\expandafter{\the\everypar}% + \gmd@preverypar=\@xa{\the\everypar}% \fi} % We prefer not to repeat |#1| and |#2| within the |\if|s and we even % define an auxiliary macro because |\everypar| may contain some @@ -2696,17 +2742,19 @@ % case when no closing space is added. % And one more detail: +% \CodeDefIndex\gmd@bslashEOL \bgroup\catcode`\^^M=\active% -\firstofone{\egroup% \CodeDefIndex*{\^^M} - \def\^^M{\ \expandafter\ignorespaces^^M}} -% To make |\^^M| behave properly. If this definition was ommitted, it +\firstofone{\egroup% \CodeDefIndex*{\^^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| % would just expand to |\ | and thus not gobble the leading |%| of the % next line leave alone typesetting the \TeX\ code. I~type |\ | etc. % instead of just |^^M| which adds a~space itself because I~take % account of a~possibility of redefining the |\ | CS by the user, just % like in normal \TeX. -% \CodeDefIndex\gmd@bslashEOL -\let\gmd@bslashEOL=\^^M + + % We'll need it for restoring queer definitions for \docfm-compatibility. % % @@ -2721,12 +2769,12 @@ % lines commented out. % \CodeDefIndex\check@percent \AtBegInput{\long\def\check@percent#1{% - \expandafter\ifx\code@delim#1\else\afterfi#1\fi}} + \@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{% - \expandafter\def\expandafter\doprivateothers\expandafter{% + \@xa\def\@xa\doprivateothers\@xa{% \doprivateothers\do#1}}% % We also redefine an internal |\verb|'s macro |\gm@verb@eol| to put a~proper @@ -2736,7 +2784,7 @@ \obeylines% \CodeDefIndex\gm@verb@eol \AtBegInput{\def\gm@verb@eol{\obeylines% \def^^M{\verb@egroup\@latex@error{% - \noexpand\verb ended by end of line}% + \@nx\verb ended by end of line}% \@ifQueerEOL{\gmd@textEOL}{\@ehc}}}}% \endgroup @@ -2834,7 +2882,7 @@ % |\catcode| other than \catletter\ surely would be one of those % perversities. Therefore I~feel safe to take the character |a| as % a~benchmark letter. - \ifcat a\noexpand#1% + \ifcat a\@nx#1% \quote@char#1% \xdef\macro@iname{\maybe@quote#1}% global for symmetry with % line \ref{x123}. @@ -2844,7 +2892,7 @@ % \ref{stringing2} to be sure it is whole \catother\ for easy % testing for special indexentry formats, see line % \ref{pnametestDef} etc. - \afterelsefi\@ifnextcat{a}{\continue@macroscan}{\finish@macroscan}% + \afterfi{\@ifnextcat{a}{\continue@macroscan}{\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 @@ -2876,7 +2924,8 @@ \@ifnextcat{a}{\continue@macroscan}{\finish@macroscan}% } % The |\@ifnextcat| macro is defined analogously to |\@ifnextchar| but -% the test done by it is not |\ifx| but |\ifcat|. +% the test done by it is not |\ifx| but |\ifcat|. (Note it would'nt +% work for an active char as the `pattern'.) % \CodeDefIndex\quote@char \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 @@ -2901,10 +2950,10 @@ % \CodeDefine\@ifismember \long\def \@ifismember#1\of#2{% \long\def\in@@##1#1##2\in@@{% - \if\noexpand^^A##2\noexpand^^A\afterelsefi\gmd@@iffalse + \if\@nx^^A##2\@nx^^A\afterfi\gmd@@iffalse \else\afterfi\gmd@@iftrue \fi}% - \expandafter\in@@#2#1\in@@}% + \@xa\in@@#2#1\in@@}% % To hide the Booleans from \TeX\ in some contexts define % \CodeDefine\gmd@@iftrue \CodeDefine\gmd@@iffalse @@ -2969,7 +3018,7 @@ % a~case we give |\verb| another delimiter, namely |$|: \def\im@firstpar{[$]}%^^A$ \else\def\im@firstpar{}\fi - \expandafter \index@macro\im@firstpar\macro@iname\macro@pname + \@xa \index@macro\im@firstpar\macro@iname\macro@pname \maybe@marginpar\macro@pname \macro@pname \gmd@charbychar @@ -2983,7 +3032,7 @@ \def\maybe@marginpar#1{% %^^A\ifx#1\mname@tomarginpar \@ifundefined{gmd/2marpar/#1}{}{% - \expandafter\Text@Marginize\expandafter{\bslash#1}% |\expandafter|s + \@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 % argument to @@ -2991,7 +3040,7 @@ % contains the macro's name % without the escapechar so we added it here. % ^^A\gdef\mname@tomarginpar{} - \expandafter\g@relaxen\csname gmd/2marpar/#1\endcsname% we reset the switch. + \@xa\g@relaxen\csname gmd/2marpar/#1\endcsname% we reset the switch. }} % The inner macro indexing macro. |#1| is the |\verb|'s delimiter; @@ -3033,7 +3082,7 @@ % it's redefined to be empty (when we use |\index@macro| to % index not a~CS). \encapchar\IndexRefCs}% - \expandafter\special@index\expandafter{\@tempa}% We give the + \@xa\special@index\@xa{\@tempa}% We give the % indexing macro the argument expanded so that \pk{hyperref} may % see the explicit encapchar in order not to add its own % encapsulation of \verb+|hyperpage+ when the (default) @@ -3050,11 +3099,11 @@ %\CodeDefine\un@defentryze \CodeDefine\un@usgentryze \def\un@defentryze#1{% - \expandafter\g@relaxen\csname gmd/defentry/#1\endcsname + \@xa\g@relaxen\csname gmd/defentry/#1\endcsname \g@relaxen\last@defmark}% we care to clear the last definition % marker checked by |\changes|. \def\un@usgentryze#1{% - \expandafter\g@relaxen\csname gmd/usgentry/#1\endcsname} + \@xa\g@relaxen\csname gmd/usgentry/#1\endcsname} \@emptify\EntryPrefix% this macro seems to be obsolete now % (v0.98d). @@ -3179,13 +3228,13 @@ %\CodeDefine\@defentryze \CodeDefine\@usgentryze \long\def\@defentryze#1{% - \expandafter\let\csname gmd/defentry/\string#1\endcsname\gmd@justadot% The + \@xa\let\csname gmd/defentry/\string#1\endcsname\gmd@justadot% The % \LaTeX\ |\@namedef| macro could not be used since it's not `long'. % \CodeDefine\last@defmark \xdef\last@defmark{\string#1}}% we |\string| the argument 'cause it's % a~control sequence most probably. \long\def\@usgentryze#1{% - \expandafter\let\csname gmd/usgentry/\string#1\endcsname\gmd@justadot} + \@xa\let\csname gmd/usgentry/\string#1\endcsname\gmd@justadot} % Initialize |\envirs@toindex| \@emptify\envirs@toindex @@ -3229,7 +3278,7 @@ % \CodeDefine\text@indexmacro \long\def\text@indexmacro#1{% {\escapechar\m@ne \xdef\macro@pname{\xiistring#1}}% - \expandafter\quote@mname\macro@pname\relax% we process the CS's + \@xa\quote@mname\macro@pname\relax% we process the CS's % name char by char and quote MakeIndex controls. |\relax| is the % iterating macro's stopper. The scanned CS's quoted name shall be the % expansion of |\macro@iname|. @@ -3238,7 +3287,7 @@ \else\def\im@firstpar{}% \fi {\do@properindex% see line \ref{do@properindex}. - \expandafter \index@macro\im@firstpar\macro@iname\macro@pname}} + \@xa \index@macro\im@firstpar\macro@iname\macro@pname}} % The macro defined below (and the next one) are executed only before % a~\catother\ macro's name i.e.\ a~nonempty sequence of \catother\ @@ -3279,16 +3328,16 @@ % \CodeDefine\text@indexenvir \long\def \text@indexenvir#1{% \edef\macro@pname{\xiistring#1}% - \if\bslash\expandafter\@firstofmany\macro@pname\@@nil% if + \if\bslash\@xa\@firstofmany\macro@pname\@@nil% if % |\string|ed |#1| begins with a~backslash, we will gobble it % to make MakeIndex not see it. - \edef\@tempa{\expandafter\@gobble\macro@pname}% + \edef\@tempa{\@xa\@gobble\macro@pname}% \@tempswatrue \else \let\@tempa\macro@pname \@tempswafalse \fi - \expandafter\quote@mname\@tempa\relax% \label{quote@mname comm}we + \@xa\quote@mname\@tempa\relax% \label{quote@mname comm}we % process |\sting|ed |#1| char by char and quote MakeIndex % controls. |\relax| is the iterating macro's stopper. The quoted % |\string|ed |#1| shall be the expansion of |\macro@iname|. @@ -3333,7 +3382,7 @@ % \CodeDefIndex\Code@MarginizeMacro \long\def\Code@MarginizeMacro#1{{\escapechar\m@ne - \expandafter\glet\csname gmd/2marpar/\string#1\endcsname\gmd@justadot + \@xa\glet\csname gmd/2marpar/\string#1\endcsname\gmd@justadot %^^A \xdef\mname@tomarginpar{\xiistring#1} }} @@ -3369,7 +3418,7 @@ \else \edef\@tempa{##1}\@tempswafalse \fi - \expandafter\quote@mname\@tempa\relax% see line + \@xa\quote@mname\@tempa\relax% see line % \ref{quote@mname comm} \& subs. for commentary. {\if@tempswa \def\quoted@eschar{\quotechar\bslash}% @@ -3476,14 +3525,14 @@ % \CodeDefIndex\addto@estomarginpar \long\def\addto@estomarginpar#1{% - \edef\@tempa{\noexpand\do{\xiistring#1}}% we |\string| the argument to + \edef\@tempa{\@nx\do{\xiistring#1}}% we |\string| the argument to % allow it to be a~control sequence. - \expandafter\addtomacro\expandafter\envirs@tomarginpar\expandafter{\@tempa}} + \@xa\addtomacro\@xa\envirs@tomarginpar\@xa{\@tempa}} % \CodeDefIndex\addto@estoindex \long\def\addto@estoindex#1{% - \edef\@tempa{\noexpand\do{\xiistring#1}} - \expandafter\addtomacro\expandafter\envirs@toindex\expandafter{\@tempa}} + \edef\@tempa{\@nx\do{\xiistring#1}} + \@xa\addtomacro\@xa\envirs@toindex\@xa{\@tempa}} % And now a~command to mark a~`usage' occurrence of a~CS, environment @@ -3624,13 +3673,13 @@ %\CodeDefine*{oldmc*} \let\oldmc\macrocode \let\endoldmc\endmacrocode -\@namelet{oldmc*}{macrocode*} -\@namelet{endoldmc*}{endmacrocode*} +\n@melet{oldmc*}{macrocode*} +\n@melet{endoldmc*}{endmacrocode*} % Now we arm \env{oldmc} and \env{olmc*} with the % the macro looking for |% \end|\arg{envir name}. \addtomacro\oldmc{\@oldmacrocode@launch}% -\expandafter\addtomacro\csname oldmc*\endcsname{% +\@xa\addtomacro\csname oldmc*\endcsname{% \@oldmacrocode@launch} % \CodeDefIndex\@oldmacrocode@launch @@ -3642,7 +3691,7 @@ \ttverbatim \gmd@DoTeXCodeSpace% \@makeother\|% 'cause |\ttverbatim| doesn't do that. \MakePrivateLetters% see line \ref{MPL}.\par - % ^^A \expandafter\@makeother\code@delim + % ^^A \@xa\@makeother\code@delim \docstrips@percent \@makeother\>% % sine qua non of the automatic delimiting is replacing possible % |*|\catother in the environment's name with |*|\catletter. @@ -3650,7 +3699,7 @@ % the end. We also assume the environment's name consists only of % character tokens whose catcodes (except of |*|) will be the same % in the verbatim text. - \expandafter\gmd@currenvxistar\@currenvir*\relax + \@xa\gmd@currenvxistar\@currenvir*\relax \@oldmacrocode} \bgroup\catcode`*11 @@ -3691,14 +3740,14 @@ ] \def\gmd@oldmcfinis{% - \expandafter\CodeDelim\stored@code@delim + \@xa\CodeDelim\stored@code@delim \gmd@mchook}% see line \ref{gmd@mchook} % \CodeDefine\VerbMacrocodes \def\VerbMacrocodes{% \let\macrocode\oldmc - \@namelet{macrocode*}{oldmc*}} + \n@melet{macrocode*}{oldmc*}} % To handle \ds\ directives in the code (in the old macrocodes @@ -3720,10 +3769,10 @@ % \nlpercent|\gmd@charbychar| token. % ^^A \typeout{code if ds \on@line}% \if@dsdir\@dsdirgfalse - \if\noexpand<\noexpand#2\afterelsefifi\gmd@docstripdirective - \else\afterfifi\twelvepercent#1#2% + \if\@nx<\@nx#2\afterfifi\gmd@docstripdirective + \else\afterfifi{\twelvepercent#1#2}% \fi - \else\afterfi\twelvepercent#1#2% + \else\afterfi{\twelvepercent#1#2}% \fi} % % \begin{environment}{macro} @@ -3756,7 +3805,7 @@ % version: \@namedef{macro*}{\let\gmd@ifonetoken\@secondoftwo\macro} % \CodeDefIndex*\endmacro* -\expandafter\let\csname endmacro*\endcsname\endmacro +\@xa\let\csname endmacro*\endcsname\endmacro % Note that \env{macro} and \env{macro*} have the same effect for % more-than-one-token arguments thanks to |\gmd@ifonetoken|'s meaning % inside unstarred \env{macro} (it checks whether the argument is @@ -3795,10 +3844,10 @@ \def\@tempb{#3}% We hide |#3| from \TeX\ in case it's |\if...| or % so. \nlpercent|\@tempa| is used in \nlpercent|\gmd@ifsingle|. \gmd@ifsingle#3\@@nil - \afterelsefi\expandafter#1\@tempb% + \afterfi{\@xa#1\@tempb}% \else - \edef\@tempa{\expandafter\string\@tempb}% - \afterfi\expandafter#2\expandafter{\@tempa}% + \edef\@tempa{\@xa\string\@tempb}% + \afterfi{\@xa#2\@xa{\@tempa}}% \fi} % Now, define the mysterious |\Hybrid@DefMacro| and |\Hybrid@DefEnvir| % macros. They mark their argument with a~certain subtlety: they put @@ -3825,16 +3874,16 @@ %\CodeDefine\gmd@evpaddonce \long\def\gmd@evpaddonce#1{% \stepnummacro\gmd@oncenum - \expandafter\long\expandafter\edef% \CodeUsgIndex*{NeuroOncer} + \@xa\long\@xa\edef% \CodeUsgIndex*{NeuroOncer} \csname gmd/evp/NeuroOncer\gmd@oncenum\endcsname{% - \noexpand\g@relaxen + \@nx\g@relaxen \csname gmd/evp/NeuroOncer\gmd@oncenum\endcsname}% Why does it % work despite it shouldn't? Because when the CS got with % \nlpercent|\csname...\endcsname| is undefined, it's equivalent % |\relax| and therefore unexpandable. That's why it passes % \nlpercent|\edef| and is able to be assigned. - \expandafter\addtomacro\csname gmd/evp/NeuroOncer\gmd@oncenum\endcsname{#1}% - \expandafter\addto@hook\expandafter\everypar\expandafter{% + \@xa\addtomacro\csname gmd/evp/NeuroOncer\gmd@oncenum\endcsname{#1}% + \@xa\addto@hook\@xa\everypar\@xa{% \csname gmd/evp/NeuroOncer\gmd@oncenum\endcsname}% } @@ -3848,8 +3897,8 @@ % in Polish) although there's no \TeX nical obstacle to do % so. Therefore we define the \env{environment}, because of \ae^^B % sthetic and psychological reasons. -\expandafter\let\expandafter\environment\csname macro*\endcsname -\expandafter\let\expandafter\endenvironment\csname endmacro*\endcsname +\@xa\let\@xa\environment\csname macro*\endcsname +\@xa\let\@xa\endenvironment\csname endmacro*\endcsname % \end{environment} % @@ -3881,18 +3930,18 @@ % \CodeDefIndex\dont@index \long\def\dont@index#1{% - \def\@tempa{\noexpand#1}% My \TeX\ Guru's trick to deal with |\fi| + \def\@tempa{\@nx#1}% My \TeX\ Guru's trick to deal with |\fi| % and such, i.e., to hide from \TeX\ when it is processing a~test's % branch without expanding. \if\@tempa.% a~dot finishes expelling \else \if\@tempa,% The list this macro is put before may % contain commas and that's O.K., we just continue the work. - \afterelsefifi\dont@index + \afterfifi\dont@index \else% what is else shall off the Index be expelled. {\escapechar\m@ne \xdef\@tempa{\string#1}}% - \expandafter\let% + \@xa\let% \csname gmd/iexcl/\@tempa\endcsname=\gmd@iedir% In the default % case explained e.g.\ by the macro's name, the last macro's % meaning is such that the test in line \ref{iexcltest} will @@ -4431,7 +4480,7 @@ \if\bslash\last@defmark\else\last@defmark\fi}% \ifx\last@defmark\bslash\let\@tempb\last@defmark\fi% %^^A \typeout{last dm @tempb: \@tempb}% (debugging) - % ^^A~\expandafter\quote@mname\macro@pname\relax + % ^^A~\@xa\quote@mname\macro@pname\relax \fi \else%the first argument isx not |\generalname| i.e., %a~particular CS is specified by it (if some day one @@ -4440,9 +4489,9 @@ \@tempswatrue {\escapechar\m@ne \xdef\@tempb{\string#1}} - % ^^A~\expandafter\quote@mname\@tempb\relax + % ^^A~\@xa\quote@mname\@tempb\relax \fi - \protected@edef\@tempa{\noexpand\glossary{% + \protected@edef\@tempa{\@nx\glossary{% \if\relax\GeneralName\relax\else \GeneralName% it's for the |\DocInclude| case to precede % every |\changes| of the same file with the file name, cf.\ line @@ -4513,7 +4562,7 @@ % date of \TeX\ Version 0.}\QueerEOL\label{TeXVer0} % see \gmiflink[personalchanges]{below}. \edef\@tempa{% - \noexpand\g@addto@macro\noexpand\glossary@prologue{% + \@nx\g@addto@macro\@nx\glossary@prologue{% The changes \if\relax\GeneralName\relax\else of \GeneralName\space\fi earlier than @@ -4618,7 +4667,7 @@ %^^A \end{docstrips} % The MakeIndex shell command for the glossary should look as % follows: -% \[\hbox{|makeindex -r -s gmglo.ist -o |\<myfile>|.gls |\<myfile>|.glo|}\] +% \[|makeindex -r -s gmglo.ist -o |\<myfile>|.gls |\<myfile>|.glo|\] % ^^B % ^^B makeindex -r -s gmglo.ist -o <myfile>.gls <myfile>.glo % ^^B @@ -4627,11 +4676,11 @@ % default settings and the |-o| option with the subsequent filename % defines the name of the output. % -% \begin{quotation}The |\GlossaryPrologue| macro is used to place a -% short message above the -% glossary into the document. It is implemented by redefining |\glossary@prologue|, -% a macro which holds the default text. We better make it a long macro to allow -% |\par| commands in its argument.\end{quotation} +% \begin{quotation}The |\GlossaryPrologue| macro is used to place +% a~short message above the glossary into the document. It is +% implemented by redefining |\glossary@prologue|, a macro which +% holds the default text. We better make it a long macro to allow +% |\par| commands in its argument.\end{quotation} % % \CodeDefine\GlossaryPrologue \long\def\GlossaryPrologue#1{\@bsphack @@ -4779,7 +4828,7 @@ \typeout{\twelvepercent\space\string\chschange{% \fileversion}{\the\year/\the\month/\the\day}{\the\c@CheckSum}} \typeout{\twelvepercent\space\string\chschange{\fileversion}{% - \expandafter\@gobbletwo\the\year/\the\month/\the\day}{%\relax + \@xa\@gobbletwo\the\year/\the\month/\the\day}{%\relax % with two di\-g\-it year in case you use |\ChangesStart|. \the\c@CheckSum}}} @@ -5064,7 +5113,7 @@ % \env{codelinenum}. \def\thefilediv{\aalph{\filedivname}}% The files will be numbered % with letters, lowercase first. - \expandafter\let\csname the\filedivname\endcsname=\thefilediv% This + \@xa\let\csname the\filedivname\endcsname=\thefilediv% This % li\-ne lets |\the|\<chapter> etc.\ equal |\thefilediv|. \def\filesep{\thefilediv-}% File separator (identifier) for the index. \let\filekey=\@gobble @@ -5082,7 +5131,7 @@ % defined} \gdef\@oddfoot{% The footer of the file pages will be its name and, % if there is a~file info, also the date and version. - \expandafter\ifx\csname ver@\currentfile\endcsname\relax + \@xa\ifx\csname ver@\currentfile\endcsname\relax File \thefilediv: {\ttfamily\currentfile} % \else \GetFileInfo{\currentfile}% @@ -5093,7 +5142,7 @@ \hfill\thepage}% \glet\@evenfoot\@oddfoot% see line \ref{oneside}. % ^^A \show\filedivname% for debug - \expandafter\def\csname\filedivname name\endcsname{File}% we + \@xa\def\csname\filedivname name\endcsname{File}% we % redefine the name of the proper division to `File'. \ifx\filediv\section \let\division=\subsection @@ -5112,7 +5161,7 @@ % \changes{v0.98c}{06/9/10}{added and a~bug fixed in \cs{docincludeaux}} \def\SetFileDiv#1{% \edef\filedivname{#1}% - \expandafter\let\expandafter\filediv\csname#1\endcsname} + \@xa\let\@xa\filediv\csname#1\endcsname} % \subdivision{\cs{SelfInclude}} % @@ -5403,7 +5452,7 @@ % |\footnotemark| hidden in |\thanks| during |\protected@xdef| % (and to let it be executed during the typesetting, of course). }% end of the comma-|\and|'s group. - \expandafter\filediv\incl@filedivtitle + \@xa\filediv\incl@filedivtitle \@thanks \g@relaxen\@author \g@relaxen\@title \g@relaxen\@date \g@emptify\@thanks @@ -5426,6 +5475,108 @@ % And the counterpart, if you change your mind: \newcommand*\SkipFilesAuthors{\@fshdafalse} + +% \subdivision{The File's Date and Version Information} + + +% 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{% + \def\filedate{##1}% + \def\fileversion{##2}% + \def\fileinfo{##3}}% + \edef\@tempa{\csname ver@#1\endcsname}% + \@xa\@tempb\@tempa\relax? ? \relax\relax} + +% Since we may documentally input files that we don't load, as \docfm\ +% e.g., let's define a~declaration to be put (in the comment layer) +% before the line(s) containing |\Provides...|. The |\FileInfo| +% command takes the stuff till the closing |]| and subsequent line +% end, extracts from it the info and writes it to the \file{.aux} and +% rescans the stuff. \eTeX\ provides a~special primitive for that +% 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} + +\bgroup +\catcode`!\z@ +\catcode`<\@ne +\catcode`>\tw@ +\let\do\@makeother +\do\ \do\{\do\}\do\^^M\do\\%\CodeEscapeChar\! +!firstofone<!egroup% +!def!gmd@fileinfo#1Provides#2{#3}#4[#5]#6 +<% +!egroup% +!gmd@writeFI<#2><#3><#5>% +!gmd@docrescan<#1Provides#2{#3}#4[#5]#6 +>% +>% \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}% + }% + \immediate\closeout\gmd@docrescanfile + \@@input\jobname.docrescan +} + + +% And, for the case the input file doesn't contain |\Provides...|, +% 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] + } + + % \CodeDefIndex\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}% + \endgroup} + +% 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} + + % % % \subdivision{Miscellanea} @@ -5437,10 +5588,15 @@ % \CodeDefine\IndexInput % \changes{v0.98b}{06/09/07}{\cs{StoreMacro}ing and \cs{RestoreMacro}ing % \cs{code@delim} added} -\def\IndexInput#1{% - \StoreMacro\code@delim - \CodeDelim*\^^A% - \DocInput{#1}\RestoreMacro\code@delim} +\bgroup\obeylines +\firstofone{\egroup + \def\IndexInput#1{% + \StoreMacro\code@delim% + \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}} % How does it work? We assume in the input file is no explicit % \<char1>. 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 @@ -5464,7 +5620,7 @@ \def\@tempa{%\CodeDefIndex\gmd@skipgmltext \def\gmd@skipgmltext{\g@emptify\gmd@skipgmltext#1}}% \@tempa - \expandafter\AtBegInput\expandafter{\@tempa}% + \@xa\AtBegInput\@xa{\@tempa}% \renewenvironment{gmlonely}{% \StraightEOL \@fileswfalse% to forbid writing to \pk{.toc}, \pk{.idx} etc. @@ -5552,34 +5708,33 @@ {\def\AmSTeX{\leavevmode\hbox{$\mathcal A\kern-.2em\lower.376ex% \hbox{$\mathcal M$}\kern-.2em\mathcal S$-\TeX}}}{} -\@ifundefined{BibTeX} - {\def\BibTeX{{\rmfamily B\kern-.05em% - \textsc{i\kern-.025em b}\kern-.08em% - \TeX}}}{} +\DeclareLogo\BibTeX{{\rmfamily B\kern-.05em% + \textsc{i\kern-.025em b}\kern-.08em% + \TeX}} + -\@ifundefined{SliTeX} - {\def\SliTeX{{\rmfamily S\kern-.06emL\kern-.18em\raise.32ex\hbox - {\scshape i}\kern -.03em\TeX}}}{} +\DeclareLogo\SliTeX{{\rmfamily S\kern-.06emL\kern-.18em\raise.32ex\hbox + {\scshape i}\kern -.03em\TeX}} -\@ifundefined{PlainTeX}{\def\PlainTeX{\textsc{Plain}\kern2pt\TeX}}{} +\DeclareLogo\PlainTeX{\textsc{Plain}\kern2pt\TeX} -\@ifundefined{Web}{\def\Web{\textsc{Web}}}{} +\DeclareLogo\Web{\textsc{Web}} % There's also the \LaTeXpar\ logo got with the |\LaTeXpar| macro % provided by \pk{gmutils}. And here \TeXbook's logo: -\def\TeXbook{The \TeX book} +\DeclareLogo[The TeX book]\TeXbook{The \TeX book} -\@ifundefined{eTeX}{\def\eTeX{$\varepsilon$\TeX}}{}% The \eTeX\ manual +\DeclareLogo\eTeX{$\varepsilon$\TeX}% The \eTeX\ manual % uses `$\varepsilon$-\TeX' but that would look strange in \pdfeTeX. -\@ifundefined{pdfeTeX}{\def\pdfeTeX{pdf\eTeX}}{} +\DeclareLogo\pdfeTeX{pdf\eTeX} -\@ifundefined{pdfTeX}{\def\pdfTeX{pdf\TeX}}{} +\DeclareLogo\pdfTeX{pdf\TeX} -\@ifundefined{XeTeX}{\def\XeTeX{X\kern-.125em\relax +\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}% 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 @@ -5587,51 +5742,6 @@ \@ifundefined{ds}{\def\ds{DocStrip}}{} -% 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{% - \def\filedate{##1}% - \def\fileversion{##2}% - \def\fileinfo{##3}}% - \edef\@tempa{\csname ver@#1\endcsname}% - \expandafter\@tempb\@tempa\relax? ? \relax\relax} - -% Since we may documentally input files that we don't load, as \docfm\ -% e.g., let's define 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] - } - - % \CodeDefIndex\gmd@providefii -\def\gmd@providefii#1[#2]{%\\ - % (we \emph{don't} write the file info to \pk{.log}) - \expandafter\xdef\csname ver@#1\endcsname{#2}% - \endgroup} - -% 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} - - % \gmhypertarget[CDAnd]{Finally,} a~couple of macros for documenting % files playing with |%|'s % catcode(s). Instead of |%| I~used |&|. They may be at the end @@ -6199,13 +6309,14 @@ \bgroup\catcode`\^^M\active \firstofone{\egroup% \def\@NoEOF#1^^M{% - \@relaxen\EOFMark\expandafter\noexpand\endinput^^M}} + \@relaxen\EOFMark\@xa\@nx\endinput^^M}} \def\NoEOF{\QueerEOL\@NoEOF} % \label{NoEOF} As you probably see, |\NoEOF| has also the % |\endinput| effect. + \endinput %^^A~\docstrip %</package> @@ -6256,10 +6367,31 @@ % automatic (no more need of \cs{doctrip(s)} declarations). Moreover, % some minor changes due to \TeX ing The Source.} % +% \changes{v0.99b}{2007/01/01}{Thanks to the \cs{edverbs} declaration +% in the class, displayed shortverbs simplified; Emacs mode changed to +% doctex. Author's true name more exposed} +% +% \changes{v0.99c}{2007/03/02}{A~bug fixed in \cs{DocInput} and all +% \cs{expandafter}s changed to \cs{@xa} and \cs{noexpand}s to +% \cs{@nx}} +% +% \changes{v0.99c}{2007/03/12}{The \TeX-related logos now are declared +% with \cs{DeclareLogo} provided in \pk{gmutils}} +% +% \changes{v0.99d}{2007/04/13}{\cs{afterfi} \& pals made two-argument} +% +% \changes{v0.99d}{2007/04/24}{\cs{@namelet} renamed to \cs{n@melet} +% to solve a~conflict with the \pk{beamer} class (in \pk{gmutils} at +% first)} +% +% \changes{v0.99e}{2007/04/29}{a~bug fixed in \cs{DocInput} and +% \cs{IndexInput}} +% +% % \Finale % (For my GNU Emacs:) %%% Local Variables: -%%% mode: latex -%%% TeX-master: "e:/LaTeX/TeXGuru/gmdoc/gmdocDoc" +%%% mode: doctex +%%% TeX-master: "../../../../LaTeX/TeXGuru/gmdoc/gmdocDoc.tex" %%% End: |