diff options
author | Karl Berry <karl@freefriends.org> | 2008-08-13 23:50:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-08-13 23:50:04 +0000 |
commit | 95c334e5b7d0129823f8c4afc2a73cf6817f98ff (patch) | |
tree | 3f8b298c65cf02dd70d5a587664d42a507209726 /Master/texmf-dist/tex/latex/gmdoc | |
parent | fe937c977dab62691fe93e39afc85bc7ceb59990 (diff) |
gmdoc update (13aug08)
git-svn-id: svn://tug.org/texlive/trunk@10314 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/gmdoc')
-rw-r--r-- | Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty | 880 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls | 13 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/gmdoc/gmoldcomm.sty | 6 |
3 files changed, 591 insertions, 308 deletions
diff --git a/Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty b/Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty index 2532d3e7608..be0dbaefe66 100644 --- a/Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty +++ b/Master/texmf-dist/tex/latex/gmdoc/gmdoc.sty @@ -58,14 +58,15 @@ % \chschange{v0.99j}{2008/8/3}{5266} % \chschange{v0.99k}{2008/8/4}{5261} % \chschange{v0.99l}{2008/8/6}{5225} -% \chschange{v0.99l}{2008/8/6}{5233} +% \chschange{v0.99m}{2008/8/9}{5356} +% \chschange{v0.99m}{2008/8/13}{5354} % \ifnum\catcode`\@=11 % Why this test here---will come out in chapter % \gmiflink{The Driver}. ^^A~( the very first line % ^^A and about coming out already! ;-) \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{gmdoc} - [2008/08/06 v0.99l a documenting package (GM)] + [2008/08/06 v0.99m a documenting package (GM)] \fi % % @@ -214,8 +215,8 @@ % \end{verse} % % These drivers typeset the respective files from the -%\[\hbox{\file{.../texmf-dist/source/latex/base}}\] -% directory of the \TeX Live2005 distribution (they only read that +%\[\hbox{\file{…/texmf-dist/source/latex/base}}\] +% directory of the \TeX Live2007 distribution (they only read that % directory). % % Probably you should redefine the |\BasePath| macro in them @@ -322,18 +323,18 @@ % % The user should just write \hisher\ splendid code and brilliant % commentary. In the latter \heshe\ may use usual \LaTeXpar\ commands. -% The only requirement is, if an argument is divided in two -% lines, to end such a~dividing line with \TextUsage*{^^B} sequence -% that'll enter the (active) \<char2> which shall gobble the line end. -% ^^A~and the leading code delimiter of the next line---obsoleted by -% ^^A~making % ignored in the commentary. +% The only requirement is, if an argument is divided in two lines, to +% end such a~dividing line with \TextUsage*{\^^M} (|\|\<line end>) or with +% \TextUsage*{^^B} sequence that'll enter the (active) \<char2> which +% shall gobble the line end. ^^A~and the leading code delimiter of +%^^A % the next line---obsoleted by ^^A~making % ignored in the commentary. % % Moreover, if \heshe\ wants to add a~meta-comment i.e., a~text that % doesn't appear in the code layer nor in the narrative, \heshe\ may % use the \TextUsage*{^^A} sequence that'll be read by \TeX\ as % \<char1>, which -% is in \gmdoc\ active and defined to gobble the stuff between itself -% and the next line end. +% in \gmdoc\ is active and defined to gobble the stuff between itself +% and the line end. % % Note that |^^A| behaves much like comment char % although it's active in fact: it re|\catcode|s the special @@ -573,9 +574,24 @@ % Talking of line numbering further, a~tradition seems to exist to % number only the codelines and not to number the lines of % commentary. That's the default behaviour of \pk{gmdoc} but, if -% someone wants the comment lines to be numbered too, \heshe\ is -% provided the \TextUsage*{countalllines} option. ^^A( -% {\LineNumFont 441}\,Then the narration acquires a~bit biblical look ;-), +% someone wants the comment lines to be numbered too, which may be +% convenient for reference purposes, \heshe\ is +% provided the \TextUsage*{countalllines} option. This option switches +% things to use the \cs{inputlineno} primitive for codeline numbers so +% you get the numbers of the source file instead of number only of the +% codelines. Note however, that there are no hypertargets made to the +% narration lines and the value of \cs{ref} is the number of the most +% recent codeline. +% +% Moreover, if \heshe\ wants to get the narration lines' number +% printed, there is the starred version of that option, +% \TextUsage*{countalllines*}. I~imagine someone may use it for +% debug. This option is not finished in details, it causes errors with +% \cs{addvspace} because it puts a~hyperlabel at every line. When it +% is in force, all the index entries are referenced +% with the line numbers and +%% ^^A( +% {\LineNumFont 441}\, the narration acquires a~bit biblical look ;-), % {\LineNumFont 442}\,as shown in this short example. This option is intended % {\LineNumFont 443}\,for the draft versions and it is not perfect (as if anything % {\LineNumFont 444}\,in this package was). As you see, the lines @@ -592,6 +608,9 @@ % lines are numbered) and that's the default, or with the page numbers, if % the \TextUsage*{pageindex}\label{indexoptions} option is set. % +% The references in the change history are of the same: when index is +% line number, then the changes history too. +% % \stanza % By default, \gmdoc\ excludes some 300 \acro{CS}s from being indexed. % They are the most common \acro{CS}s, \LaTeX\ internal @@ -631,10 +650,17 @@ % Another space formatting option is \TextUsage*{codespacesgrey} % suggested by Will Robertson. It makes the spaces of code visible % only not black but grey. The name of their colour is -% |codespacesgrey| and by default it's defined as |{gray}{.5}|, you +% |visspacesgrey| and by default it's defined as |{gray}{.5}|, you % can change it with \pk{xcolor}'s |\definecolor|. There is also an % \acro{OCSR} declaration \TextUsage\CodeSpacesGrey. % +% If for any reason you wish the code spaces blank in general and +% visible and grey in \env{verbatim*}s, use the declaration +% \TextUsage\VisSpacesGrey\ of the \pk{gmverb} package. If you like +% a~little tricks, you can also specify +% |codespacesgrey, codespacesblank| in \pk{gmdoc} options (in this +% order). +% % \subdivision{The Packages Required} % % \pk{gmdoc} requires (loads if they're not loaded yet) some other @@ -1507,6 +1533,11 @@ % verbatim and without a~backslash, e.g., |\env{an environment}| % produces \env{an environment}. % +% For usage in the in-line comments there are \TextUsage\incs\ and +% \TextUsage\inenv\ commands that take analogous arguments and precede +% the typeset command and environment names with a~|%| if at the +% beginning of a~new line. +% % 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 @@ -1678,11 +1709,15 @@ % One of my goals while writing \gmdoc\ was to make compilation of % \docfm-like files with \gmdoc\ possible. I~cannot guarantee the goal % has been reached but I~\emph{did} compile \pk{doc.dtx} with not -% a~smallest change of that file (actually, there was a~tiny little buggie in -% line 3299 which I~fixed remotely with |\AfterMacrocode| tool written -% specially for that). So, -% if you wish to compile a~\docfm-like file with my humble package, -% just try. +% a~smallest change of that file (actually, there was a~tiny little +% buggie in line 3299 which I~fixed remotely with +% \cs{AfterMacrocode} tool written specially for that). So, if +% you wish to compile a~\docfm-like file with my humble package, just +% try. +% +% \TextUsage\AfterMacrocode\arg{mc number}\arg{the stuff} defines +% control sequence \cs{gmd@mchook}\<mc number> with the meaning \<the\ +% stuff> and every \env{oldmc} and, when % % The \docfm\ commands most important in my opinion are supported by % \gmdoc. Some commands, mostly the obsolete in my opinion, are not @@ -1715,7 +1750,7 @@ % and |\blaargh|'s definition is |{foo}|, you'll get %\[|\alittlemacro %| change it to foo\] % (Note that `my' \env{macrocode} doesn't require -% the magical |% \end|.) +% the magical \verb*|% \end|.) % % If you are used to the traditional (\docfm's) \env{macrocode} and still wish to % use \gmdoc\ new way, you have at least two options: there is the @@ -1723,10 +1758,11 @@ % \env{macrocode} (it also has the starred version), that's the first % option (I~needed the traditional behaviour once in this % documentation, find out where \& why). The other is to write -% \TextUsage\VerbMacrocodes. That declaration (\acro{OCSR}) redefines +% \TextUsage\OldMacrocodes. That declaration (\acro{OCSR}) redefines % \env{macrocode} and \env{macrocode*} to behave the traditional way. % (It's always executed by |\OldDocInput| and |\olddocIncludes|.) % +% % \stanza % For a~more detailed discussion of what is \docfm-compatible and how, % see the code section \gmiflink[doccompa]{\docfm-Compatibiliy}. @@ -1741,7 +1777,7 @@ % \cs{ProvidesPackage/Class}. % %\begin{verbatim} -%% \iffalse we skip the driver +%% \skiplines we skip the driver %\ifnum\catcode`\@=12 % %\documentclass[outeroff,pagella]{gmdocc} @@ -1762,9 +1798,17 @@ %\afterfi{\end{document}} % %\fi% of driver pass -%%\fi +%%\endskiplines %\end{verbatim} % +% The advantage of \TextUsage\skiplines…\TextUsage\endskiplines\ over +% |\iffalse…\fi| is that the latter has to contain balanced \cs{if}s +% and \cs{fi}s while the former hasn't because it sanitizes the +% stuff. More precisely, it uses the \cs{dospecials} list, so it +% sanitizes also the braces. +% +% Moreover, when the |countalllines(*)| option is in force, +% |\skipfiles|…|\endskipfiles| keeps the score of skipped lines. % % \label{Driver} % {\def\CommonEntryCmd{UsgEntry}% @@ -1778,7 +1822,8 @@ \ifnum\catcode`\@=12 % \CodeUsgIndex*{outeroff} \CodeUsgIndex*{mwrep} -\documentclass[outeroff,debug,mwrep,pagella]{gmdocc} +\documentclass[countalllines, codespacesgrey, outeroff, debug, mwrep, +pagella]{gmdocc} %^^A~ \OnlyDescription %^^A~ \usepackage{graphics} %^^A~ \usepackage{eufrak}% specially for |\continuum| of \pk{gmutils} @@ -1788,12 +1833,15 @@ \pk{gmdocc.cls}} \author{Grzegorz `Natror' Murzynowski} \date{August 2008} + +%|%\includeonly{gmoldcomm}| +%^^A\includeonly{gmeometric,gmoldcomm} \begin{document} -%\iffalse +%\skiplines \emptify\udigits % because orig. def. raises an error `\cs{@secondoftwo} has % an extra \}' -%\fi +%\endskiplines \maketitle \setcounter{page}{2}% \pk{hyperref} cries if it sees two pages @@ -1848,7 +1896,7 @@ % % For debug \catcode`\^^C=9\relax -% we set the |\catcode| of this char to \catactive\ in the comment +% We set the |\catcode| of this char to \catactive\ in the comment % layer. % \catcode`\^^C\active % @@ -1896,6 +1944,8 @@ % %\subdivision{The Package Options} % +\RequirePackage{gmutils}% includes redefinition of \incs{newif} to make +% the switches \incs{protected} \RequirePackage{xkeyval}% we need key-vals later, but maybe we'll make % the option key-val as well. % @@ -1916,8 +1966,16 @@ % lines. \newif\if@countalllines +\newif\if@printalllinenos + +\DeclareOption{countalllines}{% + \@countalllinestrue + \@printalllinenosfalse} + +\DeclareOption{countalllines*}{% + \@countalllinestrue + \@printalllinenostrue} -\DeclareOption{countalllines}{\@countalllinestrue} % Unlike in \docfm , indexing the macros is the default and the % default reference is the code line number. @@ -1976,14 +2034,15 @@ \DeclareOption{codespacesblank}{% - \AtBeginDocument{\CodeSpacesBlank}} + \AtEndOfPackage{% to allow \inverb|codespacesgrey, codespacesblank| + \AtBeginDocument{\CodeSpacesBlank}}} \DeclareOption{codespacesgrey}{% % \changes{v0.99l}{2008/08/06}{added due to Will Robertson's % suggestion} \AtEndOfPackage{% to put the declaration into the begin-document - % hook after definition of \inverb|\visiblespace|. + % hook after definition of \incs{visiblespace}. \AtBeginDocument{\CodeSpacesGrey}}} \ProcessOptions @@ -1993,8 +2052,9 @@ % % We require another package of mine that provides some tricky macros % analogous to the \LaTeX\ standard ones, such as |\newgif| and -% |\@ifnextcat|. -\RequirePackage{gmutils}[2008/08/03] +% |\@ifnextcat|. Since 2008/08/08 it also makes \cs{if…} switches +% \cs{protected} (redefines \cs{newif}) +\RequirePackage{gmutils}[2008/08/08] % A~standard package for defining colours, \RequirePackage{xcolor} @@ -2159,7 +2219,7 @@ % short below display skip half of the normal. \advance\belowdisplayshortskip by\smallskipamount \advance\belowdisplayshortskip by-1\smallskipamount% We advance - % \nlpercent\cs{be\+low\+dis\+play\+short\+skip} forth and back to + % \incs{be\+low\+dis\+play\+short\+skip} forth and back to % give it the \nlpercent\cs{small\+skip\+am\+ount}'s shrink- and % stretchability components. \topsep=\stanzaskip @@ -2243,35 +2303,37 @@ \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. + % |\@currentlabel| after our group.\ % \CodeUsgIndex\clubpenalty \CodeUsgIndex\widowpenalty \gmd@setclubpenalty% we wrapped the assignment of |\clubpenalty| % in a~macro because we'll repeat it twice more. \@clubpenalty\clubpenalty \widowpenalty=3333 % Most paragraphs of the code will be - % one-line most probably and many of the narration, too.\par - %\vskip-\stanzaskip + % one-line most probably and many of the narration, too.\par\ % \changes[\DocInput]{v0.95}{06/08/15}{\cs{club-} % and \cs{widowpenalty} set both to 3333} %\CodeUsgIndex\tolerance \tolerance=1000 % as in \docfm. - \catcode`\^^M=\active% + % ^^A \catcode`\^^M=\active% redundant with line 2304 % \CodeUsgIndex\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. + % \Define*{^^M} + \QueerEOL% \changes{v0.99m}{2008/08/09}{there was + % \cs{let}\hathat{M} but \cs{QueerEOL} is better: it also + % redefines \bslash\hathat M} It has to be before the + % begin-input-hook to allow change by that hook. % \CodeUsgIndex\@beginputhook \@beginputhook% my first use of it is to redefine |\maketitle| % just at this point not globally. \CodeUsgIndex\everypar \everypar=\@xa{\@xa\@codetonarrskip\the\everypar}% - % \Define*{^^M} - \let^^M=\gmd@textEOL% % \Define\gmd@guardedinput \edef\gmd@guardedinput{% \@nx\@@input #1\relax% |\@nx| is % |\noexpand|, see \pk{gmutils}.\DoNotIndex\@nx - % \inverb|\@@input| is the - % true \TeX's \inverb|\input|. \CodeUsgIndex\EOFMark + % \incs{@@input} is the + % true \TeX's \incs{input}. \CodeUsgIndex\EOFMark \gmd@iihook% cf.\ line \ref{iihook} \@nx\EOFMark% to pretty finish the input, see % line~\ref{eofMark}.\CodeUsgIndex\code@delim @@ -2310,7 +2372,7 @@ % does |\ifx|). % -\def\gmd@textEOL{ % a~space just like in normal \TeX. We put it first to +\protected\def\gmd@textEOL{ % a~space just like in normal \TeX. We put it first to % cooperate with \inverb|\^^M|'s |\expandafter\ignorespaces|. It's no % problem since a~space | |${}_{10}$ doesn't drive \TeX\ out of % the vmode. @@ -2335,7 +2397,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 - % \inverb|\clubpenalty|, we set it again here and also after this + % \incs{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. @@ -2381,20 +2443,27 @@ % \DefIndex\gmd@@toc \AtBegInput{\let\gmd@@toc\tableofcontents \def\tableofcontents{% \label{straighttoc} - \@ifQueerEOL{\StraightEOL\gmd@@toc\QueerEOL}{\gmd@@toc}}} + \@ifQueerEOL{\StraightEOL\gmd@@toc\QueerEOL}% + {\gmd@@toc}}} % As you'll learn from lines \ref{QueerEOL} and \ref{StraightEOL}, we % 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\ocircum le of |\@ifQueerEOL|: +% check the catcode of |^^M| is the r\ocircum le of |\@ifEOLactive|: % % \changes{v0.98a}{06/09/06}{\cs{tableofcontents}, \cs{PrintIndex} % and \cs{PrintChanges} modified to work properly in the `queer line % ends' environment.} -\long\def\@ifQueerEOL#1#2{%% \changes{v0.98a}{06/09/06}{added} - \ifnum\the\catcode`\^^M=\active \afterfi{#1}\else\afterfi{#2}\fi} +\long\def\@ifEOLactive#1#2{% + \ifnum\catcode`\^^M=\active \afterfi{#1}\else\afterfi{#2}\fi} + +\foone\obeylines{% + \long\def\@ifQueerEOL#1#2{%% \changes{v0.98a}{06/09/06}{added} + \@ifEOLactive{\ifx^^M\gmd@textEOL\afterfi{#1}\else\afterfi{#2}\fi}% + {#2}}% of \cs{@ifQueerEOL} +}% of \cs{foone} % The declaration below is useful if you % wish to put sth.\ just in the nearest input/included file and no @@ -2463,21 +2532,12 @@ \def\CodeSpacesGrey{% % \changes{v0.99l}{2008/08/06}{added due to Will Robertson's % suggestion} - \providecolor{codespacesgrey}{gray}{0.5}% - \CodeSpacesVisible% - \gmd@preambleABD{% - \unless\ifdefined\gmd@visspace - \let\gmd@visspace\visiblespace - \fi - \def\visiblespace{% - \hbox{\textcolor{codespacesgrey}\gmd@visspace}}% - }}% + \CodeSpacesVisible + \VisSpacesGrey% defined in \pk{gmverb} +}% % Note that \cs{CodeSpacesVisible} doesn't revert \cs{CodeSpacesGrey}. -\let\gmd@preambleABD\AtBeginDocument -\AtBeginDocument{\let\gmd@preambleABD\firstofone} - \CodeSpacesVisible @@ -2485,7 +2545,7 @@ % How the continuing of the narration should look like? \def\gmd@continuenarration{% \endgroup - \gmd@countnarrationline% see \gmiflink[countnarr]{below}. + \gmd@cpnarrline% see \gmiflink[countnarr]{below}. \@xa\@trimandstore\the\everypar\@trimandstore \everypar=\@xa{\@xa\@codetonarrskip\the\everypar}% \@xa\gmd@checkifEOL\@gobble} @@ -2495,36 +2555,102 @@ % \ref{ContNarr2} it's been read as \catother. That's why it % works in spite of that |%| is of category `ignored'.) -%\gmhypertarget[countnarr]{Whether} we count the narration lines -% depends on the option |countalllines| which is off by default. \if@countalllines - \def\gmd@countnarrationline{% - \if@newline - \grefstepcounter{codelinenum}\@newlinegfalse% the - % |\grefstepcounter| macro, defined in \pk{gmverb}, is a~global - % version of |\refstepcounter|, observing the redefinition made - % to |\refstepcounter| by \pk{hyperref}. +%^^A erased obsolete code is backed up in gmdoc.sty~5~. +%\gmhypertarget[countnarr]{If the} |countalllines| option is in force, +% we get the count of lines from the \cs{inputlineno} primitive. But +% if the option is |countalllines*|, we want to print the line number. +%^^A \def\gmd@countnarrline{% +%^^A \if@newline +%^^A \gmd@countnarrline@ +%^^A \fi}% \DefIndex\gmd@countnarrline + + \def\gmd@countnarrline@{% + \gmd@grefstep{codelinenum}\@newlinegfalse \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 % should restore it. - \hyperlabel@line - {\LineNumFont\thecodelinenum}\,\ignorespaces - \fi}% \DefIndex\gmd@countnarrationline -\else - \@emptify\gmd@countnarrationline% -\fi + }% of \cs{gmd@countnarrline@} + + \def\gmd@grefstep#1{% instead of diligent redefining all possible + % commands and environments we just assign the current value of + % the respective \TeX's primitive to the \env{codelinenum} + % counter. Note we decrease it by $-1$ to get the proper value + % for the next line. (Well, I~don't quite know why, but it + % works.) %^^A~we'll step its value by 1 because it will be put + % ^^Aat the beninning of the \emph{next} line. + \ifnum\value{#1}<\inputlineno + \csname c@#1\endcsname\numexpr\inputlineno-1\relax + \ifvmode\leavevmode\fi% this line is added 2008/08/10 after an + % ^^A( + % all-night debuggery ;-) that showed that at one point + % \incs{gmd@grefstep} was called in vmode which caused adding + % \incs{penalty 10000} to the main vertical list and thus + % forbidding pagebreak during entire \inenv{oldmc}. + \grefstepcounter{#1}% + \fi}% We wrap stepping the counter in an \incs{ifnum} to avoid + % repetition of the same ref-value (what would result in the + % ``multiply defined labels'' warning).\par\ + % The + % \incs{grefstepcounter} macro, defined in \pk{gmverb}, is + % a~global + % version of \incs{refstepcounter}, observing the redefinition + % made + % to \incs{refstepcounter} by \pk{hyperref}. + + \if@printalllinenos% Note that checking this swich makes only + % sense when |countalllines| is true. + \def\gmd@cpnarrline{% count and print narration line + \if@newline + \gmd@countnarrline@ + \hyperlabel@line + {\LineNumFont\thecodelinenum}\,\ignorespaces}% + \fi} + \else% not |printalllinenos| + \emptify\gmd@cpnarrline + \fi + +\def\gmd@ctallsetup{% In the \inenv{oldmc} environments and with the + % \incs{FileInfo} declaration (when % \inenv{countalllines} option + % is in force) the % code is gobbled as an argument of a~macro and + % % then processed at one place (at the end of % \inenv{oldmc} + % % e.g.) so if we used % \incs{inputlineno}, we would have got all + % % the % lines with the same number. But we only set the counter + % % not \incs{refstep} it to avoid putting a~hypertarget. + \setcounter{codelinenum}{\inputlineno}% it's global. + \let\gmd@grefstep\hgrefstepcounter} + +\else% not |countallines| (and therefore we won't print the narration + % lines' numbers either) + \@emptify\gmd@cpnarrline + \let\gmd@grefstep\hgrefstepcounter% \label{let grefstep} if we don't + % want to count all the lines, we only \incs{ref}-increase the + % counter in the code layer. + \emptify\gmd@ctallsetup +\fi% of |\if@countalllines| + +\def\skiplines{\bgroup + \let\do\@makeother \dospecials % not \incs{@sanitize} because the + % latter doesn't recatcode braces and we want all to be quieten. + \catcode`\^^M\active + \gmd@skiplines} + + \edef\gmu@tempa{% + \long\def\@nx\gmd@skiplines##1\bslash endskiplines{\egroup}} + \gmu@tempa + % And typesetting the \TeX\ code? -\begingroup\catcode`\^^M=\active% -\firstofone{\endgroup% \DefIndex\gmd@typesettexcode +\foone\obeylines{% \DefIndex\gmd@typesettexcode \def\gmd@typesettexcode{% \gmd@parfixclosingspace% it's to eat a~space closing the % paragraph, see \gmiflink[closingspace]{below}. It contains % |\par|. % + % ^^A\special{color push gray 0.2645}% % A~verbatim group has already been opened by \cs{ttverb\+at\+im} and % additional |\catcode|. \everypar={\@@settexcodehangi}% At first attempt we thought @@ -2547,6 +2673,7 @@ \fi% \prevhmodegfalse% we want to know later that now we are in the % vmode. + % ^^A\special{color push gray 0.2666}% \@ifnextchar{\gmd@texcodespace}{% \@dsdirgfalse\gmd@dolspaces}{\gmd@charbychar}% }% end of |^^M|'s definition.\label{debug!2} @@ -2561,13 +2688,15 @@ % switching from the narration into the code, we insert a~proper % vertical space. \@aftercodegtrue\@afternarrgfalse% + %^^A\special{color push gray 0.2682}% before that penalty \ifdim\gmd@ldspaceswd>\z@% and here the leading spaces. \leavevmode\@dsdirgfalse% - \if@newline\grefstepcounter{codelinenum}\@newlinegfalse% + \if@newline\gmd@grefstep{codelinenum}\@newlinegfalse% \fi% \printlinenumber% if we don't want the lines to be numbered, - % the respective option \inverb|\let|s this \acro{CS} to |\relax|. + % the respective option \incs{let}s this \acro{CS} to \incs{relax}. \hyperlabel@line% + %^^A\special{color push gray 0.2689}% seems O.K. \mark@envir% index and/or marginize an environment if there is % some to be done so, see line \ref{mark@envir}. \hskip\gmd@ldspaceswd% @@ -2589,6 +2718,7 @@ % hmode. \@aftercodegtrue% we want to know later that now we are % typesetting a~codeline. + %^^A\special{color push gray 0.2712}% before that penalty \gmd@charbychar% we'll eat the code char by char to scan all the % macros and thus to deal properly with the case |\%| in which the % |%| will be scanned and won't @@ -2628,7 +2758,11 @@ \gmd@eatlspace}% \else\afterfi{% about this smart macro and other of its family see % \pk{gmutils} sec.\,3. - \par\gmd@typesettexcode}% +%^^A \special{color push gray 0.2748}% debug of \penalty10000 +%^^A~2008/08/10 was far +%^^A \ifnum\inputlineno>1016 \ifnum\inputlineno<1050 \show\par\fi\fi O.K. + \par + \gmd@typesettexcode}% \fi} % And now, the iterating inner macro that'll eat the leading spaces. @@ -2660,26 +2794,40 @@ \newcommand*\gmd@charbychar[1]{% \ifhmode\prevhmodegtrue - \else\prevhmodegfalse\fi + \else\prevhmodegfalse + % ^^A~\special{color push gray 0.2789}% + \fi \if\code@delim\@nx#1% - \def\next{\gmd@percenthack% to typeset |%| if a~comment + \def\next{% occurs when next a~\cs{hskip4.875pt} is to be put + % ^^A\special{color push gray 0.2791}% O.K. + \gmd@percenthack% to typeset |%| if a~comment % continues the~codeline. \endgroup% \gmd@checkifEOLmixd}% to see if next is |^^M| and then do |\par|. \else% i.e., we've not met the code delimiter - \ifx\relax#1\def\next{\endgroup}% special case of end of file thanks to |\everyeof|. + \ifx\relax#1\def\next{% + % ^^A\special{color push gray 0.2798}% + \endgroup}% special case of end of file thanks to |\everyeof|. \else \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. - \def\next{\gmd@counttheline#1\scan@macro}% + \def\next{% +%^^A \debug@special{2808}% + \gmd@counttheline#1\scan@macro}% \else - \def\next{\gmd@EOLorcharbychar#1}% + \def\next{% +%^^A \debug@special{2806}% before penalty + \gmd@EOLorcharbychar#1}% \fi \fi \fi\next} +\def\debug@special#1{% + \ifhmode\special{color push gray 0.#1}% + \else\special{color push gray 0.#1000}\fi} + % One more inner macro because |^^M| in \TeX\ code wants to peek at the % next char and possibly launch |\gmd@charbychar|. We deal with % counting the lines thorougly. Increasing the counter is divided into @@ -2687,15 +2835,19 @@ % |\stepcounter| added some stuff that caused blank lines, at % least with \pk {hyperref} package loaded. \def\gmd@EOLorcharbychar#1{% + %^^A \debug@special{2829}% \ifx\gmd@texcodeEOL#1% \if@newline - \if@countalllines\global\advance\c@codelinenum by\@ne - \@newlinegfalse\fi + % ^^A\special{color push gray 0.281600}% no occurence + % ^^A \if@countalllines\global\advance\c@codelinenum by\@ne obsolete + % ^^A\fi + \@newlinegfalse \fi \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 + {%^^A \debug@special{2839}% this occurs frequently +\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 @@ -2705,14 +2857,19 @@ \def\gmd@counttheline{% \ifvmode \if@newline - \grefstepcounter{codelinenum}\@newlinegfalse + \leavevmode + %^^A \debug@special{2851}% + \gmd@grefstep{codelinenum}\@newlinegfalse \hyperlabel@line \fi + %^^A\debug@special{2853}% \printlinenumber + % ^^A\debug@special{2855}% \mark@envir - \else + \else% not vmode \if@newline - \grefstepcounter{codelinenum}\@newlinegfalse + % ^^A\special{color push gray 0.2842}% didn't occur + \gmd@grefstep{codelinenum}\@newlinegfalse \hyperlabel@line \fi \fi} @@ -2740,7 +2897,7 @@ % Long searched and very simple at last. \def\gmd@checkifEOL{% - \gmd@countnarrationline + \gmd@cpnarrline \everypar=\@xa{\@xa\@codetonarrskip% we add the % macro that'll insert a~vertical space if we leave the code and % enter the narration. @@ -2758,7 +2915,7 @@ % the other hand, there's no need to checking for \ds\ directives. \def\gmd@checkifEOLmixd{% - \gmd@countnarrationline + \gmd@cpnarrline \everypar=\@xa{\@xa\@codetonarrskip\the\gmd@preverypar}% % % \label{longlinethatshouldbebroken} @@ -2947,7 +3104,7 @@ \long\def\@trimandstore#1\@trimandstore{% \def\@trimandstore@hash{#1}% \ifx\@trimandstore@hash\@empty% we check if |#1| is - % nonempty. The |\if|\inverb*|\relax#1\relax| trick is not + % nonempty. The \incs{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={}% @@ -2978,14 +3135,17 @@ % define a~line-end eater: \catcode`\^^B=\active% note we re|\catcode| \<char2> globally, for the % entire document. -\foone{\catcode`\^^M=\active}%% \Define*{^^B} +\foone{\obeylines}%% \Define*{^^B} {\def\QueerCharTwo{% - \def^^B##1^^M{\ignorespaces}}% + \protected\def^^B##1^^M{% + %^^A\@newlinegtrue\gmd@countnarrline + \ifhmode\unskip\space\ignorespaces\fi}}% It shouldn't be \incs{ } not to + % drive \TeX\ into hmode. } \QueerCharTwo -\AtBegInput{\@ifQueerEOL{\catcode`\^^B\active}{}\QueerCharTwo}% \label{QCh2} +\AtBegInput{\@ifEOLactive{\catcode`\^^B\active}{}\QueerCharTwo}% \label{QCh2} % We repeat redefinition of \<char2> at begin of the documenting % input, because \pk{doc.dtx} suggests that some packages (namely % \pk{inputenc}) may re|\catcode| such unusual characters. @@ -3009,16 +3169,17 @@ % would cause disasters. So let's do it an |\active| way. \catcode`\^^A=\active% note we re|\catcode| \<char1> globally, for the % entire document. -\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}% - } +\foone\obeylines{%%\DefIndex\QueerCharOne \Define*{^^A} + \def\QueerCharOne{% + \def^^A{%^^A no need to write \incs{gmd@countnarrline} because + % ^^A \inverb|^^M| will contain it if \inenv{countalllines} is in force. + \bgroup\let\do\@makeother\dospecials\gmd@gobbleuntilM}}% + \def\gmd@gobbleuntilM#1^^M{\egroup\ignorespaces^^M}% +} \QueerCharOne -\AtBegInput{\@ifQueerEOL{\catcode`\^^A\active}\QueerCharOne}% see note +\AtBegInput{\@ifEOLactive{\catcode`\^^A\active}\QueerCharOne}% see note % after line \ref{QCh2}. @@ -3028,7 +3189,7 @@ % related to it. % % One usefulness of |\StraightEOL| is allowing linebreaking of the -% command arguments. Another making possible executing some code lines +% command arguments. Another---making possible executing some code lines % during the documentation pass. % % \changes{v0.98b}{06/09/07}{\cs{QueerM} and \cs{StraightM} renamed @@ -3040,24 +3201,41 @@ \catcode`\^^B=14 \def\^^M{\ }} -\foone{\catcode`\^^M=\active}% -{\def\QueerEOL{%\label{QueerEOL} +%^^A \unless\if@countalllines +%^^A \let\StraightEOL\StraightEOLnocount +%^^A \fi +%^^A + + +\foone\obeylines{% + \def\QueerEOL{%\label{QueerEOL} \catcode`\^^M=\active% \let^^M\gmd@textEOL% - % ^^A~ $$$$$$$$ \catcode`\^^A=\active% \catcode`\^^B=\active% I~only re|\catcode| \<char1> and \<char2> % 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}% +%^^A % +%^^A \if@countalllines% +%^^A \def\StraightEOL{% +%^^A \catcode`\^^M=\active% +%^^A \let^^M\gmd@notsostraightEOL% +%^^A \catcode`\^^A=\active% +%^^A \catcode`\^^B=\active% I~only re|\catcode| \<char1> and \<char2> +%^^A % hoping no one but me is \emph{that} perverse to make them +%^^A % |\active| and (re)define. (Let me know if I'm wrong at this point.) +%^^A \let\^^M=\gmd@bslashEOL}% +%^^A % +%^^A \fi% } -% \iffalse -% They won't work in \verb+|verbatim|+ scopes but the clubs redefine -% the active lineend to be a~breakable (and visible) space, so -% breaking a~`clubbed' text in two lines will not cause a~disaster but -% you get e.g., |...^^B %...|. -% \fi +%^^A % \skiplines +%^^A % They won't work in \verb+|verbatim|+ scopes but the clubs redefine +%^^A % the active lineend to be a~breakable (and visible) space, so +%^^A % breaking a~`clubbed' text in two lines will not cause a~disaster but +%^^A % you get e.g., |...^^B %...|. +%^^A % \endskiplines % \gmhypertarget[closingspace]{To make} |^^M| behave more like a~`normal' % lineend I~command it to add a~| |${}\subs{10}$ at first. It works @@ -3078,9 +3256,20 @@ % case when no closing space is added. % And one more detail: -\bgroup\catcode`\^^M=\active% -\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}} +\foone\obeylines{%\DefIndex*{\^^M} + \if 1 1% + \protected\def\gmd@bslashEOL{\ \@xa\ignorespaces^^M}% + }% of \cs{foone}. Note we interlace here \incs{if} with a~group. +\else% + \protected\def\gmd@bslashEOL{% + \ifhmode\unskip\fi\ \ignorespaces} + %^^A~\if@countalllines\@newlinegtrue\gmd@cpnarrline\fi% + \fi +% \changes{v0.99c}{2007/03/30}{a~bug fix: redefinition of it left +% solely to \cs{QueerEOL}} +% \changes{v0.99m}{2008/08/09}{also \cs{StraightEOL} with +% \env{countalllines} package option lets \bslash\hathat{M} to it} +% % 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 @@ -3103,6 +3292,8 @@ % And a~one more little definition to accomodate |\verb| and pals for the % lines commented out. \AtBegInput{\long\def\check@percent#1{% + \gmd@cpnarrline% to count the verbatim lines and possibly print + % their numbers. This macro is used only by the verbatim end of line. \@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. @@ -3110,6 +3301,12 @@ \@xa\def\@xa\doprivateothers\@xa{% \doprivateothers\do#1}}% +%^^A \foone\obeylines{% +%^^A \AtBegInput{% +%^^A \prependtomacro{% first the stuff then the macro (see \pk{gmutils}). +%^^A \def\obeylines{\def^^M{\par}\catcode`\^^M\active}}% +%^^A \@verbatim}} + % We also redefine an internal |\verb|'s macro |\gm@verb@eol| to put a~proper % line end if a~line end char is met in a~short verbatim: we have to % check if we are in `queer' or `straight' \acro{EOL}s area. @@ -3118,7 +3315,7 @@ \AtBegInput{\def\gm@verb@eol{\obeylines% \def^^M{\verb@egroup\@latex@error{% \@nx\verb ended by end of line}% - \@ifQueerEOL{\gmd@textEOL}{\@ehc}}}}% + \@ifEOLactive{^^M}{\@ehc}}}}% \endgroup % \subdivision{Macros for Marking The Macros} @@ -3249,7 +3446,7 @@ \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|. + % we don't need \incs{xiistring}. \@ifnextcat{a}{\gmd@finishifstar#1}{\finish@macroscan}% } % As you may guess, |\@ifnextcat| is defined analogously to |\@ifnextchar| but @@ -3410,9 +3607,9 @@ \@ifundefined{gmd/2marpar/#1}{}{% \@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. \incs{macro@pname}, which will be the only possible % argument to - % \cs{may\+be\+@mar\+g\+in\+par}, + % \incs{may\+be\+@mar\+g\+in\+par}, % contains the macro's name % without the escapechar so we added it here. % ^^A\gdef\mname@tomarginpar{} @@ -3476,9 +3673,10 @@ \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). + % \incs{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| + % it's in + % \incs{csname\+…\+\bslash end\+cs\+na\+me} % everywhere. \fi} @@ -3503,7 +3701,7 @@ % 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|. + \edef\gmu@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 @@ -3511,7 +3709,7 @@ \@nx\n@melet{next}{gmd@adef@\gmd@adef@TYPE}% \@nx\n@melet{gmd@adef@currdef}{gmd@detectname@\gmd@adef@currdef}% \@nx\fi}}% - \@tempa + \gmu@tempa \SMglobal\StoreMacro*{gmd@detect@\gmd@adef@currdef}% we store the \acro{CS} to % allow its temporary discarding later. } @@ -3966,9 +4164,9 @@ } % An example: -%\iffalse +%\skiplines \iffalse -%\fi\fi +%\endskiplines \DeclareOptionX[Berg]<Lulu>{EvelynLear}{} % Check in the index for % \inverb|EvelynLear| and \inverb|\Berg@Lulu@EvelynLear|. @@ -3978,9 +4176,9 @@ % The latter example shows also overriding the option header by % declaring the default. By the way, both the example options are % not declared in the code actually. -%\iffalse\iffalse +%\skiplines \fi -%\fi +%\endskiplines %\stanza % Now the Heiko Oberdiek's \pk{kvoptions} package option definitions: \DeclareDefining[type=kvo, prefix=\bslash, KVpref=]\DeclareStringOption @@ -4119,17 +4317,17 @@ % there? Definitely here because we'll wish to switch the switch % with a~declaration. \if@pageinclindex - \edef\IndexRefCs{gmdindexpagecs{\HLPrefix}{\kind@fentry}{\EntryPrefix}}% + \edef\gmu@tempa{gmdindexpagecs{\HLPrefix}{\kind@fentry}{\EntryPrefix}}% \else - \edef\IndexRefCs{gmdindexrefcs{\HLPrefix}{\kind@fentry}{\EntryPrefix}}% + \edef\gmu@tempa{gmdindexrefcs{\HLPrefix}{\kind@fentry}{\EntryPrefix}}% \fi - \edef\@tempa{\IndexPrefix#2\actualchar% + \edef\gmu@tempa{\IndexPrefix#2\actualchar% \quotechar\bslash verb*#1\quoted@eschar#2#1% The last macro in % this line usually means the first two, but in some cases % it's redefined to be empty (when we use |\index@macro| to % index not a~\acro{CS}). - \encapchar\IndexRefCs}% - \@xa\special@index\@xa{\@tempa}% We give the + \encapchar\gmu@tempa}% + \@xa\special@index\@xa{\gmu@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) @@ -4143,7 +4341,8 @@ % argument of the very indexing macro} }{}% closing of |gmd/iexcl/| test. }} - + + \def\un@defentryze#1{% \@xa\g@relaxen\csname gmd/defentry/#1\endcsname @@ -4195,8 +4394,8 @@ \csname#2\endcsname{\gmd@revprefix{#3}#4}}}% % \stanza \DefIndex\gmd@revprefix \def\gmd@revprefix#1{% - \def\@tempa{#1}% - \ifx\@tempa\@empty p.\,\fi} + \def\gmu@tempa{#1}% + \ifx\gmu@tempa\@empty p.\,\fi} \providecommand*\HLPrefix{}% it'll be the hypertargets names' prefix % in mul\-ti-docs. Moreover, it showed that if it was empty, @@ -4367,13 +4566,13 @@ \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{\@xa\@gobble\macro@pname}% + \edef\gmu@tempa{\@xa\@gobble\macro@pname}% \@tempswatrue \else - \let\@tempa\macro@pname + \let\gmu@tempa\macro@pname \@tempswafalse \fi - \@xa\quote@mname\@tempa\relax% \label{quote@mname comm}we + \@xa\quote@mname\gmu@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 meaning of |\macro@iname|. @@ -4506,13 +4705,36 @@ {\string\indexentry{#1}% {\HLPrefix\number\c@codelinenum}}\fi} + + +\def\codeline@glossary#1{% It doesn't need to establish a~group since + % it is always called in a~group. + \if@pageinclindex + \edef\gmu@tempa{gmdindexpagecs{\HLPrefix}{relax}{\EntryPrefix}}% + \else + \edef\gmu@tempa{gmdindexrefcs{\HLPrefix}{relax}{\EntryPrefix}}% \inverb|relax| stands for the formatting command. But we don't want to do anything special with the change history entries. + \fi + \protected@edef\gmu@tempa{% + \@nx\protected@write\@nx\@glossaryfile{}% + {\string\glossaryentry{#1\encapchar\gmu@tempa}% + {\HLPrefix\number\c@codelinenum}}}% + \gmu@tempa +} + +% \changes[\changes]{v0.99m}{2008/08/09}{changed to write the line +% number instead of page number by default and with +% \env{codelineindex} option which seems to be more reasonable +% especially with the \env{countalllines} option} + % We initialize it due to the option (or lack of the option): \AtBeginDocument{% \if@pageindex \let\special@index=\index + \let\gmd@glossary\glossary \else % \DefIndex\special@index \let\special@index=\codeline@wrindex + \let\gmd@glossary\codeline@glossary % \label{codeline indexnumber declaration} \fi}% postponed till |\begin{document}| with respect of \docfm-like % declarations. @@ -4558,14 +4780,14 @@ % \DefIndex\addto@estomarginpar \long\def\addto@estomarginpar#1{% - \edef\@tempa{\@nx\do{\xiistring#1}}% we |\string| the argument to + \edef\gmu@tempa{\@nx\do{\xiistring#1}}% we |\string| the argument to % allow it to be a~control sequence. - \@xa\addtomacro\@xa\envirs@tomarginpar\@xa{\@tempa}} + \@xa\addtomacro\@xa\envirs@tomarginpar\@xa{\gmu@tempa}} % \DefIndex\addto@estoindex \long\def\addto@estoindex#1{% - \edef\@tempa{\@nx\do{\xiistring#1}} - \@xa\addtomacro\@xa\envirs@toindex\@xa{\@tempa}} + \edef\gmu@tempa{\@nx\do{\xiistring#1}} + \@xa\addtomacro\@xa\envirs@toindex\@xa{\gmu@tempa}} % And now a~command to mark a~`usage' occurrence of a~\acro{CS}, environment @@ -4633,16 +4855,16 @@ % a~light condensed typewriter font, it's set in \pk{gmdocc} class.) \let\marginpartt\tt -% If we count all lines then the index entries for \acro{CS}s and +% If we pront also the narration lines' numbers, then the index entries for \acro{CS}s and % environments marked in the commentary should have codeline numbers % not page numbers and that is |\let| in line % \ref{codeline indexnumber declaration}. On the other hand, if we -% count only the codelines, then a~macro or an environment marked in +% don't print narration lines' numbers, then a~macro or an environment marked in % the commentary should have page number not codeline number. This we % declare here, among others\ we add the letter |p| before the page number. % \DefIndex\do@properindex \def\do@properindex{%\label{do@properindex} - \if@countalllines\else + \if@printalllinenos\else \@pageinclindextrue \let\special@index=\index \fi} @@ -4704,7 +4926,7 @@ \n@melet{oldmc*}{macrocode*} \n@melet{endoldmc*}{endmacrocode*} -% Now we arm \env{oldmc} and \env{olmc*} with the +% Now we arm \env{oldmc} and \env{olmc*} with % the macro looking for |% \end|\arg{envir name}. \addtomacro\oldmc{\@oldmacrocode@launch}% \@xa\addtomacro\csname oldmc*\endcsname{% @@ -4714,6 +4936,7 @@ \def\@oldmacrocode@launch{% \emptify\gmd@textEOL% to disable it in |\gmd@docstripdirective| % launched within the code. + \gmd@ctallsetup \glet\stored@code@delim\code@delim \@makeother\^^B\CodeDelim\^^B% \ttverbatim \gmd@DoTeXCodeSpace% @@ -4730,9 +4953,8 @@ \@xa\gmd@currenvxistar\@currenvir*\relax \@oldmacrocode} -\bgroup\catcode`*11 -\firstofone{\egroup - \def\gm@xistar{*}} +\foone{\catcode`*11 } +{\def\gm@xistar{*}} \def\gmd@currenvxistar#1*#2\relax{% \edef\@currenvir{#1\if*#2\gm@xistar\fi}} @@ -4745,37 +4967,38 @@ % not at the end of env.\ name would cause a~disaster.) %^^A~ \Define\@oldmacrocode -\bgroup +\foone{% \catcode`[=1 \catcode`]=2 \catcode`\{=\active \@makeother\} \@makeother\^^B -\catcode`!=0 \catcode`\\=\active -% \CodeEscapeChar\! \CDAnd -!catcode`&=14 !catcode`*=11 -!catcode`!%=!active !obeyspaces& -!firstofone[!egroup& +\catcode`/=0 \catcode`\\=\active +\catcode`&=14 \catcode`*=11 +\catcode`\%=\active \obeyspaces}& % \CodeEscapeChar\/ \CDAnd +[& here the \cs{foone}'s second pseudo-argument begins &%\stanza -!def!@oldmacrocode[& -!bgroup!let =!relax&% to avoid writing |!noexpand | four times. -!xdef!oldmc@def[& -!def!noexpand!oldmc@end####1!noexpand% !noexpand\end& -!noexpand{!@currenvir}[& -####1^^B!noexpand!end[!@currenvir]!noexpand!gmd@oldmcfinis]]& -!egroup&% now |\oldmc@edef| is defined to have one parameter delimited +/def/@oldmacrocode[& +/bgroup/let =/relax&% to avoid writing |/@nx | four times. +/xdef/oldmc@def[& +/def/@nx/oldmc@end####1/@nx% /@nx\end& +/@nx{/@currenvir}[& +####1^^B/@nx/end[/@currenvir]/@nx/gmd@oldmcfinis]]& +/egroup&% now |\oldmc@edef| is defined to have one parameter delimited &% with |\end|\arg{current env.'s name} -!oldmc@def& -!oldmc@end]&% \CDPerc +/oldmc@def& +/oldmc@end]&% \CDPerc ] \def\gmd@oldmcfinis{% \@xa\CodeDelim\stored@code@delim \gmd@mchook}% see line \ref{gmd@mchook} -\def\VerbMacrocodes{% +\def\OldMacrocodes{%% \changes{v0.99m}{2008/08/10}{renamed from + %% \cs{VerbMacrocodes}} \let\macrocode\oldmc \n@melet{macrocode*}{oldmc*}} + % To handle \ds\ directives in the code (in the old macrocodes % case that is). @@ -4783,7 +5006,7 @@ \foone{\catcode`\%\active} {\def\docstrips@percent{\catcode`\%\active \let%\gmd@codecheckifds}} -% \end{oldmc} +% \end{oldmc}\ % The point is, the active |%| will be expanded when just after it is % the |\gmd@charbychar| cs token and next is some char, the |^^B| code @@ -4849,8 +5072,8 @@ % given to it consists of just one token (or one |{|\<text>|}|, to % tell the whole truth). \def\gmd@ifsingle#1#2\@@nil{% - \def\@tempa{#2}% - \ifx\@tempa\@empty} + \def\gmu@tempa{#2}% + \ifx\gmu@tempa\@empty} % Note it expands to an open |\if...| test (unbalanced with |\fi|) so it % has to be used as all the |\if|s, with optional |\else| and % obligatory |\fi|. And cannot be used in the possibly skipped @@ -4864,13 +5087,13 @@ % is just gobbled. The possibility of occurrence of |\if...| or so as % a~not-first token seems to be negligible. \def\gmd@ifonetoken#1#2#3{% - \def\@tempb{#3}% We hide |#3| from \TeX\ in case it's |\if...| or - % so. \inverb|\@tempa| is used in \inverb|\gmd@ifsingle|. + \def\gmu@tempb{#3}% We hide |#3| from \TeX\ in case it's |\if...| or + % so. \inverb|\gmu@tempa| is used in \inverb|\gmd@ifsingle|. \gmd@ifsingle#3\@@nil - \afterfi{\@xa#1\@tempb}% + \afterfi{\@xa#1\gmu@tempb}% \else - \edef\@tempa{\@xa\string\@tempb}% - \afterfi{\@xa#2\@xa{\@tempa}}% + \edef\gmu@tempa{\@xa\string\gmu@tempb}% + \afterfi{\@xa#2\@xa{\gmu@tempa}}% \fi} % Now, define the mysterious |\Hybrid@DefMacro| and |\Hybrid@DefEnvir| % macros. They mark their argument with a~certain subtlety: they put @@ -4949,19 +5172,19 @@ % \DefIndex\dont@index \long\def\dont@index#1{% - \def\@tempa{\@nx#1}% My \TeX\ Guru's trick to deal with |\fi| + \def\gmu@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 + \if\gmu@tempa.% a~dot finishes expelling \else - \if\@tempa,% The list this macro is put before may + \if\gmu@tempa,% The list this macro is put before may % contain commas and that's O.K., we just continue the work. \afterfifi\dont@index \else% what is else shall off the Index be expelled. {\escapechar\m@ne - \xdef\@tempa{\string#1}}% + \xdef\gmu@tempa{\string#1}}% \@xa\let% - \csname gmd/iexcl/\@tempa\endcsname=\gmd@iedir% In the default + \csname gmd/iexcl/\gmu@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 % turn false and the subject \acro{CS} shall not be indexed. @@ -5250,7 +5473,8 @@ \def\PrintIndex{% we ensure the standard meaning of the line end % character not to cause a~disaster. - \@ifQueerEOL{\StraightEOL\printindex\QueerEOL}{\printindex}} + \@ifQueerEOL{\StraightEOL\printindex\QueerEOL}% + {\printindex}} % Remember that if you want to change not all the parameters, you % don't have to redefine the entire |\IndexParms| macro but you may @@ -5441,7 +5665,9 @@ ^^JThe \bslash changes command used \on@line ^^Jwith no \string\RecordChanges\space declared. ^^JI shall not warn you again about it}% - \renewcommand\changes[4][]{}} + %^^A\gmd@countlines{#4}% + \renewcommand\changes[4][]{%^^A\gmd@countlines{#4} + }} \def\MakeGlossaryControls{% \edef\actualchar{\string=}\edef\quotechar{\string!}% @@ -5450,6 +5676,7 @@ % |!| and |>|, the `encap' char remains untouched. I~decided to % preserve the \docfm's settings for the compatibility. + \newcommand\changes@[4][\generalname]{% % \changes[\changes]{v0.97}{06/09/04}{The optional pseudo-argument % added intended to be the macro-entry.} @@ -5460,9 +5687,9 @@ % in the optional first argument or is it unchanged. \ifx\last@defmark\relax\else% if no particular \acro{CS} is % specified in |#1|, we check whether |\last@defmark| contains - % something and if so, we put it into |\@tempb| scratch macro. + % something and if so, we put it into |\gmu@tempb| scratch macro. \@tempswatrue - \edef\@tempb{% it's a~bug fix: while typesetting traditional + \edef\gmu@tempb{% it's a~bug fix: while typesetting traditional % \file{.dtx}es, |\last@defmark| came out with |\| at the % beginning (which resulted with |\\|\<name> in the change % log) but while typesetting the `new' way, it occurred @@ -5471,7 +5698,7 @@ % |\last@defmark|\equals|{\}| (what would happen if % a~definition of |\\| was marked in new way \gmdoc ing).%^^A] \if\bslash\last@defmark\else\last@defmark\fi}% - \ifx\last@defmark\bslash\let\@tempb\last@defmark\fi% + \ifx\last@defmark\bslash\let\gmu@tempb\last@defmark\fi% \n@melet{gmd@glossCStest}{gmd/isaCS/\last@defmark}% \fi \else%the first argument isx not |\generalname| i.e., @@ -5480,7 +5707,7 @@ % |\changes[generalname]|\dots) \@tempswatrue {\escapechar\m@ne - \xdef\@tempb{\string#1}}% + \xdef\gmu@tempb{\string#1}}% \if\bslash\@xa\@firstofmany\string#1\relax\@@nil% we check % whether |#1| is a~\acro{CS}\dots \def\gmd@glossCStest{1}%\dots\ and tell the glossary if so. @@ -5488,7 +5715,7 @@ % ^^A~\@xa\quote@mname\@tempb\relax \fi \@ifundefined{gmd@glossCStest}{\def\gmd@glossCStest{0}}{}% - \protected@edef\@tempa{\@nx\glossary{% + \protected@edef\gmu@tempa{\@nx\gmd@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 @@ -5500,18 +5727,22 @@ % specifies a~\acro{CS}, the current % changes entry was done at top-level. In this case we precede % it by |\generalname|. - \@tempb + \gmu@tempb \actualchar\bslash verb*% - \if\verbatimchar\@tempb$\else\verbatimchar\fi - \if1\gmd@glossCStest\quotechar\bslash\fi \@tempb - \if\verbatimchar\@tempb$\else\verbatimchar\fi + \if\verbatimchar\gmu@tempb$\else\verbatimchar\fi + \if1\gmd@glossCStest\quotechar\bslash\fi \gmu@tempb + \if\verbatimchar\gmu@tempb$\else\verbatimchar\fi \else \space\actualchar\generalname \fi - :\levelchar#4\encapchar hyperpage}}% - \@tempa + :\levelchar%^^A\gmd@deeolize{ + #4%^^A} + }}% + \gmu@tempa \grelaxen\gmd@glossCStest - \fi\endgroup\@esphack} + \fi% of |\if@recentchange| + %^^A\gmd@countlines{#4}% + \endgroup\@esphack} % Let's initialize |\last@defmark| and |\GeneralName|. \@relaxen\last@defmark @@ -5566,13 +5797,13 @@ % DEK writes in \textit{\TeX, The Program} of September 1982 as the % date of \TeX\ Version 0.}\QueerEOL\label{TeXVer0} % see \gmiflink[personalchanges]{below}. - \edef\@tempa{% + \edef\gmu@tempa{% \@nx\g@addto@macro\@nx\glossary@prologue{% The changes \if\relax\GeneralName\relax\else of \GeneralName\space\fi earlier than #1 \if\relax#1\relax #2\else(#2)\fi\space are not shown.}}% - \@tempa + \gmu@tempa \fi} % (Explanation to line \ref{TeXVer0}.) % \gmhypertarget[personalchanges]{My} \TeX\ Guru has remarked that the @@ -5645,9 +5876,11 @@ % environment.\end{quotation} % \newenvironment{theglossary}{% +% \changes{v0.99m}{2008/08/10}{added \cs{IndexLinksBlack}} \begin{multicols}\c@GlossaryColumns [\glossary@prologue][\GlossaryMin]% - \GlossaryParms \let\item\@idxitem \ignorespaces}% + \GlossaryParms \IndexLinksBlack + \let\item\@idxitem \ignorespaces}% {\end{multicols}} % Here is the MakeIndex style definition: @@ -5713,7 +5946,7 @@ \@ifQueerEOL {\StraightEOL\@input@{\jobname.gls}\QueerEOL}% {\@input@{\jobname.gls}}% - \g@emptify\PrintChanges} + \g@emptify\PrintChanges} %^^A% % \iffalse %^^A%% % \begin{quotation} @@ -5789,30 +6022,37 @@ % Based on the lines 723--741 of \pk{doc.dtx}. \def\check@checksum{\relax \ifnum\check@sum=\z@ - \typeout{**********************************}% - \typeout{* The input file \gmd@inputname\space has no Checksum - stated.}% - \typeout{* The current checksum is \the\c@CheckSum.}% - \gmd@chschangeline% a~check sum changes history entry, see below. - \typeout{* (package gmdoc info.)} - \typeout{**********************************}% - \else + \edef\gmu@tempa{% why \cs{edef}---see line \ref{wypis sumy} + \@nx\typeout{**********************************^^J% + * The input file \gmd@inputname\space has no Checksum + stated.^^J% + * The current checksum is \the\c@CheckSum.^^J% + \gmd@chschangeline% a~check sum changes history entry, see below. + * (package gmdoc info.)^^J% + **********************************^^J}} + \else \ifnum\check@sum=\c@CheckSum - \typeout{*****+*+*+*+*+*+*+*+*+*+}% - \typeout{* The input file \gmd@inputname: Checksum passed.}% - \gmd@chschangeline - \typeout{* (package gmdoc info.)} - \typeout{*****+*+*+*+*+*+*+*+*+*+}% + \edef\gmu@tempa{% + \@nx\typeout{*****+*+*+*+*+*+*+*+*+*+^^J% + * The input file \gmd@inputname: Checksum passed.^^J% + \gmd@chschangeline + * (package gmdoc info.)^^J% + *****+*+*+*+*+*+*+*+*+*+^^J}} \else - \typeout{********!*!*!*!*!*!*!*!*!*!*!*!}% - \typeout{*! The input file \gmd@inputname:} - \typeout{*! The CheckSum stated: \the\check@sum\space<> my - count: \the\c@CheckSum.} - \gmd@chschangeline - \typeout{*! (package gmdoc info.)} - \typeout{********!*!*!*!*!*!*!*!*!*!*!*!}% + \edef\gmu@tempa{% + \@nx\typeout{********!*!*!*!*!*!*!*!*!*!*!*!^^J% + *! The input file \gmd@inputname:^^J% + *! The CheckSum stated: \the\check@sum\space<> my + count: \the\c@CheckSum.^^J% + \gmd@chschangeline + *! (package gmdoc info.)^^J% + ********!*!*!*!*!*!*!*!*!*!*!*!^^J}}% \fi \fi + \gmu@tempa + \@xa\AtEndDocument\@xa{\gmu@tempa}%\label{wypis sumy} we print + % the checksum notification on the terminal immediately and at end + % of \TeX ing not to have to scroll the output far nor search the log. \global\check@sum\z@} % As I~mentioned above, I~use the check sum mechanism to mark the file @@ -5820,12 +6060,15 @@ % terminal to be put somewhere at the % beginning of the source file's commentary for instance. \def\gmd@chschangeline{% - \typeout{\xiipercent\space\string\chschange{% - \csname fileversion\endcsname}{\the\year/\the\month/\the\day}{\the\c@CheckSum}} - \typeout{\xiipercent\space\string\chschange{\csname fileversion\endcsname}{% - \@xa\@gobbletwo\the\year/\the\month/\the\day}{%\relax - % with two di\-g\-it year in case you use |\ChangesStart|. - \the\c@CheckSum}}} + \xiipercent\space\string\chschange + {\csname fileversion\endcsname}% + {\the\year/\the\month/\the\day}% + {\the\c@CheckSum}^^J% + \xiipercent\space\string\chschange + {\csname fileversion\endcsname}% + {\@xa\@gobbletwo\the\year/\the\month/\the\day}% + {% with two di\-g\-it year in case you use |\ChangesStart|. + \the\c@CheckSum}^^J} % And here the meaning of such a~line is defined: \newcommand*\chschange[3]{%\label{chschange} @@ -5871,11 +6114,11 @@ \setlength\oddsidemargin{82pt}% \setlength\evensidemargin{82pt}} -% %\iffalse +% %\skiplines % \def\task#1#2{} % % What is this for? Probably to turn an obsolete command off. Or maybe % % a~\acro{TODO}? -% % \fi +% % \endskiplines %\subdivision{\cs{DocInclude} and the \pk{ltxdoc}-Like Setup} % @@ -5975,8 +6218,8 @@ % a~long name is another thing to allow |_| in the filenames (see % line \ref{gmd@writemauxinpaux}). \@tempswatrue - \if@partsw \@tempswafalse\edef\@tempb{#2}% - \@for \@tempa:=\@partlist\do{\ifx\@tempa\@tempb\@tempswatrue\fi}% + \if@partsw \@tempswafalse\edef\gmu@tempb{#2}% + \@for \gmu@tempa:=\@partlist\do{\ifx\gmu@tempa\gmu@tempb\@tempswatrue\fi}% \fi \if@tempswa \let\@auxout\@partaux \if@filesw @@ -6110,9 +6353,14 @@ without bslash}.}% \fi \fi - \@addtoreset{codelinenum}{\filedivname}% remember it has - % a~|\global| effect in fact. For each file we'll reset - % \env{codelinenum}. + % \changes[\DocInclude]{v0.99m}{2008/08/09}{ + % resetting of codeline number with every + % \cs{filedivname} commented out because with the + % \env{countalllines} option it caused that reset at \cs{maketitle} + % after some lines of file} + % ^^A \@addtoreset{codelinenum}{\filedivname}% remember it has + % ^^A~a~|\global| effect in fact. For each file we'll reset + % ^^A~\env{codelinenum}. \def\thefilediv{\aalph{\filedivname}}% The files will be numbered % with letters, lowercase first. \@xa\let\csname the\filedivname\endcsname=\thefilediv% This @@ -6318,6 +6566,9 @@ % Let's initialize the file division macros. \@relaxen\filediv \@relaxen\filedivname +\@relaxen\thefilediv +% \changes[\thefilediv]{v0.99m}{2008/08/06}{let to \cs{relax} by +% default} % If we don't include files the \pk{ltxdoc}-like way, we wish to % redefine |\maketitle| so that it typesets a~division's heading. @@ -6400,12 +6651,12 @@ % |\ProvidesPackage| etc.\ commands. \def\GetFileInfo#1{% \def\filename{#1}% - \def\@tempb##1 ##2 ##3\relax##4\relax{% + \def\gmu@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} + \edef\gmu@tempa{\csname ver@#1\endcsname}% + \@xa\gmu@tempb\gmu@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) @@ -6418,38 +6669,51 @@ \newcommand*\FileInfo{% \bgroup + \gmd@ctallsetup + \bgroup% yes, we open two groups because we want to rescan tokens in + % `usual' catcodes. We cannot put \incs{gmd@ctallsetup} into the + % inner macro because when that will be executed, the + % \incs{inputlineno} will be too large (the last not the first line). \let\do\@makeother \do\ \do\{\do\}\do\^^M\do\\% \gmd@fileinfo} % \changes{v0.99d}{2007/04/26}{added} -\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\\ -> +\foone{% + \catcode`!\z@ + \catcode`(\@ne + \catcode`)\tw@ + \let\do\@makeother + \do\ % we make space `other' to keep it for scanning the code where + % it may be leading. + \do\{\do\}\do\^^M\do\\}%\CodeEscapeChar\! +(% +!def!gmd@fileinfo#1Provides#2{#3}#4[#5]#6^^M% +(!egroup% we close the group of changed catcodes, the catcodes +% of the arguments are set. And we are still in the group for +% \incs{gmd@ctallsetup}. +!gmd@writeFI(#2)(#3)(#5)% +!gmd@FIrescan(#1Provides#2{#3}#4[#5]#6)% this macro will close the group. +%\changes[\FileInfo]{v0.99m}{2008/08/09}{\cs{egroup} of the +% inner macro moved to the end to allow \cs{gmd@ctallsetup}. From the +% material passed to \cs{gmd@FIrescan} ending \hathat{M} stripped not +% to cause double labels.} +)% \CodeEscapeChar\\ +) \def\gmd@writeFI#1#2#3{% + % ^^A \typeout{@@@ write FI}\show\relax \immediate\write\@auxout{% \global\@nx\@namedef{% ver@#2.\if P\@firstofmany#1\@@nil sty\else cls\fi}{#3}}} -\def\gmd@docrescan#1{% -% \changes{v0.99l}{2008/08/06}{\cs{scantokens} used instead of -% \cs{write} and \cs{@@input} which simplified the macro} -%^^A \newwrite\gmd@docrescanfile -%^^A \immediate\openout\gmd@docrescanfile=\jobname.docrescan\relax -{\newlinechar=`\^^M\scantokens{#1}}} +\foone\obeylines{% + \def\gmd@FIrescan#1{% + % \changes{v0.99l}{2008/08/06}{\cs{scantokens} used instead of + % \cs{write} and \cs{@@input} which simplified the macro} + % ^^A \newwrite\gmd@docrescanfile + % ^^A \immediate\openout\gmd@docrescanfile=\jobname.docrescan\relax + {\newlinechar=`\^^M\scantokens{#1}}\egroup^^M}} % And, for the case the input file doesn't contain |\Provides...|, @@ -6508,8 +6772,8 @@ % by char as the code. % \stanza % -% \iffalse First I~tried to use \specialcomment{gmlonely} provided by -% the \pk{comment} package, but it caused errors.\fi +% \skiplines First I~tried to use \specialcomment{gmlonely} provided by +% the \pk{comment} package, but it caused errors.\endskiplines % % The below environment I~designed to be able to skip some repeating % texts while documenting several packages of mine into one @@ -6520,10 +6784,15 @@ \newenvironment{gmlonely}{\StraightEOL}{} \newcommand\skipgmlonely[1][]{% - \def\@tempa{%\DefIndex\gmd@skipgmltext - \def\gmd@skipgmltext{\g@emptify\gmd@skipgmltext#1}}% - \@tempa - \@xa\AtBegInput\@xa{\@tempa}% + \def\gmu@tempa{%\DefIndex\gmd@skipgmltext + \def\gmd@skipgmltext{% + \g@emptify\gmd@skipgmltext + % ^^A \gmd@deeolize{ + #1%^^A} + }}% not to count the lines of the substituting + % text but only of the text omitted + \gmu@tempa + \@xa\AtBegInput\@xa{\gmu@tempa}% \renewenvironment{gmlonely}{% \StraightEOL \@fileswfalse% to forbid writing to \pk{.toc}, \pk{.idx} etc. @@ -6568,7 +6837,7 @@ \else\afterfi{\storedcsname{quotation}}% \fi} {\ifx\@currenvir\gmd@quotationname - \afterfi{\unskip''\par}% + \afterfi{\ifhmode\unskip\fi''\par}% \else\afterfi{\storedcsname{endquotation}}% \fi} @@ -6585,22 +6854,22 @@ \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 + \def\gmu@tempa{{\tt\xiipercent}}% + \@emptify\gmu@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}% + {\@emptify\gmu@tempa + \def\gmu@tempb{\gmboxedspace}% \gmd@inverb}} \newcommand*\gmboxedspace{\hbox{\normalfont{ }}} \newcommand*\gmd@nlperc[1][]{% - \unskip - \discretionary{\@tempa}{{\tt\xiipercent\gmboxedspace}}{\@tempb}% + \ifhmode\unskip\fi + \discretionary{\gmu@tempa}{{\tt\xiipercent\gmboxedspace}}{\gmu@tempb}% \penalty10000\hskip0sp\relax} \newcommand*\gmd@inverb[1][]{% @@ -6624,13 +6893,26 @@ } \newcommand*\nlpercent{% - \@ifstar{\def\@tempa{{\tt\xiipercent}}% - \@emptify\@tempb + \@ifstar{\def\gmu@tempa{{\tt\xiipercent}}% + \@emptify\gmu@tempb \gmd@nlperc}% - {\@emptify\@tempa - \def\@tempb{\gmboxedspace}% + {\@emptify\gmu@tempa + \def\gmu@tempb{\gmboxedspace}% \gmd@nlperc}} +\newcommand*\incs{% an inline \cs{cs} + % \changes{v0.99m}{008/08/07}{added} + \@ifstar{\def\gmu@tempa{{\tt\xiipercent}}% + \@emptify\gmu@tempb + \gmd@nlperc\cs}% + {\@emptify\gmu@tempa + \def\gmu@tempb{\gmboxedspace}% + \gmd@nlperc\cs}} + +\def\inenv{\incs[]}% an in-line \cs{env} + + + % 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 @@ -6677,20 +6959,23 @@ % % % \stanza -% To kill a~tiny little bug in \file{doc.dtx} (in line 3299 |\@tempb| and -% |\@tempc| are written plain not verbatim): +% To kill a~tiny little bug in \file{doc.dtx} (in line 3299 |\gmu@tempb| and +% |\gmu@tempc| are written plain not verbatim): \newcounter{gmd@mc} +% Note it is after the \env{macrocode} group \def\gmd@mchook{\stepcounter{gmd@mc}% \label{gmd@mchook} \gmd@mcdiag - \csname gmd@mchook\the\c@gmd@mc\endcsname} + \ifcsname gmd@mchook\the\c@gmd@mc\endcsname + \afterfi{\csname gmd@mchook\the\c@gmd@mc\endcsname}% + \fi} \long\def\AfterMacrocode#1#2{\@namedef{gmd@mchook#1}{#2}} % What have I~done? I~declare a~new counter and employ it to count the % \env{macrocode(*)}s (and \env{oldmc(*)}s too, in fact) and attach % a~hook to (after) the end of every such environment. That lets us to % put some stuff pretty far inside the compiled file (for the buggie -% in \file{doc.dtx}, to redefine |\@tempb/c|). +% in \file{doc.dtx}, to redefine |\gmu@tempb/c|). % One more detail to expalin and define: the |\gmd@mcdiag| macro may % be defined to type out a~diagnostic message (the @@ -6698,7 +6983,7 @@ \@emptify\gmd@mcdiag \def\mcdiagOn{\def\gmd@mcdiag{% - \typeout{^^J\bslash end{macrocode(*)} No.\the\c@gmd@mc + \typeout{^^J\bslash end{\@currenvir} No.\the\c@gmd@mc \space\on@line, cln.\the\c@codelinenum.}}} \def\mcdiagOff{\@emptify\gmd@mcdiag} @@ -6737,16 +7022,18 @@ \@makeother\{\@makeother\}% \Character@Table} -\begingroup -\catcode`\<=1 \catcode`\>=2 % -\@makeother\{\@makeother\}% -\firstofone<\endgroup - \def\Character@Table#1{#2}<\endgroup - \message<^^J^^J gmdoc.sty package:^^J +\foone{% + \catcode`\[=1 \catcode`\]=2 % + \@makeother\{\@makeother\}}% +[ + \def\Character@Table#1{#2}[\endgroup + \message[^^J^^J gmdoc.sty package:^^J ==== The input file contains the \bslash CharacterTable.^^J ==== If you really need to check the correctness of the chars,^^J ==== please notify the author of gmdoc.sty at the email address^^J - ==== given in the legal notice in gmdoc.sty.^^J^^J>>> + ==== given in the legal notice in gmdoc.sty.^^J^^J]% + %^^A~\gmd@countlines[#1]\gmd@countlines[#2] + ]] % Similarly as \docfm, \gmdoc\ provides \env{macrocode}, \env{macro} % and \env{environment} environments. Unlike in \docfm, % |\end{macrocode}| \emph{does not} require to be preceded with any @@ -7075,14 +7362,8 @@ % of the \env{macro} environment removed} \AtBegInputOnce{\StraightEOL \let\@MakeShortVerb=\old@MakeShortVerb - %\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}% + % \label{oldmkshvrrb} + \OldMacrocodes}% \bgroup\@makeother\_% it's to allow |_| in the filenames. The next % macro will close the group. \Doc@Input} @@ -7147,7 +7428,7 @@ % a~space or an opening brace a~letter seems so perverse that we may % feel safe not to take account of such a~possibility. % -% When |countalllines| option is enabled, the comment lines +% When |countalllines*| option is enabled, the comment lines % that don't produce any printed output result with a~(blank) line too % because there's put a~hypertarget at the beginning of them. But for % now let's assume this option is for draft versions so hasn't be @@ -7159,7 +7440,7 @@ % request when I~only know the classes' names and their `marginpar % status'. % -% When the |countalllines| option is in force, some |\list| +% When the |countalllines*| option is in force, some |\list| % environments shall raise the `missing |\item|' error if you don't % put the first |\item| in the same line as % |\begin{|\<environment>|}| because the (comment-) line number is @@ -7184,10 +7465,9 @@ % unexpected large vertical space. Adding a~fully blank line between % the printed narration text and not printed stuff helped. % -% My \TeX\ Guru remarked that |\jobname| expands to the main file name -% without extension iff that extension is \file{.tex}. Should -% I~replace |\jobname| with |\jobnamewoe| then? (The latter always -% expands to the file name without extension.) +% Specifying |codespacesgrey, codespacesblank| results in typesetting +% all the spaces grey including the leading ones. +% % % About the \ds\ \gmiflink{verbatim mode directive} see above. % @@ -7314,7 +7594,9 @@ % \cs{everyeof} the \cs{(No)EOF} is now not necessary at the end of % \cs{DocInput} file.} % -% +% \changes{v0.99m}{2008/08/08}{Counting of all lines developed (the +% \env{countalllines} package option), now it +% uses \cs{inputlineno}} % % \Finale diff --git a/Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls b/Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls index 59ccceecc28..e47026e2115 100644 --- a/Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls +++ b/Master/texmf-dist/tex/latex/gmdoc/gmdocc.cls @@ -34,6 +34,7 @@ % \chschange{v0.77}{2007/11/16}{262} % \chschange{v0.78}{2007/11/19}{267} % \chschange{v0.79}{2008/8/3}{271} +% \chschange{v0.79}{2008/8/9}{271} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{gmdocc} @@ -158,8 +159,6 @@ \ifx\gmcc@CLASS\gmcc@resa\gmcc@mwclstrue\fi}% } - - \gm@DOX{mwart}{\gmcc@class{mwart}}% The \pk{mwart} class may also % be declared explicitly. @@ -275,9 +274,9 @@ \newif\ifSecondClass}{} %\fi\fi -%\iffalse +% \skiplines \ifSecondClass\else -%\fi\fi +% \endskiplines \ifgmcc@mwcls \IfFileExists{\gmcc@CLASS.cls}{}{\gmcc@mwclsfalse}% As % announced, we do the ontological test to any \pk{mwcls}. @@ -294,11 +293,11 @@ \LoadClass[fleqn, 11pt]{article}% Otherwise the standard \pk{article} is % loaded. \fi -% \iffalse\iffalse +% \skiplines \fi -% of ifSecondClass'es \cs{else} (a~feature under construction).\fi +% of ifSecondClass'es \cs{else} (a~feature under construction).\endskiplines -\RequirePackage{gmutils}[2008/08/03]% earlier to provide |\@ifXeTeX|. +\RequirePackage{gmutils}[2008/08/09]% earlier to provide |\@ifXeTeX|. \ifgmcc@mwcls\afterfi\ParanoidPostsec\fi diff --git a/Master/texmf-dist/tex/latex/gmdoc/gmoldcomm.sty b/Master/texmf-dist/tex/latex/gmdoc/gmoldcomm.sty index e4bcc16cbf5..641061ed610 100644 --- a/Master/texmf-dist/tex/latex/gmdoc/gmoldcomm.sty +++ b/Master/texmf-dist/tex/latex/gmdoc/gmoldcomm.sty @@ -17,8 +17,9 @@ % % % \stanza -% Scan CSs and put them in tt. If at beginning of line, precede them +% Scan \acro{CS}s and put them in tt. If at beginning of line, precede them % with |%|. Obey lines in the commentary. +% \FileInfo \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{gmoldcomm} @@ -27,7 +28,8 @@ \newenvironment{oldcomments}{% \catcode`\\=\active \let\do\@makeother - \do\$% Not only CSs but also special chars happen in the old comments. + \do\$% Not only \acro{CS}s but also special chars occur in the old + % comments. \do\|\do\#\do\{\do\}\do\^\do\_\do\&% \gmoc@defbslash \obeylines |