diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/gmdoc |
Initial commit
Diffstat (limited to 'macros/latex/contrib/gmdoc')
-rw-r--r-- | macros/latex/contrib/gmdoc/README | 121 | ||||
-rw-r--r-- | macros/latex/contrib/gmdoc/basedrivers/doc_gmdoc.tex | 181 | ||||
-rw-r--r-- | macros/latex/contrib/gmdoc/basedrivers/docstrip_gmdoc.tex | 114 | ||||
-rw-r--r-- | macros/latex/contrib/gmdoc/basedrivers/source2e_gmdoc.tex | 641 | ||||
-rw-r--r-- | macros/latex/contrib/gmdoc/gmdoc.pdf | bin | 0 -> 3021036 bytes | |||
-rw-r--r-- | macros/latex/contrib/gmdoc/gmdoc.sty | 4312 | ||||
-rw-r--r-- | macros/latex/contrib/gmdoc/gmdocc.cls | 340 | ||||
-rw-r--r-- | macros/latex/contrib/gmdoc/gmglo.ist | 9 | ||||
-rw-r--r-- | macros/latex/contrib/gmdoc/gmoldcomm.sty | 94 |
9 files changed, 5812 insertions, 0 deletions
diff --git a/macros/latex/contrib/gmdoc/README b/macros/latex/contrib/gmdoc/README new file mode 100644 index 0000000000..a2e161e137 --- /dev/null +++ b/macros/latex/contrib/gmdoc/README @@ -0,0 +1,121 @@ +The gmdoc.zip package +is a work of Grzegorz Murzynowski, +<natror at o2 dot pl> + + +1. Copyright 2006, 2007, 2008, 2009, 2010 by Grzegorz `Natror' Murzynowski + +This program is subject to the LaTeX Project Public License. +See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html +for the details of that license. + + +2. Introduction + +This package provides a tool for documenting of (La)TeX +packages, classes etc., i.e., the .sty, .cls +etc. The author just writes the code and adds the commentary +preceded with % sign (or another sign properly declared). No special +environments are necessary. + +The package tends to be compatible with the standard doc.sty +package, i.e., the .dtx files are also compilable with +gmdoc (they may need very little adjustment, in some rather +special cases). + +The tools are integrated with hyperref.sty's advantages such as +hyperlinking of index entries, of contents entries and +of cross-references. + + +3. Installation + +Unpack the gmdoc-tds.zip archive in a texmf directory or put the +gmdoc.sty, gmdocc.cls and gmoldcomm.sty somewhere in the +texmf/tex/latex branch on your own and also the gmiflink.sty, +gmverb.sty and gmiflink.sty files (available on CTAN in separate +packages). (Creating a /texmf/tex/latex/gm directory may be advisable +if you consider using other packages written by me.) + +Moreover, you should put the gmglo.ist file, a MakeIndex style for the +changes' history, into some texmf/makeindex directory. + +Then you should refresh your TeX distribution's files' +database most probably. + + +4. Contents + +The distribution of this package consists of the following five files. + +gmdoc.sty +gmdocc.cls +gmglo.ist +README +gmdoc.pdf +gmdoc-tds.zip + +5. Documentation + +The last of the above files (the .pdf) is a documentation compiled +from the .sty file by running LaTeX on the gmdocDoc.tex file twice: +xelatex gmdoc.sty + in the directory you wish the documentation to be in, +you don't have copy the .sty file there---TeX will find it, +then MakeIndex on the gmdoc.idx and gmdoc.glo files, and then LaTeX +on gmdocDoc.tex twice again. + +MakeIndex shell commands: + makeindex -r gmdocDoc + makeindex -r -s gmglo.ist -o gmdocDoc.gls gmdocDoc.glo +The -r switch is to forbid MakeIndex make implicit ranges since the +(code line) numbers will be hyperlinks. +The -s switch makes MakeIndex use the style file instead of the +default settings and the -o switch declares the not-default name of +the output file + +Compiling of the documentation requires the packages gmdoc.sty (with +the gmdocc.cls class), gmiflink.sty, gmverb.sty, gmutils.sty and also +some standard packages: hyperref.sty, xcolor.sty, geometry.sty, +multicol.sty, lmodern.sty, fontenc.sty that should be installed on +your computer by default. + +The gmglo.ist file, a MakeIndex style for the changes' history, is +provided on CTAN in the gmdoc .zip archive and should +be put into some texmf/makeindex directory. + +If you have not installed the mwcls classes (available on CTAN and +present in TeX Lives e.g.), the result of your compilation may differ +a bit from the .pdf provided in this .zip archive in formattings: If +you have not installed mwcls, the standard article.cls will be +used. + + +DEPENDS ON (only non-standard files listed): + +gmiflink.sty +gmutils.sty +gmverb.sty +gmglo.ist + +*if you typeset The LaTeX 2e Source + +BONUS: Base drivers + +As a bonus and example of doc-compatibility +there are driver files included +(cf. Palestrina, Missa papae Marcelli ;-): + +source2e_gmdoc.tex +docstrip_gmdoc.tex +doc_gmdoc.tex + +(gmsource2e.ist is generated from source2e_gmdoc.tex) +gmoldcomm.sty + +These drivers typeset the respective files from the +.../texmf-dist/source/latex/base +directory of TeXLive2005 distribution. +Probably you should redefine the \BasePath macro in them +so that it points that directory on your computer. + diff --git a/macros/latex/contrib/gmdoc/basedrivers/doc_gmdoc.tex b/macros/latex/contrib/gmdoc/basedrivers/doc_gmdoc.tex new file mode 100644 index 0000000000..661cdff603 --- /dev/null +++ b/macros/latex/contrib/gmdoc/basedrivers/doc_gmdoc.tex @@ -0,0 +1,181 @@ +%% +% \skiplines +%<*master> +%% \iffalse ^^A we skip the debug setting +\IfFileExists{\string~/bin/gen_and_xela}{\errorcontextlines=1000 }{} +%% \fi +%% ^^A $Id: TheUltimateMaster.gmd,v 0.298 2011/02/02 18:35:58 natror Exp natror $ +% \endskiplines +% +%% \BundleInfoFromName{doc_gmdoc} +%% \title{\doc_gmdocTitle } +%% \author{Grzegorz Murzynowski} +%% \maketitle +%% +%% \let\ty\emph \let\df\dekfracc +%% +%% \begin{copyrnote} +%% +%% +%% Copyright ©\, +%% by Grzegorz ‘Natror’ Murzynowski +%% natror (at) gmail (dot) com +%% +%% This program is subject to the \LaTeX\ Project Public License. +%% See ^^A +%% \url{http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html} ^^A +%% for the details of that license.\rrthis +%% +%% \acro{LPPL} status: "author-maintained". \par +%% +%% +%% +%% +%% +%% For the documentation please refer to the file(s) +%% \file{doc_gmdoc.{gmd,pdf}}. +%% +%% \end{copyrnote} +%% +% +% +% \skiplines +%</master> +% \endskiplines +% +% +%% +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{doc_gmdoc} + [2010/09/25 v0.993 (GM)] + + +%% +\PassOptionsToPackage{hyperindex=false}{hyperref}% Because FM writes some almost + +\documentclass[countalllines, +codespacesblank, outeroff, pagella, cronos, cursor, +fontspec=quiet]{gmdocc} +\usepackage{array} + +\VisSpacesGrey + +\def\BasePath{/home/natror/texmf/source/latex/base/}% Of course, + +\ltxLookSetup +\gmdoccMargins +\olddocIncludes% This is the crucial declaration. +\twocoltoc + +\DeleteShortVerb\| +\OldMakeShortVerb*\| +\HideAllDefining + +\makeatletter + +\edef\gmd@wykrzykniki{\xiihash\space\xiihash\space} +\edef\gmd@wykrzykniki{\gmd@wykrzykniki\gmd@wykrzykniki} +\edef\gmd@wykrzykniki{\gmd@wykrzykniki\gmd@wykrzykniki} +\edef\gmd@wykrzykniki{\gmd@wykrzykniki\gmd@wykrzykniki} + +\author{Frank Mittelbach \and David Carlisle} +\title{The \pk{doc} and \pk{shortvrb} Packages\\ and\\ + the \pk{ltxdoc} Class} +\date{Typeset with the \pk{gmdoc} package by Natror\\\today} + +\errorcontextlines=1000 +\fooatletter{% + \typeout{@@@@@ \meaning\@begindocumenthook}} +\begin{document} + +\smartunder + +\typeout{@@@@ in document} + +\maketitle +\typeout{@@@@ after title} + +\addtocontents{toc}{% to discard |\begin{multicols}{2}| of one + % included document. (Table of contents is declared twocolumn with + % |\twocoltoc| above.) + \let\protect\begin\protect\@gobbletwo + \protect\Store@Macro\protect\end + \def\protect\end{\protect\Restore@Macro\protect\end\protect\@gobble}% +}% Because one document has a~\env{multicols} twocolumn table of + +\tableofcontents + + +\makeatletter +\AfterMacrocode{161}{% it's for a~tiny little typo in line 3299: They + % forgot to wrap |\@tempb| and |\@tempc| in shortverbs. + \def\@tempb{\cs{@tempb} }\def\@tempc{\cs{@tempc} }} + +\AtBegInputOnce{% + \chschange{v2.1b}{2006/10/20}{2126}% + \let\CheckSum\gobble + % \par Of course, none of the documents is not loaded, so we give the + % fileinfo explicitly. + \def\filedate{2004/02/09}\def\fileversion{v2.1b}% + % \label{explicit fileinfo} + \let\GetFileInfo\relax + \addtomacro\IndexParms{\arraybackslash}}% because |\IndexParms| use + +\DocInclude[\BasePath]{doc} + +\AtBegInputOnce{% + \chschange{v2.0u}{2006/10/20}{410}% + \let\CheckSum\gobble + \def\filedate{1999/08/08} \def\fileversion{v2.0u}% see line + % \ref{explicit fileinfo}. + \let\GetFileInfo\relax + % The rest of this |\AtBegInputOnce|'s contents is necessary since + % DC wrote it not commented out, which with \pk{doc} results with + % printing it both to the package (class) and the documentation, but + % with \pk{gmdoc} it puts this stuff in the code layer that'll be + % only printed verbatim. + \providecommand\dst{\expandafter{\normalfont\scshape docstrip}} + \title{The file \texttt{ltxdoc.dtx} for use with + \LaTeXe.\thanks{This file has version + number \fileversion, dated \filedate.}\\[2pt] + It contains the code for \texttt{ltxdoc.cls}} + \date{\filedate} + \author{David Carlisle} + \maketitle} + +\DocInclude[\BasePath]{ltxdoc}% + +\gmdocIncludes + +\AtBegInputOnce{% + \title{\pk{doc_by_gmdoc.tex} The Driver\thanks{As mentioned in the + title, I~typeset these package and class with the \pk{gmdoc} + package, for which are they a~great inspiration and the base. + The typesetting needed only a~few tricks, so here i~give the + code of the `driver': a~snake eats its tail ;-) .}} + \author{Grzegorz `Natror' Murzynowski}% + \date{\today}% + \maketitle} +\SelfInclude + +\typeout{% + Produce change log with^^J% + makeindex -r -s gmglo.ist -o \jobname.gls \jobname.glo^^J + (gmglo.ist should be put into some texmf/makeindex directory.)^^J} +\PrintChanges +\typeout{% + Produce index with^^J% + makeindex -r \jobname^^J} + \PrintIndex + +\end{document} + + +makeindex -r doc_gmdoc +makeindex -r -s gmglo.ist -o doc_gmdoc.gls doc_gmdoc.glo + + +\endinput +%% +%% End of file `doc_gmdoc.tex'. diff --git a/macros/latex/contrib/gmdoc/basedrivers/docstrip_gmdoc.tex b/macros/latex/contrib/gmdoc/basedrivers/docstrip_gmdoc.tex new file mode 100644 index 0000000000..42a6e4ef37 --- /dev/null +++ b/macros/latex/contrib/gmdoc/basedrivers/docstrip_gmdoc.tex @@ -0,0 +1,114 @@ +%% +% \skiplines +%<*master> +%% \iffalse ^^A we skip the debug setting +\IfFileExists{\string~/bin/gen_and_xela}{\errorcontextlines=1000 }{} +%% \fi +%% ^^A $Id: TheUltimateMaster.gmd,v 0.298 2011/02/02 18:35:58 natror Exp natror $ +% \endskiplines +% +%% \BundleInfoFromName{docstrip_gmdoc} +%% \title{\docstrip_gmdocTitle } +%% \author{Grzegorz Murzynowski} +%% \maketitle +%% +%% \let\ty\emph \let\df\dekfracc +%% +%% \begin{copyrnote} +%% +%% +%% Copyright ©\, +%% by Grzegorz ‘Natror’ Murzynowski +%% natror (at) gmail (dot) com +%% +%% This program is subject to the \LaTeX\ Project Public License. +%% See ^^A +%% \url{http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html} ^^A +%% for the details of that license.\rrthis +%% +%% \acro{LPPL} status: "author-maintained". \par +%% +%% +%% +%% +%% +%% For the documentation please refer to the file(s) +%% \file{docstrip_gmdoc.{gmd,pdf}}. +%% +%% \end{copyrnote} +%% +% +% +% \skiplines +%</master> +% \endskiplines +% +% +%% +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{docstrip_gmdoc} + [2010/09/25 v0.993 (GM)] + + +%% + +\PassOptionsToPackage{countalllines,codespacesgrey,indexallmacros}{gmdoc} + +\if11 + \documentclass[debug, pagella, fontspec=quiet]{gmdocc}% + \mcdiagOn +\else + \documentclass[pagella]{gmdocc}% +\fi + +\ltxLookSetup +\gmdoccMargins +\twocoltoc% For towocolumn table of contents. + +\DeleteShortVerb\| +\OldMakeShortVerb*\|% To define shortverb \verb+|+ such that it + +\relaxen\ds +\emptify\EOFMark + +\fooatletter{% + \@ifXeTeX{% + \let\gm@TrueAcute\' + \def\'#1{% + \ifx\f@family\rmdefault + \if n#1\nacute + \else\typeout{****** \cs{'} with argument }\show#1 + \fi + \else + \gm@TrueAcute#1% + \fi + }}{}} + +\HideAllDefining + +\begin{document} + +\def\BasePath{/home/natror/texmf/source/latex/base/} + \addtomacro\endabstract{\aftergroup\tableofcontents} + \AtBegInputOnce{\date{Printed \today\\ with \pk{gmdoc} package by + Natror}\let\date\gobble + \let\renewenvironment\gobbletwo}% the only renewed env.\ in + % \file{docstrip.dtx} is \env{theglossary}. I~prefer it to be twocolumn. + + + \OldDocInput{\BasePath docstrip.dtx} + + \typeout{% + ^^JProduce change log with^^J% + makeindex -r -s gmglo.ist -o \jobname.gls \jobname.glo^^J} + + \typeout{% + ^^JProduce index with^^J% + makeindex -r \jobname.idx^^J} + +\end{document} + +\endinput +%% +%% End of file `docstrip_gmdoc.tex'. diff --git a/macros/latex/contrib/gmdoc/basedrivers/source2e_gmdoc.tex b/macros/latex/contrib/gmdoc/basedrivers/source2e_gmdoc.tex new file mode 100644 index 0000000000..bbe5e70afd --- /dev/null +++ b/macros/latex/contrib/gmdoc/basedrivers/source2e_gmdoc.tex @@ -0,0 +1,641 @@ +% \iffalse meta-comment +% +% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2006 +% The LaTeX3 Project and any individual authors listed elsewhere +% in this file. +% +% This I~hope would be part of the LaTeX base system. +% ------------------------------------------- +% +% It may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.2 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.2 or later is part of all distributions of LaTeX +% version 1999/12/01 or later. +% +% The list of all files belonging to the LaTeX base distribution is +% given in the file `manifest.txt'. See also `legal.txt' for additional +% information. +% +% \fi +% +% \division{Some Typesetting Remarks} +% +% This driver typesets The Source $2_\varepsilon$ included in the +% \TeX Live 2005 distribution. Some tricks here are done just for +% fixing typos in the Source Files. The Source Files themselves are +% intact. +% +% Most probably you should redefine the |\BasePath| macro so that it +% was the path of the \file{\dots/source/latex/base} directory on your +% system. The path levels should be separated with slashes (even on +% Windows) and should also end with a~slash (to concatenate well with +% the file name). +% +% \stanza +% While \TeX ing The Source again after a~fatally erroneous pass there +% happened the `\TeX\ capacity exceded error' sometimes. \TeX ing once +% again was the right thing to do. +% +% The \pk{hyperref} package usually issues some warnings about non +% existence of some hypertargets. I~consider it rather a~feature of +% \pk{hyperref} (a~bug?) than a~bug in the typeset file(s). +% +% \stanza +% One more thing you shouldn't bother of is the differences of the +% checksums, I~mean the usual \pk{gmdoc} message that the checksum +% stated in the file differs from \pk{gmdoc}'s own count. That is +% O.K.\ since the checksum stated in a~traditional \file{.dtx} +% is the number of backslashes in the macrocodes while the checksum +% handled and expected by \pk{gmdoc} is the number of \emph{the escape ^^B +% chars}. Don't get the difference? Assume the declared code escape +% char is |\| (as usual) and consider |\\| in the code. Due to +% the traditional counting this CS increases the checksum by 2 while +% due to mine by 1: the second bslash is \emph{not} escape char: it's +% the CS name. +% +% Moreover, when you declare |\CodeEscapeChar\!| e.g., the code +%\[\hbox{|!Alice !\!has !an !aligator|}\] +% increases the `new way' checksum by 5 not by 1 as it would do the +% traditional one. +% +% \stanza +% This driver uses an unofficial little package \pk{gmeometric} to +% allow the |\geometry| command also inside \env{document}. This +% package is included in the drivers' directory. +% +% +% \division{The Body} +% +% ``This document will typeset the \LaTeX\ sources as a single document. +% This will produce quite a large file (roughly 555 pages) and may +% take a long time. +% +% Some notes on processing this document are contained at the end +% of this document's source file, after |\end{document}| (not typeset).'' +% +% GM 2006/12/1 +% +% First a special index style for makeindex. +% + +\begin{filecontents}{gmsource2e.ist} +preamble +"\n \\begin{theindex} \n" +postamble +"\n\n \\end{theindex}\n" +% ^^A~The next lines will produce some warnings when +% ^^A~running Makeindex as they try to cover two different +% ^^A~versions of the program: +% ^^A +% ^^A~The three lines below caused unclosed groups in the .ind +% file. May they be cursed! +% ^^A~lethead_prefix "{\\bfseries\\hfill " +% ^^A~lethead_suffix "\\hfill}\\nopagebreak\n" +% ^^A~lethead_flag 1 +heading_prefix "{\\bfseries\\hfill " +heading_suffix "\\hfill}\\nopagebreak\n" +headings_flag 1 + +% and just for source2e:\\ +% Remove R so I is treated in sequence I J K not I II III +page_precedence "rnaA" +\end{filecontents} + + +\PassOptionsToPackage{codespacesgrey, indexallmacros}{gmdoc} + +\if11 + \documentclass[debug, minion, cronos, cursor, fontspec=quiet]{gmdocc}% + + % ^^A[FakeBold=2, FakeStretch=0.87]{Nimbus Mono L} + \mcdiagOn + +\else + \documentclass[fontspec=quiet]{gmdocc}% +\fi + +\foone{\catcode`_=12 } +{\if1 1\includeonly{source2e_by_gmdoc}\fi} + +%^^A\usepackage[margin=2cm,b5paper]{geometry}% and this +\usepackage{gmoldcomm}% Definitions of \env{oldcomments} and |\task|. + + +\listfiles + +\ltxLookSetup +\gmdoccMargins +\olddocIncludes% This is the crucial declaration to drive \pk{gmdoc} into +% the traditional settings. +\twocoltoc% For towocolumn table of contents. + +\DeleteShortVerb\| +\OldMakeShortVerb*\|% To define shortverb \verb+|+ such that it +% remains shortverb in math mode (by default I~define it to be $\vert$ in +% math mode. + +% Do not index some TeX primitives, and some common plain TeX commands. + +\DoNotIndex{\def,\long,\edef,\xdef,\gdef,\let,\global} +\DoNotIndex{\if,\ifnum,\ifdim,\ifcat,\ifmmode,\ifvmode,\ifhmode,% + \iftrue,\iffalse,\ifvoid,\ifx,\ifeof,\ifcase,\else,\or,\fi} +\DoNotIndex{\box,\copy,\setbox,\unvbox,\unhbox,\hbox,% + \vbox,\vtop,\vcenter} +\DoNotIndex{\@empty,\immediate,\write} +\DoNotIndex{\egroup,\bgroup,\expandafter,\begingroup,\endgroup} +\DoNotIndex{\divide,\advance,\multiply,\count,\dimen} +\DoNotIndex{\relax,\space,\string} +\DoNotIndex{\csname,\endcsname,\@spaces,\openin,\openout,% + \closein,\closeout} +\DoNotIndex{\catcode,\endinput} +\DoNotIndex{\jobname,\message,\read,\the,\m@ne,\noexpand} +\DoNotIndex{\hsize,\vsize,\hskip,\vskip,\kern,\hfil,\hfill,\hss} +\DoNotIndex{\m@ne,\z@,\z@skip,\@ne,\tw@,\p@} +\DoNotIndex{\dp,\wd,\ht,\vss,\unskip} + +% Set up the Index and Change History to use |\part|. +\makeatletter +\def\indexdiv{\part*} +\AtDIPrologue{\@ifnotmw{% + \markboth{Index}{Index}% + \addcontentsline{toc}{part}{Index}}{}% +} + +\GlossaryPrologue{\part*{Change History}% + % Allow control names to be hyphenated here\dots + {\GlossaryParms\ttfamily\hyphenchar\font=`\-}% + \@ifnotmw{% + \markboth{Change History}{Change History}% + \addcontentsline{toc}{part}{Change History}}{}% +} + +% ``The standard |\changes| command modified slightly to better cope with +% this multiple file document.''--- Not quite: +\makeatletter +% \begin{verbatim} +% % \def\changes@#1#2#3{% +% % \let\protect\@unexpandable@protect +% % \edef\@tempa{\noexpand\glossary{#2\space\currentfile\space#1\levelchar +% % \ifx\saved@macroname\@empty +% % \space +% % \actualchar +% % \generalname +% % \else +% % \expandafter\@gobble +% % \saved@macroname +% % \actualchar +% % \string\verb\quotechar*% +% % \verbatimchar\saved@macroname +% % \verbatimchar +% % \fi +% % :\levelchar #3}}% +% % \@tempa\endgroup\@esphack} +%\end{verbatim} +\makeatother + +% Produce a Change Log and (2 column) Index. +\RecordChanges +\CodelineIndex +\EnableCrossrefs +\setcounter{IndexColumns}{2} + +% Needed for documentation in \file{ltoutenc.dtx}. +\usepackage{textcomp} + +\olddocIncludes +\HideAllDefining + +\fooatletter{% + \@ifXeTeX{% + \def\"#1{% + \if o#1\oumlaut\fi + \if u#1\uumlaut\fi +%^^A \else\typeout{****** \cs{"} with argument }\show#1\fi + }}{}} + +\foone{\makeatletter\catcode`\#=12 }{% + \def\gmd@wykrzykniki{# # # # # # # # #}} + +\begin{document} + + + \title{The \LaTeXe\ Sources\thanks{Typeset with \pk{gmdoc} by Natror + on \today.}} + \author{% + Johannes Braams\\ + David Carlisle\\ + Alan Jeffrey\\ + Leslie Lamport\\ + Frank Mittelbach\\ + Chris Rowley\\ + Rainer Sch\"opf} + + +\def\BasePath{/home/natror/texmf/source/latex/base/} + + +% This command will be used to input the patch file +% if that file exists. +\newcommand{\includeltpatch}{% + \def\currentfile{ltpatch.ltx} + \part{ltpatch} + {\let\ttfamily\relax + \xdef\filekey{\filekey, \thepart={\ttfamily\currentfile}}}% + Things we did wrong\ldots + \IndexInput{ltpatch.ltx}} + + + +% Get the date from \file{ltvers.dtx} +\makeatletter +\let\patchdate=\@empty +\begingroup + \def\ProvidesFile#1\fmtversion#2{\date{#2}\endinput} + \input{\BasePath ltvers.dtx} +\global\let\X@date=\@date + +% Add the patch version if available. + \long\def\Xdef#1#2#3\def#4#5{% + \xdef\X@date{#2}% + \xdef\patchdate{#5}% + \endinput}% + \InputIfFileExists{ltpatch.ltx} + {\let\def\Xdef}{\global\let\includeltpatch\relax} +\endgroup + +\ifx\@date\X@date + \def\Xpatch{0} + \ifx\patchdate\Xpatch\else + \edef\@date{\@date\space Patch level \patchdate} + \fi +\else + \@warning{ltpatch.ltx does not match ltvers.dtx!} + \let\includeltpatch\relax +\fi +\makeatother + +\pagenumbering{roman} +\thispagestyle{empty} + +%^^A\traceon +\maketitle +\relax +%^^A \traceoff +\emptify\maketitle + +\tableofcontents + +\clearpage + +\pagenumbering{arabic} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%``Each of the following |\DocInclude| lines includes a file with extension +% \file{.dtx}. Each of these files may be typeset separately. For instance +%\[\hbox{|latex ltboxes.dtx|}\] +% will typeset the source of the \LaTeX\ box commands.'' +% +% (Well, I~(Natror) prepared only this common driver.) +% +% If this file is processed, each of these separate \file{.dtx} files will be +% contained as a part of a single document. Using \file{ltxdoc.cfg} you can +% then optionally produce a combined index and/or change history for +% the entire source of the format file. Note that such a document will +% be quite large (about 555 pages). +% + +\DocInclude[\BasePath]{ltdirchk} % System dependent initialisation + +\AfterMacrocode{53}{\def\do{\cs{do}}}% A~bare |\do| in narration on +% line 161. + \DocInclude[\BasePath]{ltplain} % LaTeX version of Knuth's \file{plain.tex}. + + \DocInclude[\BasePath]{ltvers} % Current version date. + + \DocInclude[\BasePath]{ltdefns} % Initial definitions. + + \DocInclude[\BasePath]{ltalloc} % Allocation of counters and others. + + \DocInclude[\BasePath]{ltcntrl} % Program control macros. + + \DocInclude[\BasePath]{lterror} % Error handling. + + \DocInclude[\BasePath]{ltpar} % Paragraphs. + + \DocInclude[\BasePath]{ltspace} % Spacing, line and page breaking. + + \DocInclude[\BasePath]{ltlogos} % Logos. + + \DocInclude[\BasePath]{ltfiles} % |\input| files and related commands. + +\AtBegInputOnce{\let\task\gobble}% In general |\task| gobbles two, but +% in this file it's used with one argument and next to it is +% |\changes| (which in \pk{gmdoc} is |\outer| so gobbling it raises an +% error). + \DocInclude[\BasePath]{ltoutenc} % Output encoding interface. + + \DocInclude[\BasePath]{ltcounts} % Counters. + + \DocInclude[\BasePath]{ltlength} % Lengths. + + \DocInclude[\BasePath]{ltfssbas} % NFSS Base macros. + +%^^A\AtBegInputOnce{\addtomacro\maketitle{\traceoff}\traceon}%{\nameshow{@author}\show\maketitle\nameshow{@maketitle}} + \DocInclude[\BasePath]{ltfsstrc} % NFSS Tracing (and \file{tracefnt.sty}). + + \DocInclude[\BasePath]{ltfsscmp} % NFSS1 Compatibility. + + \DocInclude[\BasePath]{ltfssdcl} % NFSS Declarative interface. + + \DocInclude[\BasePath]{ltfssini} % NFSS Initialisation. + + \DocInclude[\BasePath]{fontdef} % \file{fonttext.ltx/fontmath.ltx} + + \DocInclude[\BasePath]{preload} % \file{preload.ltx} + + \DocInclude[\BasePath]{ltfntcmd} % |\textrm| etc. + + \DocInclude[\BasePath]{ltpageno} % Page numbering. + + \DocInclude[\BasePath]{ltxref} % Cross referencing. + + \AfterMacrocode{1137}{\let\GMDebugCS\cs + \def\cs##1{\expandafter\GMDebugCS\expandafter{\string##1}}} + % |\cs{\@defaultsubs}| on line 257, |\cs{\@refundefined}| on line + % 263. It's the first step. The next is done before |\PrintChanges|. + \AfterMacrocode{1139}{\let\cs\GMDebugCS} + \AfterMacrocode{1183}{% The last |\changes| have second argument + % |{1994/05/26/16}|. + \csname changes\endcsname{v0.9i}{1993/12/16}{\cs{literal} added}% + \csname changes\endcsname{v1.0r}{1994/05/26}{\cs{literal} removed}% + \gdef\GMdebugChanges{\expandafter\def\csname + changes\endcsname####1####2####3{}}% + \aftergroup\GMdebugChanges}% A~trick with |\aftergroup| 'cause + % that \env{macrocode} is inside \env{macro}. + \DocInclude[\BasePath]{ltmiscen} % Miscellaneous environment definitions. + + \DocInclude[\BasePath]{ltmath} % Mathematics set up. + + \DocInclude[\BasePath]{ltlists} % List and related environments. + + \DocInclude[\BasePath]{ltboxes} % Parbox and friends. + + \DocInclude[\BasePath]{lttab} % \env{tabbing}, \env{ tabular} and \env{array}. + + \DocInclude[\BasePath]{ltpictur} % Picture mode. + + \DocInclude[\BasePath]{ltthm} % Theorem environments. + + \DocInclude[\BasePath]{ltsect} % Sectioning. + + \DocInclude[\BasePath]{ltfloat} % Floats. + + \DocInclude[\BasePath]{ltidxglo} % Index and Glossary. + + \DocInclude[\BasePath]{ltbibl} % Bibliography. + + \DocInclude[\BasePath]{ltpage} % |\pagestyle|, |\raggedbottom|, |\sloppy|. + + \DocInclude[\BasePath]{ltoutput} % Output routine. + + \DocInclude[\BasePath]{ltclass} % Package \& Class interface. + + \DocInclude[\BasePath]{lthyphen} % Hyphenation (\file{hyphen.ltx}). + + \DocInclude[\BasePath]{ltfinal} % Last minute initialisations and dump. + + \includeltpatch % Corrections distributed after the full release. + +% Stop here if \file{ltxdoc.cfg} says |\AtEndOfClass{\OnlyDescription}| +\StopEventually{\end{document}} + +\clearpage +\pagestyle{headings} + +% Make \TeX\ shut up. +\hbadness=10000 +\newcount\hbadness +\hfuzz=\maxdimen + +\typeout{% + ^^JProduce change log with^^J% + makeindex -r -s gmglo.ist -o \jobname.gls \jobname.glo^^J} + +{%^^A\def\.{\cs{.}}% 'cause there's |\cs {\.}| in change log on l.4314 + % The next step of debug of \file{ltmiscen.dtx}'s + % |\changes...{...\cs{\@defaultsubs...}}| etc.\\ How does it work? + % Remember |\cs| is robust. The typo lies in giving it a~CS argument + % instead of expected CS name without backslash. So, in the step 1 + % we only |\string| the argument CS to let it be written outto the + % \file{.glo} file. Then, in step 2, we redefine |\cs| to first + % |\string| its argument inside an |\if|. Remember that |\if| + % expands two tokens next to it until it finds sth.\ unexpandable, + % so it'll execute |\string|. Then, if the first char of the + % |\stringed| argument is |\|\catother, the condition is satisfied + % and |\if...\fi| expands to what follows that backslash and + % precedes |\else|. So if the argument was a~CS, its backslash will + % be gobbled by |\if|. Otherwise |\if...\fi| expands to what is + % between |\else| and |\fi|, to the unchanged argument that is. Then + % to that list of tokens the original |\cs| is applied. + \let\GMDebugCS\cs + \def\cs#1{\GMDebugCS{\if\bslash\string#1\else#1\fi}}% + \PrintChanges} + +\typeout{% + ^^JProduce index with^^J% + makeindex -r -s gmsource2e.ist \jobname.idx^^J} + +% ``Makeindex needs a symbol between the parts of composite page numbers +% but we dont want one, so:''---I~skip that. +% +%\begin{verbatim} +%% \begingroup +%% \def\endash{--} +%% \catcode`\-\active +%% \def-{\futurelet\temp\indexdash} +%% \def\indexdash{\ifx\temp-\endash\fi} +%\end{verbatim} +\geometry{bottom=3.6cm} +\clearpage +%^^A\onecolumn +%^^A~\clearpage is contained in |\geometry|. + + +\PrintIndex +%^^A\endgroup + +% Make sure that the index is not printed twice +% (ltxdoc.cfg might have a second \PrintIndex command) +\let\PrintChanges\relax +\let\PrintIndex\relax + +\gmdoccMargins +\clearpage +\csname @ifnotmw\endcsname{\pagestyle{headings}}{\pagestyle{outer}} + +\gmdocIncludes +\SelfInclude{%^^A\def\CommonEntryCmd{UsgEntry}%\label{UsgHack} + % ^^A\label{SelfIncludeUsg} + \csname gag@index\endcsname% we turn writing outto the \file{.idx} + % out for the driver since it's \emph{not} a~part of The Source. +%^^A \filediv[The New Driver?]{How I~did It or \gmhypertarget{The Driver} File}% +} + +\end{document} +%\NoEOF + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +To use this file to produce a fully indexed source code +you need to execute the following (or equivalent) commands: + + latex source2e_by_gmdoc.tex + + makeindex -s gmsource2e.ist source2e_by_gmdoc.idx + makeindex -s gmglo.ist -o source2e_by_gmdoc.gls source2e_by_gmdoc.glo + + latex source2e_by_gmdoc.tex + latex source2e_by_gmdoc.tex + + +The makeindex style gmsource2e.ist is used in place of the usual +doc gind.ist to ensure that I is used in the sequence I J K +not I II II, which would be the default makeindex behaviour. + +The third run with latex is only required to get the table of +contents entries for the change log and index. You may speed things up +by using the \includeonly mechanism so as not to typeset the source +files on the second run. This involves changing the file +ltxdoc.cfg +between the latex runs. + +The following unix script automates this. + (It could easily be ported to scripts for DOS or VMS, + rm is ReMove a file, and echo "..." > file writes ... to "file".) + + +After this script (after the second ==============) is a similar script +that will produce the documentation for all the files in the base +distribution that are *not* included in source2e.dvi. This second script +was requested, but before using it, beware it will take a long time! +It may however be modified as required, eg to not typeset the fdd files +or whatever... + + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +Natror (GM): I~didn't touch the following so it's probably not quite suitable +for gmdoc-ing. +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + +============== +#!/bin/sh + +rm -f source2e_by_gmdoc.gls source2e_by_gmdoc.ind source2e_by_gmdoc.toc + +# First run: +# Create new standard ltxdoc.cfg file +# Pass the (possibly empty) list of arguments supplied on the +# command line to article class. +# +# If you use A4 paper, running this script with argument +# a4paper +# may save about 30 pages. +# +echo "\PassOptionsToClass{$*}{article}" > ltxdoc.cfg + + +# Now LaTeX the file with this cfg file. +# +latex source2e.tex + + +# Make the Change log and Glossary. +# +makeindex -s source2e.ist source2e.idx +makeindex -s gglo.ist -o source2e.gls source2e.glo + + +# Second run: append \includeonly{} to ltxdoc.cfg to speed up things +# (this run needed only to get changes and index listed in .toc file) +# +# Note that the index will not be made incorrect by the insertion +# of the table of contents as the front matter uses a diferent page +# numbering scheme. +# +echo "\includeonly{}" >> ltxdoc.cfg + +latex source2e.tex + + +# Third and final run, to put everything together. +# First restore the cfg file: +# +echo "\PassOptionsToClass{$*}{article}" > ltxdoc.cfg +latex source2e.tex + + +============== +#!/bin/sh + +# Running this script will process all the dtx fdd and *guide.tex +# and ltnews*.tex files in the LaTeX distribution, except the dtx +# files included in source2e.tex. +# (The shell first script in the comments of source2e.tex will +# process those.) + +# Any command line arguments (eg a4paper) are taken as options to the +# article class. + +# This script is likely to take ages! + +echo "\PassOptionsToClass{$*}{article}" > ltxdoc.cfg +echo "\batchmode" >> ltxdoc.cfg + +# The next four lines produce full indexes and change logs +# you may not want those. +echo "\AtBeginDocument{\RecordChanges}" >> ltxdoc.cfg +echo "\AtEndDocument{\PrintChanges}" >> ltxdoc.cfg +echo "\AtBeginDocument{\CodelineIndex\EnableCrossrefs}" >> ltxdoc.cfg +echo "\AtEndDocument{\PrintIndex}" >> ltxdoc.cfg + +# If you do not want any code listings, just documentation, then instead +# of the above four lines, uncomment the following: +# echo "\AtBeginDocument{\OnlyDescription}" >> ltxdoc.cfg + +echo "\PassOptionsToClass{$*}{article}" > ltxguide.cfg +echo "\batchmode" >> ltxguide.cfg + +cp ltxguide.cfg ltnews.cfg + + +for i in *dtx *fdd *guide.tex ltnews*.tex +do +B=`basename $i .dtx` + +if (grep "Include{$B}" source2e.tex >/dev/null ; ) +then +echo In source2e: $i +else +echo latex $i + if (latex $i > /dev/null) + then + echo latex $i + latex $i > /dev/null + echo makeindex -s gind.ist $B.idx + makeindex -s gind.ist $B.idx > /dev/null 2> /dev/null + echo makeindex -s gglo.ist -o $B.gls $B.glo + makeindex -s gglo.ist -o $B.gls $B.glo > /dev/null 2> /dev/null + echo latex $i + latex $i > /dev/null + else + echo "!!! LaTeX ERROR: $i. (See $B.log.)" + fi +fi + +done diff --git a/macros/latex/contrib/gmdoc/gmdoc.pdf b/macros/latex/contrib/gmdoc/gmdoc.pdf Binary files differnew file mode 100644 index 0000000000..8562c462a4 --- /dev/null +++ b/macros/latex/contrib/gmdoc/gmdoc.pdf diff --git a/macros/latex/contrib/gmdoc/gmdoc.sty b/macros/latex/contrib/gmdoc/gmdoc.sty new file mode 100644 index 0000000000..a5bc976398 --- /dev/null +++ b/macros/latex/contrib/gmdoc/gmdoc.sty @@ -0,0 +1,4312 @@ +%% +%% \iffalse ^^A we skip the debug setting +\IfFileExists{\string~/bin/gen_and_xela}{\errorcontextlines=1000 }{} +%% \fi +%% ^^A $Id: TheUltimateMaster.gmd,v 0.298 2011/02/02 18:35:58 natror Exp natror $ +%% This is file “gmdoc.sty” generated with the DocStrip utility. +%% +%% +%% The original source files were: +%% +%% gmdoc/gmdoc.gmd (with options: `doc') +%% +%% +%% Copyright © 2006, 2007, 2008, 2009, 2010 +%% by Grzegorz ‘Natror’ Murzynowski +%% natror (at) gmail (dot) com +%% +%% This program is subject to the LaTeX Project Public License. +%% See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html +%% for the details of that license. +%% +%% LPPL status: "author-maintained". +%% +%% +%% +%% For the documentation please refer to the file(s) +%% gmdoc.{gmd,pdf}. +%% +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{gmdoc} + [2010/09/25 v0.993 a documenting package (GM)] + + +%% +%% ^^A( +%% \chschange{v0.98j}{2006/10/19}{4372} +%% \chschange{v0.98j}{06/10/19}{4372} +%% \begin{macrocode} +%%\end{macrocode} +%% \skiplines we skip the driver +%%\endskiplines + +\ifnum\catcode`\@=12 + +\errorcontextlines=100 + +\documentclass[countalllines, codespacesgrey, outeroff, debug, mwrep, +pagella, trebuchet, cursor, fontspec=quiet]{gmdocc} + +\verbLongDashes + +\DoNotIndex{\gmu@tempa \gmu@tempb \gmu@tempc \gmu@tempd \gmu@tempe \gmu@tempf} + +\twocoltoc +\title{The \pk{gmdoc} Package\\ i.e., \pk{gmdoc.sty} and + \pk{gmdocc.cls}} +\author{Grzegorz `Natror' Murzynowski} +\date{\ifcase\month\relax\or January\or February\or March\or April\or May\or + June\or July\or August\or September\or October\or November\or + December\fi\ \the\year} + +\begin{document} + +\emptify\udigits % because orig. def. raises an error `\cs{@secondoftwo} has + % an extra \}' +\maketitle + +\setcounter{page}{2}% \pk{hyperref} cries if it sees two pages +\tableofcontents +\DoIndex\maketitle + +\SelfInclude +\DocInclude{gmdocc} + +\skipgmlonely[\stanza The remarks about installation and compiling + of the documentation are analogous to those in the chapter + \pk{gmdoc.sty} and therefore omitted.\stanza] +\DocInclude{gmutils} +\DocInclude{gmiflink} +\DocInclude{gmverb} +\DocInclude{gmoldcomm} +\typeout{% + Produce change log with^^J% + makeindex -r -s gmglo.ist -o \jobname.gls \jobname.glo^^J + (gmglo.ist should be put into some texmf/makeindex directory.)^^J} +\PrintChanges +\typeout{% + Produce index with^^J% + makeindex -r \jobname^^J} + \PrintIndex + +\afterfi{% +\end{document} + makeindex -r gmdoc + makeindex -r -s gmglo.ist -o gmdocDoc.gls gmdocDoc.glo + + +}\fi% of |\ifnum\catcode`\@=12|, of the driver that is. + +\catcode`\^^C=9\relax +\RequirePackage{gmutils}[2008/08/30]% includes redefinition of +\RequirePackage{xkeyval}% we need key-vals later, but maybe we'll make + +\newif\if@linesnotnum + +\DeclareOption{linesnotnum}{\@linesnotnumtrue} + + +\newif\if@uresetlinecount + +\DeclareOption{uresetlinecount}{\@uresetlinecounttrue} + + +\newif\if@countalllines +\newif\if@printalllinenos + +\DeclareOption{countalllines}{% to use the \incs{inputlineno} + % primitive and print real line numbers % in a~file. + \@countalllinestrue + \@printalllinenosfalse} + +\DeclareOption{countalllines*}{% + \@countalllinestrue + \@printalllinenostrue} + + +\newif\if@noindex + +\DeclareOption{noindex}{\@noindextrue} + +\newif\if@pageindex + +\DeclareOption{pageindex}{\@pageindextrue} + + +\newif\if@indexallmacros + +\DeclareOption{indexallmacros}{\@indexallmacrostrue} + + +\@ifundefined{if@marginparsused}{\newif\if@marginparsused}{} + +\@ifclassloaded{article}{\@marginparsusedtrue}{} + +\@ifclassloaded{report}{\@marginparsusedtrue}{} + +\@ifclassloaded{book}{\@marginparsusedtrue}{} +\DeclareOption{withmarginpar}{\@marginparsusedtrue} + +\DeclareOption{nomarginpar}{\@marginparsusedfalse} + +\DeclareOption{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 \incs{visiblespace}. + \AtBeginDocument{\CodeSpacesGrey}}} + +\ProcessOptions + +\RequirePackage{gmutils}[2008/08/08] + +\RequirePackage{xcolor} +\definecolor{deepblue}{rgb}{0,0,.85} + + + +\@ifpackageloaded{hyperref}{\hypersetup{colorlinks=true, + linkcolor=deepblue, urlcolor=blue, filecolor=blue}}{% + \RequirePackage[colorlinks=true, linkcolor=deepblue, urlcolor=blue, + filecolor=blue, pdfstartview=FitH, pdfview=FitBH, + pdfpagemode=UseNone]{hyperref}} + + +\RequirePackage{gmiflink} +\RequirePackage{gmverb}[2010/08/12] + +\Store@Macros{\@verbatim\verb} + +\if@noindex + \AtBeginDocument{\gag@index}% for the latter macro see line + % \ref{gag@index}. +\else + \RequirePackage{makeidx}\makeindex +\fi + +\def\CodeDelim{\@bsphack\gmu@ifstar\Code@Delim@St\Code@Delim} + +\def\Code@Delim@St#1{% + {\escapechar\m@ne + \@xa\gdef\@xa\code@delim\@xa{\string#1}}% + \@esphack} + +\def\Code@Delim#1{\VerbHyphen{#1}\Code@Delim@St{#1}} + +\CodeDelim\% + +\pdef\narrationmark{{\codett\verbhyphen}{\normalfont\enspace}\ignorespaces} + + +\newtoks\gmd@preverypar + +\newcommand*\settexcodehangi{% + \hangindent=\verbatimhangindent \hangafter=\@ne}% we'll use +\@ifdefinable\@@settexcodehangi{\let\@@settexcodehangi=\settexcodehangi} + + +\newlength\TextIndent +\newlength\CodeIndent +\CodeIndent=1,5em\relax +\@ifundefined{stanzaskip}{\newlength\stanzaskip}{} +\stanzaskip=\medskipamount + %^^A \advance\stanzaskip by-.25\medskipamount% to preserve the stretch- and + %^^A % shrinkability.\par +\newskip\CodeTopsep +\newskip\MacroTopsep + +\def\UniformSkips{%\label{UniformSkips} + % \Define\CodeTopsep \Define\MacroTopsep + \CodeTopsep=\stanzaskip + \MacroTopsep=\stanzaskip + \abovedisplayskip=\stanzaskip + %\nostanza \leftskip0sp \gmdnoindent + % |%% \abovedisplayshortskip| + % remains untouched as it is 0.0\,pt plus 3.0\,pt by default. + % \nostanza + \belowdisplayskip=\stanzaskip + \belowdisplayshortskip=.5\stanzaskip% due to DEK's idea of making the + % short below display skip half of the normal. + \advance\belowdisplayshortskip by\smallskipamount + \advance\belowdisplayshortskip by-1\smallskipamount% We advance + % \incs{be\+low\+dis\+play\+short\+skip} forth and back to + % give it the \incs{small\+skip\+am\+ount}'s shrink- and + % stretchability components. + \topsep=\stanzaskip + \partopsep=\z@ +} +\UniformSkips +\AtBeginDocument{\UniformSkips} + +\newcommand*\NonUniformSkips{\@relaxen\UniformSkips} +\newcommand*\chunkskip{% + \par\addvspace{% + \glueexpr\MacroTopsep + \if@codeskipput-\CodeTopsep\fi + \relax +}\@codeskipputgtrue} + +\pdef\stanza{% + \par\addvspace{% + \glueexpr\stanzaskip + \if@codeskipput-\CodeTopsep\fi + \relax}\@codeskipputgtrue} + +\newcommand*\nostanza{% \changes{v0.99n}{2008/08/21}{added adding + % negative skip if in vmode and \cs{par}} + \par + \if@codeskipput\unless\if@nostanza\vskip-\CodeTopsep\relax\fi\fi + \@codeskipputgtrue\@nostanzagtrue + \@afternarrgfalse\@aftercodegtrue}% In the `code +\newgif\if@newline +\newgif\if@dsdir + + +\begingroup\catcode`\^^M=\active% +\firstofone{\endgroup% + \newcommand*{\DocInput}[1]{\begingroup% + % \changes{v0.98}{06/09/05}{\cs{@makeother\protect\bslash_} added} + % \DefIndex\gmd@inputname + \edef\gmd@inputname{#1}% we'll use it in some notifications. + % + \NamedInput@prepare{#1}% to make this input “named”, as with |\NamedInput|. + % + % \DefIndex\gmd@currentlabel@before + \let\gmd@currentlabel@before=\@currentlabel% we store it because + % we'll do |\xdef|s of |\@currentlabel| to make proper references + % to the line numbers so we want to restore current + % |\@currentlabel| after our group.\ + % \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\ + % \changes[\DocInput]{v0.95}{06/08/15}{\cs{club-} + % and \cs{widowpenalty} set both to 3333} + %\CodeUsgIndex\tolerance + \tolerance=1000 % as in \docfm. + % ^^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 line number 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 \cs{}\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\gmd@guardedinput + \edef\gmd@guardedinput{% + \@nx\@@input #1\relax% |\@nx| is + % |\noexpand|, see \pk{gmutils}.\DoNotIndex\@nx + % \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 + \@nx\CodeDelim\@xanxcs{\code@delim}% 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 initialise the counter for the number + % of the escape chars (the assignment is |\global|). + \everyeof{\relax}% |\@nx| moved not to spoil input of toc e.g. + \@xa\@xa\@xa^^M\gmd@guardedinput%\label{eeeEOL} + \par% + % \CodeUsgIndex\@endinputhook + \@endinputhook% It's a~hook to let postpone + % some stuff till the end of input. We use it e.g.\ for the + % \docfm-(not)likeliness notifications. + \glet\@currentlabel=\gmd@currentlabel@before% we restore + % value from before this group. In a~very special case this could + % cause unexpected behaviour of cross-refs, but anyway we acted + % globally and so acts \pk{hyperref}. + % + \NamedInput@finish% to clean up after a “named” input, as with |\NamedInput|. + % + \endgroup% + }% end of |\Doc@Input|'s definition. +}% end of |\firstofone|'s argument. + + +\pdef\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. + \ifhmode\@afternarrgtrue\@codeskipputgfalse\fi% being in + % the horizontal mode means we've just typeset some narration so we + % turn the respective switches: the one bringing the message `we are + % after narration' to True (|@afternarr|) and the `we have put the + % code-narration glue' to False (|@codeskipput|). Since we are in + % a~verbatim group and the information should be brought outside it, + % we switch the switches globally (the letter |g| in both). + \@newlinegtrue% to |\refstep| the lines' counter at the proper + % point. + \@dsdirgtrue% to handle the \ds\ directives. + \@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| + % ^^A~before the group? + \gmd@setclubpenalty% Most paragraphs will be + % one-line most probably. Since some sectioning commands may change + % \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. + % \CodeUsgIndex\ttverbatim + \let\verbatimfont\codett % + \ttverbatim% it applies the code-layer font (|\tt| by default) and makes specials + % other or |\active|-and-breakable. + % to turn verbatim specials off in + % \incmd\scanverb s. + \gmd@DoTeXCodeSpace% + \@makeother\|% because |\ttverbatim| doesn't do that. + \MakePrivateLetters% see line \ref{MPL}.\par + \@xa\@makeother\code@delim% we are + % almost sure the code comment char is among the chars having + % been \catother ed already. For `almost' see the + % \gmiflink[IndexInput]{\cs{IndexInput}} macro's definition.\par + % So, we've opened a~verbatim group and want to peek at the next + % character. If it's |%|, then we just continue narration, else we + % 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. + \texcode@hook% we add some special stuff, e.g.\ in \pk{gmdocc.cls} we + % make star low. + \@xa\@ifnextcharRS\@xa{\code@delim}{%\label{ifContNarr} + % \CodeUsgIndex\gmd@continuenarration + \gmd@continuenarration}{% \CodeUsgIndex\gmd@dolspaces + \gmd@dolspaces% it will launch |\gmd@typesettexcode|. + }% end of |\@ifnextcharRS|'s else. +}% end of |\gmd@textEOL|'s definition. + +\emptify\texcode@hook + +\def\gmd@setclubpenalty{\clubpenalty=3333 } + +\def\AtEndInput{\g@addto@macro\@endinputhook} +\def\@endinputhook{} +\def\AtBegInput{\g@addto@macro\@beginputhook} +\def\@beginputhook{} + +\emptify\gmd@iihook + +\AtBegInput{\let\gmd@@toc\tableofcontents + \def\tableofcontents{% \label{straighttoc} + \@ifQueerEOL + {\StraightEOL\gmd@@toc\QueerEOL}% + {\gmd@@toc}% + }% +} + + +\def\@ifEOLactive{%\ + % \begin{enumargs} + % \item what if end of line is active, + % \item what if not. + % \end{enumargs} + \ifnum\catcode`\^^M=\active \@xa\@firstoftwo\else\@xa\@secondoftwo\fi} + +\foone\obeylines{% + \def\@ifQueerEOL{%\ + % \begin{enumargs} + % \item what if line end is ‘queer’, + % \item what if not ‘queer’. + % \end{enumargs} + % \changes{v0.98a}{06/09/06}{added} + \@ifEOLactive{% + \ifx^^M\gmd@textEOL\@xa\@firstoftwo\else\@xa\@secondoftwo\fi}% + {\@secondoftwo}}% of \cs{@ifQueerEOL} +}% of \cs{foone} + +\pdef\qfootnote{% + \@ifQueerEOL + {\begingroup\StraightEOL\qfootnote@}% + {\footnote}} + +\DeclareCommand\qfootnote@{o>Lm}{% + \endgroup % yes, we close the group: the arguments are already + % parsed and passed to this macro. + \edef\gmu@tempa{% + \@nx\footnote \IfValueT{#1}{[#1]}}% + \gmu@tempa{#2}% +} + +\pdef\qemph{% + \@ifQueerEOL + {\begingroup\StraightEOL\qemph@}% + {\emph}} + +\pdef\qemph@#1{\endgroup\emph{#1}} + +\@emptify\gmd@ABIOnce +\AtEndOfPackage{\AtBegInput\gmd@ABIOnce} + +\long\def\AtBegInputOnce#1{% + \gaddtomacro\gmd@ABIOnce{\g@emptify\gmd@ABIOnce#1}} + + +\def\EOFMark{\<eof>} +\begin{obeyspaces}% +\gdef\CodeSpacesVisible{% +\def\gmd@DoTeXCodeSpace{% +\obeyspaces\let =\breakablevisspace}}% +\gdef\CodeSpacesBlank{% +\let\gmd@DoTeXCodeSpace\gmobeyspaces% +\let\gmd@texcodespace=\ }% the latter |\let| is for the |\if›…|s. +\gdef\CodeSpacesSmall{% +\def\gmd@DoTeXCodeSpace{% +\obeyspaces\def {\,\hskip\z@}}% +\def\gmd@texcodespace{\,\hskip\z@}}% +\end{obeyspaces} + +\def\CodeSpacesGrey{% + % \changes{v0.99l}{2008/08/06}{added due to Will Robertson's + % suggestion} + \CodeSpacesVisible + \VisSpacesGrey% defined in \pk{gmverb} +}% + + +\CodeSpacesVisible + +\def\gmd@continuenarration{% + \endgroup + \gmd@cpnarrline% see \gmiflink[countnarr]{below}. + \@xa\@trimandstore\the\everypar\@trimandstore + \everypar=\@xa{\@xa\@codetonarrskip\the\everypar}% + \@xa\gmd@checkifEOL\@gobble} + +\if@countalllines + + \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. + }% 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 beginning 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 page break 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 + % \cs{grefstepcounter} macro, defined in \pk{gmverb}, is + % a~global + % version of \cs{ref\-step\-count\-er}, observing the redefinition + % made + % to \incs{refstepcounter} by \pk{hyperref}. + + \if@printalllinenos% Note that checking this switch 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 |countalllines| (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.\ilrr + \gmd@skiplines} + + \edef\gmu@tempa{% + \long\def\@nx\gmd@skiplines##1\bslash endskiplines{\egroup}} + \gmu@tempa + +\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 \cs{cat\-code}. + \everypar={\@@settexcodehangi}% At first attempt we thought + % of giving the user a~|\toks| list to insert at the beginning of + % every code line, but what for? + % \Define*{^^M}^^A + \def^^M{% \TeX\ code \acro{EOL} + \@newlinegtrue% to |\refstep| the counter in proper place. + \@dsdirgtrue% to handle the \ds\ directives. + \global\gmd@closingspacewd=\z@% \label{noclosingspace}we + % don't wish to eat a~closing space after a~codeline, because + % there isn't any and a~negative rigid |\hskip| added to + % |\parfillskip| would produce a~blank line. + \ifhmode\par\@codeskipputgfalse\else% + \if@codeskipput% + \else\addvspace{\stanzaskip}\@codeskipputgtrue% + \fi% if we've just met a~blank (code) line, we insert + % a~|\stanzaskip| glue. + % \label{codeskip} + \fi% + \prevhmodegfalse% we want to know later that now we are in the + % vmode. + % ^^A\special{color push gray 0.2666}% + \@ifnextcharRS{\gmd@texcodespace}{% + \@dsdirgfalse\gmd@dolspaces}{\gmd@charbychar}% + }% end of |^^M|'s definition.\label{debug!2} + % \DefIndex\gmd@texcodeEOL + \let\gmd@texcodeEOL=^^M% for further checks inside |\gmd@charbychar|. + \raggedright\leftskip=\CodeIndent% + \if@aftercode% + \gmd@nocodeskip1{iaC}% + \else% + \if@afternarr% + % ^^A~\def^^C{\showthe\hyphenpenalty\showthe\rightskip} + \if@codeskipput\else% + \gmd@codeskip1\@aftercodegfalse% + \fi% \label{codeskip3} + \else\gmd@nocodeskip1{naN}% + \fi% + \fi% if now we are + % 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\gmd@grefstep{codelinenum}\@newlinegfalse% + \fi% + \printlinenumber% if we don't want the lines to be numbered, + % the respective option \incs{let}s this \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% + \advance\hangindent by\gmd@ldspaceswd% + \xdef\settexcodehangi{% + \@nx\hangindent=\the\hangindent% and also set the + % hanging indent setting for the same line comment case. \acro{BTW}., + % this |%| or rather lack of it costed me five hours of + % debugging and rewriting. Active line ends require extreme + % caution. + \@nx\hangafter=1\space}%^^A~\@nx\relax + \else% + \glet\settexcodehangi=\@@settexcodehangi%\\ + %|%| |\printlinenumber| here produced line numbers for blank lines + % which is what we don't want. + \fi% of |\ifdim| + \gmd@ldspaceswd=\z@% + \prevhmodegfalse% we have done |\par| so we are not in the + % hmode. + \@aftercodegtrue% we want to know later that now we are + % typesetting a~codeline. + \if@ilgroup\aftergroup\egroup\@ilgroupfalse\fi% when we are in the in-line + % comment group (for ragged right or justified), we want + % to \label{inline.egroup.2} + % close it. But if we did it + % here, we would close the verbatim group for the code. But we set + % the switch false not to repeat \inverb|\aftergroup\egroup|. + % ^^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 + % launch closing of the verbatim group. + }% of |\gmd@typesettexcode|. +}% of |\foone\obeylines|. +\newlength\gmd@spacewd% to store the width of a~(leading) +\newlength\gmd@ldspaceswd% to store total length of gobbled leading + %spaces. + +\let\gmd@texcodespace=\breakablevisspace + +\def\gmd@dolspaces{% + \ifx\gmd@texcodespace\@let@token + \@dsdirgfalse + \afterfi{\settowidth{\gmd@spacewd}{\visiblespace}% + \gmd@ldspaceswd=\z@ + \gmd@eatlspace}% + \else\afterfi{% about this smart macro and other of its family see + % \pk{gmutils} sec.\,3. + % ^^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 + % ^^A~O.K. + \if@afternarr\if@aftercode + \ifilrr\bgroup \gmd@setilrr\fi + \fi\fi + \par% possibly after narration + \if@afternarr\if@aftercode + \ifilrr\egroup\fi + \fi\fi + \gmd@typesettexcode}% + \fi} + + +\def\gmd@eatlspace#1{% + \ifx\gmd@texcodespace#1% + \advance\gmd@ldspaceswd by\gmd@spacewd% we don't + % \incs{advance} it \incs{global}ly because the current group may be closed + % iff we meet \inverb|%| and then we'll won't indent the line anyway.\ilrr + \afteriffifi\gmd@eatlspace + \else + \if\code@delim\@nx#1% + \gmd@ldspaceswd=\z@ + \afterfifi{\gmd@continuenarration\narrationmark}%\label{ContNarr2} + % \changes{v0.99n}{2008/08/30}{\cs{afterfifi} added---a~bug fix} + \else \afterfifi{\gmd@typesettexcode#1}% + \fi + \fi}% + + +\newgif\ifprevhmode + + +\def\gmd@charbychar#1{% + \ifhmode\prevhmodegtrue + \else\prevhmodegfalse + % ^^A~\special{color push gray 0.2789}% + \fi + \if\code@delim\@nx#1% + \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{% + % ^^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}% + \else + \def\next{% + \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} + +\def\gmd@EOLorcharbychar#1{% + %^^A \debug@special{2829}% + \ifx\gmd@texcodeEOL#1% + \if@newline + % ^^A\special{color push gray 0.281600}% no occurrence + % ^^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 + {%^^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 + % a~code |^^M| with no commentary. + \fi} + +\def\gmd@counttheline{% + \ifvmode + \if@newline + \leavevmode + %^^A \debug@special{2851}% + \gmd@grefstep{codelinenum}\@newlinegfalse + \hyperlabel@line + \fi + %^^A\debug@special{2853}% + \printlinenumber + % ^^A\debug@special{2855}% + \mark@envir + \else% not vmode + \if@newline + % ^^A\special{color push gray 0.2842}% didn't occur + \gmd@grefstep{codelinenum}\@newlinegfalse + \hyperlabel@line + \fi + \fi} + + +\def\gmd@percenthack{%% + \ifprevhmode\aftergroup\narrationmark% We add a~space after |%|, + % because I~think it looks better. It's done |\aftergroup| to make + % the spaces possible after the |%| not to be + % typeset. + % \changes{v0.99n}{2008/08/21}{\cs{space} replaced with a~tilde to + % forbid a~line break before an in-line comment} + \else\aftergroup\gmd@dsNarrChecker% remember that + % \cs{gmd\-@\-pre\-cent\-hack} is only called when we've the code + % delimiter and soon we'll close the verbatim group and right after + % |\endgroup| there waits |\gmd@checkifEOLmixd|. + \fi} + + +\newif\ifgmd@dsVerb + +\foone{\obeylines}% +{% + \def\gmd@dsVerbChecker% + #1% stuff for checking normal directive + #2% line contents + ^^M{%% +\typeout{verb checker l.\the\inputlineno}% + \ifnum\strcmp{\detokenize{#2}}{\gmd@dsVerbDelim}=\z@% + \global\gmd@dsVerbfalse% + \def\gmd@modulehashone{% + \ModuleVerbClose{\gmd@dsVerbDelim}% + \global\emptify\gmd@dsVerbDelim% + \@afternarrgfalse\@aftercodegtrue% + \@codeskipputgfalse % + }% + \@xa\@firstoftwo% + \else \@xa\@secondoftwo % + \fi% + {\gmd@textEOL\gmd@modulehashone^^M}% + {\begingroup% + \endlinechar=\m@ne % + \@XA{% + \endgroup#1}\scantokens{#2}^^M% note that |\scantokens| adds + % char |\endlinechar| which we assure to be |^^M| + }% + }% of |\gmd@dsVerbChecker| +}% of |\obeylines| + +\def\gmd@dsChecker#1{% + \@dsdirgfalse + \ifgmd@dsVerb + \@xa\@firstofone + \else + \@xa\@secondoftwo + \fi + {\gmd@dsVerbChecker}% + {#1}% +}% of |\gmd@dsChecker| + +\def\gmd@dsNarrChecker#1{%% + \gmd@dsChecker + {\@ifnextcharRS<{% + \@xa\gmd@docstripdirective\@gobble}{#1}}% +}% of |\gmd@dsNarrChecker| + + +\def\gmd@checkifEOL{% + \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. + \the\gmd@preverypar}% + \@ifnextcharRS{\gmd@textEOL}{% + %^^A\@ifnextMac{%^^A} + \@dsdirgfalse + \par\ignorespaces}{% + \gmd@narrcheckifds}}% + +\def\gmd@narrcheckifds{%^^A\typeout{narr if ds \on@line}% + \gmd@dsNarrChecker{\ignorespaces}} + + +\def\gmd@checkifEOLmixd{% + \gmd@cpnarrline + \everypar=\@xa{\@xa\@codetonarrskip\the\gmd@preverypar}% + % + % \label{longlinethatshouldbebroken} + \@afternarrgfalse\@aftercodegtrue + \ifhmode\@codeskipputgfalse\fi + \@ifnextcharRS{\gmd@textEOL}{% + %^^A\@ifnextMac{%^^A} + {\raggedright\gmd@endpe\par}% without \incs{raggedright} this + % \incs{par} + % would be justified which is not appropriate for a~long codeline + % that should be broken, e.g., \ref{longlinethatshouldbebroken}. + \prevhmodegfalse + \gmd@endpe\ignorespaces}{% + % If a~codeline ends with |%| + % (|prevhmode|${}=={}$True) first |\gmd@endpe| sets the parameters + % at the \TeX\ code values and |\par| closes a~paragraph and the + % latter |\gmd@endpe| sets the parameters at the narration values. + % In the other case both |\gmd@endpe|s do the same + % and |\par| between them does nothing. + % \DefIndex\par + \def\par{% the narration \cs{par}. + \ifhmode% (I~added this |\ifhmode| as a~result of a~heavy + % debug.) + \if@afternarr\if@aftercode + \unless\if@ilgroup\bgroup\@ilgrouptrue\fi + \ifilrr\gmd@setilrr\fi + \fi\fi + \@@par + \if@afternarr + \if@aftercode + \if@ilgroup\egroup\fi% \label{inline.egroup.1}if we are both after code + % and after narration it means we are after an in-line + % comment. Then we probably end a~group opened in line + % \ref{inline.bgroup} + \if@codeskipput\else\gmd@codeskip2\@aftercodegfalse\fi + %\label{codeskip4} + \else\gmd@nocodeskip2{naC}% + \fi + \else\gmd@nocodeskip2{naN}% + \fi + \prevhmodegfalse\gmd@endpe% when taken out of |\ifhmode|, this + % line caused some codeline numbers were typeset with + % |\leftskip|${}=0$. + \everypar=\@xa{% + \@xa\@codetonarrskip\the\gmd@preverypar}% + \let\par\@@par% + \fi}% of \cs{par}. + \gmd@endpe\ignorespaces}} + + +\def\gmd@endpe{% + \ifprevhmode + \settexcodehangi%\unskip ndent + \leftskip=\CodeIndent + \else + \leftskip=\TextIndent + \hangindent=\z@ + \everypar=\@xa{% + \@xa\@codetonarrskip\the\gmd@preverypar}% + \fi} + +\newif\ifilrr + +\def\ilrr{%\changes{v0.99n}{2008/08/21}{added} + \if@aftercode + \unless\if@ilgroup\bgroup\@ilgrouptrue\fi% \label{inline.bgroup} If we are + % `aftercode', then we are in an in-line comment. Then we open + % a~group to be able to declare e.g.\ \cs{raggedright} for that + % comment only. This group is closed in line \ref{inline.egroup.1} + % or \ref{inline.egroup.2}. + \ilrrtrue + \fi} + +\newif\if@ilgroup + +\def\gmd@setilrr{\rightskip0ptplus\textwidth} + +\def\ilju{% when in-line comments are ragged right in general but we + % want just this one to be justified. + \if@aftercode + \unless\if@ilgroup\bgroup\@ilgrouptrue\fi + \ilrrfalse + \fi} + +\def\verbcodecorr{%\changes{v0.99n}{2008/08/21}{added} + % a~correction of vertical spaces between a~\env{verbatim} and + % code. We put also a~\cs{par} to allow parindent in the next + % commentary. + \vskip-\lastskip\vskip-4\CodeTopsep\vskip3\CodeTopsep\par} + +\if@uresetlinecount% with |uresetlinecount| option\dots + \@relaxen\gmd@resetlinecount% \dots\ we turn + % resetting the counter by \cs{Doc\+In\+put} off\dots + \newcommand*\resetlinecountwith[1]{% + \newcounter{codelinenum}[#1]}% \dots\ and provide a~new + % declaration of the counter. +\else% With the option turned off\dots + \newcounter{DocInputsCount}% + \newcounter{codelinenum}[DocInputsCount]% \dots\ we declare the + % |\DocInput|s' number counter and the codeline counter + % to be reset with stepping of it. + % \changes[\c@DocInputsCount]{v0.98c}{06/9/8}{added for fixing + % duplication of \pk{hyperref} labels in the case of a~multiple + % \cs{DocInput}} + \newcommand*\gmd@resetlinecount{\stepcounter{DocInputsCount}}% \dots + % and let the |\DocInput| increment the |\DocInput|s number count + % and thus reset the codeline count. It's for unique naming of the + % \pk{hyperref} labels. +\fi + +\newcommand*\printlinenumber{% + \leavevmode\llap{\rlap{\LineNumFont$\phantom{999}$\llap{\thecodelinenum}}% + \hskip\leftskip}} + +\def\LineNumFont{\normalfont\tiny} + +\if@linesnotnum\@relaxen\printlinenumber\fi + +\newcommand*\hyperlabel@line{% + \if@pageindex% It's good to be able to switch it any time not just + % define it once according to the value of the switch set by the + % option. + \else + \raisebox{2ex}[1ex][\z@]{\gmhypertarget[clnum.% + \HLPrefix\arabic{codelinenum}]{}}% + \fi} + +\newcommand*\gmd@codeskip[1]{% + \@@par\addvspace\CodeTopsep + \@codeskipputgtrue\@nostanzagfalse} + +\newgif\if@codeskipput + +\newgif\if@nostanza + +\newcommand*\gmd@nocodeskip[2]{} + +\if1 1 + \renewcommand*\gmd@codeskip[1]{% + \hbox{\rule{1cm}{3pt} #1!!!}} + \renewcommand*\gmd@nocodeskip[2]{% + \hbox{\rule{1cm}{0.5pt} #1: #2 }} +\fi + +\newgif\if@aftercode +\newgif\if@afternarr + +\def\@codetonarrskip{% + \if@codeskipput\else + \if@afternarr\gmd@nocodeskip4{iaN}\else + \if@aftercode + % We are at the beginning of |\everypar|, i.e., \TeX\ has just entered + % the hmode and put the |\parindent| box. Let's remove it then. + {\setbox0=\lastbox}% + % Now we can put the vertical space and state we are not `aftercode'. + \gmd@codeskip4% + % \label{codeskip5} + \else\gmd@nocodeskip4{naC}% + \fi + \fi + \fi + \leftskip\TextIndent% this line is a~patch against + % a~bug-or-feature that in certain cases the narration |\leftskip| + % is left equal the code leftskip. (It happens when there are + % subsequent code lines after an in-line comment not ended with + % an explicit |\par|.) Before v0.99n it was just after line \ref{codeskip5}. + \@aftercodegfalse\@nostanzagtrue + % \changes{v0.99o}{2008/09/04}{a~bug fix: added \cs{@nostanzagtrue}} +} + +\long\def\@trimandstore#1\@trimandstore{% + \def\@trimandstore@hash{#1}% + \ifx\@trimandstore@hash\@empty% we check if |#1| is + % 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={}% + \else + \afterfi{\@xa\@trimandstore@ne\the\everypar\@trimandstore}% + \fi} + +\long\def\@trimandstore@ne#1#2\@trimandstore{%\label{@trimandstore} + \def\trimmed@everypar{#2}% + \ifx\@codetonarrskip#1% + \gmd@preverypar=\@xa{\trimmed@everypar}% + \else + \gmd@preverypar=\@xa{\the\everypar}% + \fi} +\catcode`\^^B=\active% note we re|\catcode| \<char2> globally, for the +\catcode`\^^V=\active % the same for |^^V|. +\catcode`\^^U=\active % and for |^^U|. +\foone{\obeylines}%% \Define*{^^B} +{\pdef\QueerCharTwo{% + \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. + % + % \Define*{^^V} + % \Define*{^^U} + % The |^^V| char is intended to mark parts of code commented out + % which are to be typeset verbatim. Lines are begun with narration + % marks (\%'s by default) and the narration-verbatim-typewriter font + % is used. + % + % The |^^U| char is intended for the lines commented out which are + % to be typeset as almost-invisible (second-class). They are marked + % with the narration mark as with |^^V| and a special font setting + % is used, which is a gray colour by default (in addition to the narration-verbatim-typewriter). + % + \pdef\gmd@UVdefs {% + \def\gmd@UV@percent{\global\let\verb@balance@group\@empty % + % ^^V \hyphenchar\font=\gmv@storedhyphenchar % it works back + % for the current paragraph so destroys our special hyphenchar. + \egroup\endgroup % + }% of |\gmd@UV@percent| + % + \@xa\def\@xa\verb@egroup@UV\@xa{% + \gmd@UV@percent ^^M% + }% of |\verb@egroup@UV|. + % + \addtomacro\gmd@UV@percent{\narrationmark}% + % + \pdef\gmd@QueerUV ##1{% + \scantokens\@xa{\code@delim % + \fooatletter{\@ifQueerEOL\@gobble}{}% + }% of |\scantokens| + % + \par% + {\codett\verbhyphen}\narrationmark % + \begingroup % + \catcode`\^^M=\active % + % + \let\verb@egroup=\verb@egroup@UV % + \verb^^M% + % + ##1% nothing in |^^V| case and a gray setting in the |^^U| case. + % + \begingroup % + \@xa\lccode\@xa`\@xa~\@xa`\code@delim% + \lowercase{\endgroup\let~\gmd@UV@percent }% + \@xa\catcode\@xa`\code@delim\active % + }% of |\gmd@QueerUV| + }% of |\gmd@UVdefs| + % + % + \pdef\QueerU {% + \unless\ifdefined\gmd@QueerU% + % + \gmd@UVdefs % + \pdef\gmd@QueerU {\gmd@QueerUV {\QueerUFont }}% + \let^^U\gmd@QueerU% + \catcode`\^^U=\active% + \fi % + }% of |\QueerU| + % + \pdef\QueerV {% + \unless\ifdefined\gmd@QueerV % + % + \gmd@UVdefs % + \pdef\gmd@QueerV {\gmd@QueerUV {}}% + \let^^V\gmd@QueerV% + \catcode`\^^V=\active% + \fi % + }% of |\QueerV| + % +}% of |\foone| + +\QueerCharTwo +\QueerV +\QueerU +\def\QueerUFont{\color{black!35}} + +\AtBegInput{\@ifEOLactive{\catcode`\^^B\active}{}\QueerCharTwo}% \label{QCh2} +\catcode`\^^A=\active% note we re|\catcode| \<char1> globally, for the +\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{\@ifEOLactive{\catcode`\^^A\active}\QueerCharOne}% see note + +\def\StraightEOL{%\label{StraightEOL} + \catcode`\^^M=5 + \catcode`\^^A=14 + \catcode`\^^B=14 + \def\^^M{\ }} + + +\foone\obeylines{% + \def\QueerEOL{%\label{QueerEOL} + \catcode`\^^M=\active% + \let^^M\gmd@textEOL% + \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}% +} + + +\def\gmd@parfixclosingspace{{% + \advance\parfillskip by-\gmd@closingspacewd + \if@aftercode\ifilrr \gmd@setilrr \fi\fi + \par}% + \if@ilgroup\aftergroup\egroup\@ilgroupfalse\fi% we are in the + % verbatim group so we + % close the in-line comment group after it if the closing is not yet set. +} +\newskip\gmd@closingspacewd +\newcommand*\gmd@setclosingspacewd{% + \global\gmd@closingspacewd=\fontdimen2\font% + plus\fontdimen3\font minus\fontdimen4\font\relax} + +\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 + +\gaddtomacro\@verbatim{\leftskip=\CodeIndent} + +\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}} +\def\AddtoPrivateOthers#1{% + \@xa\def\@xa\doprivateothers\@xa{% + \doprivateothers\do#1}}% + + +\begingroup +\obeylines% \DefIndex\gm@verb@eol +\AtBegInput{\def\gm@verb@eol{\obeylines% + \def^^M{\verb@egroup\@latex@error{% + \@nx\verb ended by end of line}% + \@ifEOLactive{^^M}{\@ehc}}}}% +\endgroup + + +\def\verbatimfont{\narrativett} +\def\codett{\tt} + +\pdef\texttt#1{{\narrativett#1}} + + +\VerbatimPitch + +\def\ResultsIn{results in:} + +\DeclareEnvironment{verbatim@p}{} +{\begingroup + \verbatim +} +{\endverbatim + \endgroup + \ResultsIn + \[\parbox{0,85\textwidth}{% + \newlinechar=\endlinechar + \StraightEOL + \scantokens\@xa{\VerbatimContents}% + }% of parbox + \]% +} + + + + + +\edef\actualchar{\string @} +\edef\quotechar{\string "} +\edef\encapchar{\xiiclub} +\edef\levelchar{\string !} +\def\CodeEscapeChar#1{% + \begingroup + \escapechar\m@ne + \xdef\code@escape@char{\string#1}% + \endgroup} +\CodeEscapeChar\\ + +\@ifundefined{MakePrivateLetters}{%\label{MPL} + \def\MakePrivateLetters{\makeatletter\catcode`\*=11 }}{} +\def\MakePrivateOthers{\let\do=\@makeother \doprivateothers} +\def\doprivateothers{\do\ \do\^} + + +\foone\obeylines{% + \def\scan@macro#1{% + \ifx#1^^M\@xa#1\else\afterfi{\scan@macro@#1}\fi% + }% of |\scan@macro|, +}% of |\foone|. + +\def\scan@macro@#1{% we are sure to scan at least one token which is + % not the line end and + % therefore we define this macro as one-parameter.\par + \step@checksum% \label{checksumUse}(see line \ref{checksum} for + % details),\par + % Then, unlike in \docfm , we do \emph{not} check if the scanning is + % allowed, because here it's always allowed and required.\par + % Of course, I~can imagine horrible perversities, but I~don't think + % they should really be taken into account. Giving the letter |a| + % |\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\@nx#1% + \quote@char#1% + \xdef\macro@iname{\gmd@maybequote#1}% global for symmetry with + % line \ref{x474}. + \xdef\macro@pname{\string#1}%\label{stringing0} we'll print entire + % name of the macro later.\par + % We |\string| it here and in the lines \ref{stringing1} and + % \ref{stringing2} to be sure it is whole \catother\ for easy + % testing for special index entry formats, see line + % \ref{pnametestDef} etc. Here we are sure the result of |\string| + % is \catother\ since its argument is \catletter. + \afterfi{\@ifnextcat{a}{\gmd@finishifstar#1}{\finish@macroscan}}% + \else% |#1| is not a~letter, so we have just scanned a~one-char + % \CS.\par + % Another reasonable |\catcode|s assumption seems to be that the + % digits are \catother. Then we don't have to + % type (|%|)|\expandafter\@gobble\string\a|. We do the |\uccode| + % trick to be sure that the char we write as the macro's name is + % \catother. + {\uccode`9=`#1% + \uppercase{\xdef\macro@iname{9}}%\label{x474} + }% + \quote@char#1% + \xdef\macro@iname{\gmd@maybequote\macro@iname}% + \xdef\macro@pname{\xiistring#1}%\label{stringing1} + \afterfi \finish@macroscan + \fi}% of |\scan@macro@|. +\def\continue@macroscan#1{% + \quote@char#1% + \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 \incs{xiistring}. + \@ifnextcat{a}{\gmd@finishifstar#1}{\finish@macroscan}% +} + +\def\gmd@finishifstar#1{% + \if*\@nx#1\afterfi\finish@macroscan% note we protect |#1| against + % expansion. In \pk{gmdoc} verbatim scopes some chars are active + % (e.g.\ \inverb|\|\,). + \else\afterfi\continue@macroscan + \fi} + + +\def\quote@char#1{{\uccode`9=`#1% at first I~took digit 1 for this + % |\uccode|ing but then |#1| meant |#|\<\#1> in |\uppercase|'s + % argument, of course. + \uppercase{% \DefIndex\gmd@maybequote + \@ifinmeaning 9\of \indexcontrols + {\glet\gmd@maybequote\quotechar}% + {\g@emptify\gmd@maybequote}% + }% + }} + + +\AtBeginDocument{\xdef\indexcontrols{% + \bslash\levelchar\encapchar\actualchar\quotechar}} + +\newif\ifgmd@glosscs% we use this switch to keep the information + +\newcommand*\finish@macroscan{%\label{506}\par + % First we check if the current \CS is not just being defined. The + % switch may be set true in line \ref{519} + \ifgmd@adef@cshook% if so, we throw it into marginpar and index as + % a~def entry\dots + \gmu@ifundefined{gmd/iexcl/\macro@pname\space}{% \dots\ if it's not excluded + % from indexing. + \@xa\Code@MarginizeMacro\@xa{\macro@pname}% + \@xa\@defentryze\@xa{\macro@pname}{1}}{}%% here we declare the kind of + % index entry and define |\last@defmark| used by \cs{changes} + \global\gmd@adef@cshookfalse% we falsify the hook that was set + % true just for this \CS. + \fi + % We have the \CS's name for indexing in |\macro@iname| and + % for print in |\macro@pname|. So we index it. We do it a~bit + % counter-crank way because we wish to use more general indexing + % macro. + \if\verbatimchar\macro@pname% \label{3039}it's important that |\verbatimchar| + % comes before the macro's name: when it was reverse, the |\tt| \CS + % turned this test true and left the |\verbatimchar| what resulted + % with `|\+tt|' typeset. Note that this test should turn true iff + % the scanned macro name shows to be the default + % |\verb|'s delimiter. In such a~case we give + % |\verb| another delimiter, namely |$|: ^^A$ + \def\im@firstpar{[$%^^A$ + ]}% + \else\def\im@firstpar{}% + \fi + \@xa \index@macro\im@firstpar\macro@iname\macro@pname + % \label{3049} + \maybe@marginpar\macro@pname + \if\xiispace\macro@pname\relax\gmd@texcodespace + \else + {\noverbatimspecials\Restore@Macro\verb + \@xa\scanverb\@xa{\macro@pname}}% we typeset scanned \CS. + \fi + % \changes[\finish@macroscan]{v0.99n}{2008/09/30}{the case of + % \cs{\vs} taken care of} + \let\next\gmd@charbychar + \gmd@detectors% \label{519} for automatic detection of + % definitions. Defined and + % explained in the next section. It redefines + % |\next| if detects a~definition command and thus + % sets the switch of line \ref{506} true. + \next + % \label{next 3690} +} + +\def\maybe@marginpar#1{% + \gmu@ifundefined{gmd/2marpar/\@xa\detokenize\@xa{#1}}{}{% + \edef\gmu@tempa{% + \unexpanded{\Text@Marginize*}% + {\bslash\@xa\unexpanded\@xa{#1}}% ^^A + }\gmu@tempa + % ^^A % |\expandafter|s + % ^^A % \possfil because the |\Text@Marginize| command applies |\string| to its + % ^^A % argument. + % \incs{macro@pname}, which will be the only possible + % argument to + % \incs{may\+be\+@mar\+g\+in\+par}, + % contains the macro's name + % without the escape char so we added it here. + \@xa\g@relaxen + \csname gmd/2marpar/\@xa\detokenize\@xa{#1}\endcsname% we reset the switch. + }} + +\outer\def\DeclareDefining{\begingroup + \MakePrivateLetters + \gmu@ifstar + {\gdef\gmd@adef@defaulttype{text}\Declare@Dfng}% + {\gdef\gmd@adef@defaulttype{cs}\Declare@Dfng}% +} + +\newcommand*\Declare@Dfng[2][]{% + \endgroup + \Declare@Dfng@inner{#1}{#2}% + \ifgmd@adef@star% this switch may be set false in first + % \incs{Declare@Dfng@inner} (it's the |star| key). + \Declare@Dfng@inner{#1}{#2*}% The catcode of |*| doesn't matter since + % it's in + % \incs{csname\+…\+\bslash end\+cs\+na\+me} + % everywhere. + \fi} + +\def\Declare@Dfng@inner#1#2{% + \edef\gmd@resa{% + \@nx\setkeys[gmd]{adef}{type=\gmd@adef@defaulttype}}% + \gmd@resa + {\escapechar\m@ne + \xdef\gmd@adef@currdef{\string#2}% + % ^^A~\typeout{@@@ gmd@adef@currdef:::\gmd@adef@currdef::::}% + }% + \gmd@adef@setkeysdefault + \setkeys[gmd]{adef}{#1}% + \@xa\@ifinmeaning + \csname gmd@detect@\gmd@adef@currdef\endcsname + % \label{550} + \of\gmd@detectors{}{% + \@xa\gaddtomacro\@xa\gmd@detectors\@xa{% + \csname gmd@detect@\gmd@adef@currdef\endcsname}}% we add a~\CS\\ + % |%| |\gmd@detect@|\<def name> (a~\textbf{detector}) to the + % meaning of the \textbf{detectors' carrier}. And we define it to + % detect the \inverb|#2| command. + \@xa\xdef\csname gmd@detectname@\gmd@adef@currdef\endcsname{% + \gmd@adef@currdef}% + \edef\gmu@tempa{% this |\edef| is to expand |\gmd@adef@TYPE|. + \global\@nx\@namedef{gmd@detect@\gmd@adef@currdef}{% + \@nx\ifx + \@xanxcs{gmd@detectname@\gmd@adef@currdef}% + \@nx\macro@pname + \@nx\n@melet{next}{gmd@adef@\gmd@adef@TYPE}% + \@nx\n@melet{gmd@adef@currdef}{gmd@detectname@\gmd@adef@currdef}% + \@nx\fi}}% + \gmu@tempa + \SMglobal\Store@MacroSt {gmd@detect@\gmd@adef@currdef}% we store the \CS to + % allow its temporary discarding later. +} + +\def\gmd@adef@setkeysdefault{% + \setkeys[gmd]{adef}{star,prefix,KVpref}} + +\define@boolkey[gmd]{adef}{star}[true]{} + +\define@key[gmd]{adef}{prefix}[]{% + \edef\gmd@resa{% + \def\@xanxcs{gmd@adef@prefix@\gmd@adef@currdef }{% + #1}}% + \gmd@resa} + +\def\gmd@KVprefdefault{KV}% in a~separate macro because we'll need + % it in \cs{ifx}. + +\define@key[gmd]{adef}{KVpref}[\gmd@KVprefdefault]{% + \edef\gmd@resa{#1}% + \ifx\gmd@resa\gmd@KVprefdefault + \else + \@namedef{gmd@adef@KVprefixset@\gmd@adef@currdef}{1}% + \gmd@adef@setKV% whenever the |KVpref|fix is set (not default), the + % declared command is assumed to be \pk{keyval}ish. + \fi + \edef\gmd@resa{#1}% because |\gmd@adef@setKV| redefined it. + \edef\gmd@resa{% + \def\@xanxcs{gmd@adef@KVpref@\gmd@adef@currdef}{% + \ifx\gmd@resa\empty + \else#1@\fi}}% as in \pk{xkeyval}, if the \acro{KV} prefix is not + % empty, we add \inverb|@| to it. + \gmd@resa} + +\define@key[gmd]{adef}{KVfam}[]{% + \edef\gmd@resa{#1}% + \@namedef{gmd@adef@KVfamset@\gmd@adef@currdef}{1}% + \edef\gmd@resa{% + \def\@xanxcs{gmd@adef@KVfam@\gmd@adef@currdef}{% + \ifx\gmd@resa\empty + \else#1@\fi}}% + \gmd@resa + \gmd@adef@setKV}% whenever the |KVfam|ily is set, the declared command is + % assumed to be \pk{keyval}ish. + +\define@choicekey[gmd]{adef}{type} + [\gmd@adef@typevals\gmd@adef@typenr] + {% the list of possible types of defining commands + def, + newcommand, + cs,% equivalent to the two above, covers all the cases of defining + % a~\CS, including the \PlainTeX\ \inverb|\new›…| and + % \LaTeX\ |\newlength|. + newenvironment, + text,% equivalent to the one above, covers all the commands defining + % its first mandatory argument that should be text, + % \inverb|\DeclareOption| e.g. + define@key,% special case of more arguments important; covers the + % \pk{xkeyval} defining commands. + dk,% a~shorthand for the one above. + DeclareOptionX,% another case of special arguments configuration, + % covers the \pk{xkeyval} homonym. + dox,% a~shorthand for the one above. + kvo% one of option defining commands of the \pk{kvoptions} package + % by Heiko Oberdiek (a~package available o~\acro{CTAN} in the + % \pk{oberdiek} bundle). + } + {% In fact we collapse all the types just to four so far: + \ifcase\gmd@adef@typenr% if |def| + \gmd@adef@settype{cs}{0}% + \or% when |newcommand| + \gmd@adef@settype{cs}{0}% + \or% when |cs| + \gmd@adef@settype{cs}{0}% + \or% when |newenvironment| + \gmd@adef@settype{text}{0}% + \or% when |text| + \gmd@adef@settype{text}{0}% + \or% when |define@key| + \gmd@adef@settype{dk}{1}% + \or% when |dk| + \gmd@adef@settype{dk}{1}% + \or% when |DeclareOptionX| + \gmd@adef@settype{dox}{1}% + \or% when |dox| + \gmd@adef@settype{dox}{1}% + \or% when |kvo| + \gmd@adef@settype{text}{1}%% The \pk{kvoptions} option + %% definitions take first mandatory + % argument as the option name and they define a~\pk{keyval} key + % whose macro's name begins with the prefix/family, either default or + % explicitly declared. The \pk{kvoptions} prefix/family is + % supported in \pk{gmdoc} with \inverb|[KVpref=, KVfam=|\<family>|]|. + \fi} + +\def\gmd@adef@settype#1#2{% + \def\gmd@adef@TYPE{#1}% + \ifnum1=#2 % now we define (or not) a~quasi-switch that fires for + % the \pk{keyval}ish definition commands. + \gmd@adef@setKV + \fi} + +\def\gmd@adef@setKV{% + \edef\gmd@resa{% + \def\@xanxcs{gmd@adef@KV@\gmd@adef@currdef}{1}% + }% + \gmd@resa} + +\emptify\gmd@detectors + +\newif\ifgmd@adef@cshook + +\def\gmd@adef@cs{\global\gmd@adef@cshooktrue\gmd@charbychar} + + +\def\gmd@adef@text{\gdef\gmd@lbracecase{1}\gmd@charbychar} + +\foone{% + \catcode`\[\active + % ^^A>\] + \catcode`\<\active} +{%\par + % The detector of \pk{xkeyval} |\define@›«[…]»key|: + \def\gmd@adef@dk{% + \let[\gmd@adef@scanKVpref + \catcode`\[\active + % ^^A\]] + \gdef\gmd@lbracecase{2}% + \gmd@adef@dfKVpref\gmd@KVprefdefault% We set the default value of + % the \pk{xkeyval} prefix. Each time again because an assignment + % in \inverb|\gmd@adef@dfKVpref| is global.\ilrr + \gmd@adef@checklbracket} + + % The detector of \pk{xkeyval} |\DeclareOptionX|: + \def\gmd@adef@dox{% + \let[\gmd@adef@scanKVpref + \let<\gmd@adef@scanDOXfam + \catcode`[\active + % ^^A]] + \catcode`<\active + \gdef\gmd@lbracecase{1}% + \gmd@adef@dfKVpref\gmd@KVprefdefault% We set the default values of + % the \pk{xkeyval} prefix\dots + \edef\gmd@adef@fam{\gmd@inputname}% \dots\ and family. + \gmd@adef@dofam + % \label{defDOXfam} + \gmd@adef@checkDOXopts}% +} + +\def\gmd@adef@checklbracket{% + \@ifnextchar[%^^A] + \gmd@adef@scanKVpref\gmd@charbychar}% note that + +\def\gmd@adef@checkDOXopts{% + \@ifnextchar[\gmd@adef@scanKVpref%^^A] + {\@ifnextchar<\gmd@adef@scanDOXfam\gmd@charbychar}} + +\def\gmd@adef@scanKVpref#1#2]{% + \gmd@adef@dfKVpref{#2}% + [#2]\gmd@charbychar} + +\def\gmd@adef@dfKVpref#1{% + \ifnum1=0\csname gmd@adef@KVprefixset@\gmd@adef@currdef\endcsname + \relax + \else + \edef\gmu@resa{% + \gdef\@xa\@nx + \csname gmd@adef@KVpref@\gmd@adef@currdef\endcsname{% + \ifx\relax#1\relax + \else#1@% + \fi}}% + \gmu@resa + \fi} + +\def\gmd@adef@scanDOXfam{% + \ifnum12=\catcode`\>\relax + \let\next\gmd@adef@scanfamoth + \else + \ifnum13=\catcode`\>\relax + \let\next\gmd@adef@scanfamact + \else + \PackageError{gmdoc}{> neither `other' nor `active'! Make it + `other' with \bslash AddtoPrivateOthers\bslash\>.}{}% + \fi + \fi + \next} + +\def\gmd@adef@scanfamoth#1>{% + \edef\gmd@adef@fam{\@gobble#1}% there is always + % \cs{gmd@charbychar} first. + \gmd@adef@dofam + <\gmd@adef@fam>% + \gmd@charbychar} + +\foone{\catcode`\>\active} + {\def\gmd@adef@scanfamact#1>{% + \edef\gmd@adef@fam{\@gobble#1}% there is always + % \cs{gmd@charbychar} first. + \gmd@adef@dofam + <\gmd@adef@fam>% + \gmd@charbychar}% + } + +\def\gm@lbracehook{% + \ifcase\gmd@lbracecase\relax + \or% when 1 + \afterfi{% + \gdef\gmd@lbracecase{0}% + \gmd@adef@scanname}% + \or% when 2---the first mandatory argument of two (|\define@›«[…]»key|) + \afterfi{% + \gdef\gmd@lbracecase{3}% + \gmd@adef@scanDKfam}% + \or% when 3---the second mandatory argument of two (the key name). + \afterfi{% + \gdef\gmd@lbracecase{0}% + \gmd@adef@scanname}% + \fi} + +\def\gmd@lbracecase{0}% we initialise the hook caser. + + +\foone{\catcode`\[1 \catcode`\]2 \catcode`\}12 } + [% Note that till line \ref{738} the square brackets are grouping + % and the right brace is `other'. ^^A{ + \def\gmd@adef@scanDKfam#1}[%^^A{ + \edef\gmd@adef@fam[\@gobble#1]% there is always + % \cs{gmd@charbychar} first. + \gmd@adef@dofam + \gmd@adef@fam}% + \gmd@charbychar] + + % ^^A{ + \def\gmd@adef@scanname#1}[%^^A{ + \@makeother\[%^^A\] + \@makeother\<% + % The scanned name begins with |\gmd@charbychar|, we have to be + % careful. + \gmd@adef@deftext[#1]% + \@gobble#1}% + \gmd@charbychar] + ] + +\def\gmd@adef@dofam{% + \ifnum1=0\csname gmd@adef@KVfamset@\gmd@adef@currdef\endcsname + \relax% a~family declared with |\DeclareDefining| overrides the + % one currently scanned. + \else + \edef\gmu@resa{% + \gdef\@xa\@nx + \csname gmd@adef@KVfam@\gmd@adef@currdef\endcsname + {\ifx\gmd@adef@fam\empty + \else\gmd@adef@fam @% + \fi}}% + \gmu@resa + \fi} + +\def\gmd@adef@deftext#1{% + \@xa\def\@xa\macro@pname\@xa{\@gobble#1}%% we gobble |\gmd@charbychar|, cf. above. + \edef\macro@pname{\@xa\detokenize\@xa{\macro@pname} }% note the + % space at the end. + \edef\macro@pname{\@xa\@xiispaces\macro@pname\@nil}% + \@xa\Text@Marginize\@xa{\macro@pname}% + \gmd@adef@indextext + \edef\gmd@adef@altindex{% + \csname gmd@adef@prefix@\gmd@adef@currdef \endcsname}% + %\hskip-\parindent and we add the \pk{xkeyval} header if we are in \pk{xkeyval} + % definition. + \ifnum1=0\csname gmd@adef@KV@\gmd@adef@currdef \endcsname\relax% The\\ \CS + % \inverb|\gmd@adef@KV@|\<def. command> is defined |{1}| (so \cs{ifnum} + % gets |1=01\relax|---\hskip0sptrue) iff \<def. command> is a~\pk{keyval} + % definition. In that case we check for the \inverb|KVpref|ix and + % \inverb|KVfam|ily. (Otherwise |\gmd@adef@KV@|\<def. command> is undefined + % so \cs{ifnum} gets |1=0\relax|---false.)\ilrr + \edef\gmd@adef@altindex{% + \gmd@adef@altindex + \csname gmd@adef@KVpref@\gmd@adef@currdef \endcsname}% + \edef\gmd@adef@altindex{% + \gmd@adef@altindex + \csname gmd@adef@KVfam@\gmd@adef@currdef \endcsname}% + \fi + \ifx\gmd@adef@altindex\empty + \else% we make another index entry of the definiendum with prefix/KVheader. + \edef\macro@pname{\gmd@adef@altindex\macro@pname}% + \gmd@adef@indextext + \fi} + +\def\gmd@adef@indextext{% + \@xa\@defentryze\@xa{\macro@pname}{0}% declare the definiendum has to + % have a~definition entry and should appear + % without backslash in the changes history. + \gmd@doindexingtext% redefine |\do| to an indexing macro. + \@xa\do\@xa{\macro@pname}} + + + + +\DeclareDefining[star=false]\def +\DeclareDefining[star=false]\pdef% it's a~\pk{gmutils}' shorthand for \inverb|\protected\def|. +\DeclareDefining[star=false]\provide% a~\pk{gmutils}' conditional \incs{def}. +\DeclareDefining[star=false]\pprovide% a~\pk{gmutils}' conditional \incs{pdef}. + + +\def\UnDef{{% \changes{v0.99n}{2008/08/30}{a~bug fixed: + % \cs{gmd@charbychar} appended to \cs{next}---without it + % a~subsequent in-line comment was typeset verbatim} + % \UnDef + \gmd@adef@selfrestore\def + }} + +\def\UnPdef{{\gmd@adef@selfrestore\pdef}} + +\Store@Macro\UnDef% because the `hiding' commands relax it. + +\def\HideDef{% \changes{v0.99n}{2008/08/30}{added the starred version + % that calls \cs{UnDef}} + \gmu@ifstar\UnDef{\HideDefining\def\relaxen\UnDef}} + +\def\ResumeDef{% + \ResumeDefining\def + \Restore@Macro\UnDef} + +\DeclareDefining[star=false]\newcount +\DeclareDefining[star=false]\newdimen +\DeclareDefining[star=false]\newskip +\DeclareDefining[star=false]\newif +\DeclareDefining[star=false]\newtoks +\DeclareDefining[star=false]\newbox +\DeclareDefining[star=false]\newread +\DeclareDefining[star=false]\newwrite +\DeclareDefining[star=false]\newlength +\DeclareDefining[star=false]\DeclareDocumentCommand +\DeclareDefining[star=false]\DeclareCommand + +\DeclareDefining\newcommand +\DeclareDefining\renewcommand +\DeclareDefining\providecommand +\DeclareDefining\DeclareRobustCommand +\DeclareDefining\DeclareTextCommand +\DeclareDefining\DeclareTextCommandDefault + +\DeclareDefining*\newenvironment +\DeclareDefining*\renewenvironment +\DeclareDefining*[star=false]\DeclareOption + + +\DeclareDefining*[prefix=\bslash c@]\newcounter% \label{newcounter} + +\DeclareDefining[type=dk, prefix=\bslash]\define@key +\DeclareDefining[type=dk, prefix=\bslash if]\define@boolkey% the + % alternate index entry will be + % \cs{if}\<KVpref>|@|\<KVfam>|@|\<key name> +\DeclareDefining[type=dk, prefix=\bslash]\define@choicekey + +\DeclareDefining[type=dox, prefix=\bslash]\DeclareOptionX% the +\newcommand*\DeclareDOXHead[2][\gmd@KVprefdefault]{% + \csname DeclareDefining\endcsname + [type=dox, prefix=\bslash, KVpref=#1, KVfam=#2]% \HideDefining\DeclareOptionX + \DeclareOptionX +} + +\iffalse +\DeclareOptionX[Berg]<Lulu>{EvelynLear}{} +\DeclareOptionX<AntonW>{ChneOelze} +\fi +\DeclareDefining[type=kvo, prefix=\bslash, KVpref=]\DeclareStringOption +\DeclareDefining[type=kvo, prefix=\bslash, KVpref=]\DeclareBoolOption +\DeclareDefining[type=kvo, prefix=\bslash, KVpref=]\DeclareComplementaryOption +\DeclareDefining[type=kvo, prefix=\bslash, KVpref=]\DeclareVoidOption + +\def\DeclareKVOFam#1{% + \def\do##1{% + \csname DeclareDefining\endcsname + [type=kvo, prefix=\bslash, KVpref=, KVfam=#1]##1}% + \do\DeclareStringOption + \do\DeclareBoolOption + \do\DeclareComplementaryOption + \do\DeclareVoidOption +} + + +\def\HideAllDefining{% + \ifnum0=0\csname gmd@adef@allstored\endcsname + \SMglobal\Store@Macro\gmd@detectors + \global\@namedef{gmd@adef@allstored}{1}% + \fi + \global\emptify\gmd@detectors}% we make the carrier |\empty| not |\relax| to + % be able to declare new defining command in + % the scope of |\HideAll›…| + +\def\ResumeAllDefining{% + \ifnum1=0\csname gmd@adef@allstored\endcsname\relax + \SMglobal\Restore@Macro\gmd@detectors + \SMglobal\Restore@Macro\UnDef + \global\@namedef{gmd@adef@allstored}{0}% + \fi} + +\def\HideDefining{\begingroup + % \changes{v0.99n}{2008/08/30}{Added the starred version that hides + % the defining command only once} + \MakePrivateLetters + \gmu@ifstar\Hide@DfngOnce\Hide@Dfng} + +\def\Hide@Dfng#1{%%\UnDef + \escapechar\m@ne + \gn@melet{gmd@detect@\string#1}{relax}% + \gn@melet{gmd@detect@\string#1*}{relax}% + \ifx\def#1\global\relaxen\UnDef\fi + \endgroup} + +\def\Hide@DfngOnce#1{%%\UnDef + \gmd@adef@selfrestore#1% + \endgroup} + +\def\gmd@adef@selfrestore#1{% + \@ifundefined{gmd@detect@\strip@bslash{#1}}{% + \SMglobal\@xa\Store@Macro + \csname gmd@detect@\strip@bslash{#1}\endcsname}{}% + % ^^A\typeout{:::::::::::::::gmd@detect@\string#1:::::::::::::}% + \global\@nameedef{gmd@detect@\strip@bslash{#1}}{% + \@nx\gmu@if x% + {\@xanxcs{gmd@detectname@\strip@bslash{#1}}% + \@nx\macro@pname}% we compare the detect(ed) name with + % |\macro@pname|. + % + {\def\@nx\next{% this \incs{next} will be executed in line + % % \ref{next 3690}. + \SMglobal\Restore@Macro % they both are \incs{protected}. + \@xanxcs{gmd@detect@\string#1}% + \@nx\gmd@charbychar}%^^A we define + % ^^A \inverb|\next| not restore the macro here just in case of + % ^^A multiple declaration of |\def| (in that case there would + % ^^A~be + % ^^A multiple occurrences of the macro to be restored in the + % ^^A~carrier + % ^^A \inverb|\gmd@detectors| and we wish + % ^^A all of them not to fire this one time) That's probably too + % ^^A much care since there's the test in line \ref{550}. + \@nx}% + {}% or do nothing if the \CS' names are unequal. + }% of \cs{@nameedef}. +}% of \cs{gmd@adef@selfrestore}. + +\def\ResumeDefining{\begingroup + \MakePrivateLetters + \gmd@ResumeDfng} + +\def\gmd@ResumeDfng#1{% + \escapechar\m@ne + \SMglobal\Restore@MacroSt{gmd@detect@\string#1}% + \SMglobal\Restore@MacroSt{gmd@detect@\string#1*}% + \endgroup} + +\newcommand*\index@macro[3][\verbatimchar]{{% + \gmu@ifundefined{gmd/iexcl/\@xa\detokenize\@xa{#3 }}%\label{iexcltest} + {% |#3| is not excluded from index + % ^^A\typeout{@@@ :::\@xa\string\csname gmd/iexcl/\@xa\detokenize\@xa{#3 }\endcsname::::}% + \gmu@ifundefined{gmd/defentry/\@xa\detokenize\@xa{#3 }}% \label{pnametestDef} + {% |#3| is not def entry + \gmu@ifundefined{gmd/usgentry/\@xa\detokenize\@xa{#3 }}%\label{pnametestUsg} + {% |#3| is not usg.\ entry + \edef\kind@fentry{\CommonEntryCmd}}%\label{CECmd} + {% |#3| is usg.\ entry + \def\kind@fentry{UsgEntry}% + \un@usgentryze{#3}}%\label{usgentryrs} + }% + {% |#3| is def entry + \def\kind@fentry{DefEntry}% + \un@defentryze{#3}%\label{defentryrs} + }% of |gmd/defentry/| test's `else' + \if@pageindex\@pageinclindexfalse\fi% should it be here or + % there? Definitely here because we'll wish to switch the switch + % with a~declaration. + \if@pageinclindex + \edef\gmu@tempa{gmdindexpagecs{\HLPrefix}{\kind@fentry}{\EntryPrefix}}% + \else + \edef\gmu@tempa{gmdindexrefcs{\HLPrefix}{\kind@fentry}{\EntryPrefix}}% + \fi + \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~\CS). + \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 encap-char in order not to add its own + % encapsulation of \verb+|hyperpage+ when the (default) + % |hyperindex=true|\TextCommonIndex*{hyperindex} option is in + % force. (After this setting the |\edef|s in the above may be + % changed to |\def|s.) + % \changes[\index@macro]{v0.98f}{06/9/30}{explicit MakeIndex + % controls changed to corresponding macros. Therefore + % \cs[]{hyperindex} option of \pk{hyperref} didn't see the + % encapsulation and added its own. So I~expanded the + % argument of the very indexing macro} + }{}% closing of |gmd/iexcl/| test. + }} + +\def\un@defentryze#1{% + \ifcsname gmd/defentry/\@xa\detokenize\@xa{#1 }\endcsname + \@xa\g@relaxen\csname gmd/defentry/\@xa\detokenize\@xa{#1 }\endcsname + \fi + \ifx\gmd@detectors\empty + \g@relaxen\last@defmark + \fi}% the last macro (assuming \cs{fi} is not a~macro :-) + % is only used by \cs{changes}. If we are in the scope of automatic + % detection of definitions, we want to be able not to use \inverb|\Define| + % but write |\changes| after a~definition and get proper entry. Note + % that in case of automatic detection of definitions + % |\last@defmark|'s value keeps until the next definition. + +\def\un@usgentryze#1{% + \ifcsname gmd/usgentry/\@xa\detokenize\@xa{#1 }\endcsname + \@xa\g@relaxen\csname gmd/usgentry/\@xa\detokenize\@xa{#1 }\endcsname + \fi} + +\@emptify\EntryPrefix% this macro seems to be obsolete now + +\newif\if@pageinclindex + +\newcommand*\quoted@eschar{\quotechar\bslash}% we'll redefine it when + +\def\IndexPrefix{} + +\if@linesnotnum\@pageindextrue\fi +\AtBeginDocument{% + \if@pageindex + \def\gmdindexrefcs#1#2#3#4{\csname#2\endcsname{\hyperpage{#4}}}%^^A + % in the page case we gobble the third argument that is supposed + % to be the entry prefix.\ilrr + \let\gmdindexpagecs=\gmdindexrefcs + \else + \def \gmdindexrefcs#1#2#3#4{\gmiflink[clnum.#4]{% + \csname#2\endcsname{#4}}}% + \def \gmdindexpagecs#1#2#3#4{\hyperlink{page.#4}{% + \csname#2\endcsname{\gmd@revprefix{#3}#4}}}% + % \stanza \DefIndex\gmd@revprefix + \def\gmd@revprefix#1{% + \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, + % \pk{hyperref} saw duplicates of the hyper destinations, which + % was perfectly understandable (|codelinenum.123| made by + % |\refstepcounter| and |codelinenum.123| made by + % |\gmhypertarget|). But since v0.98 it is not a~problem anymore + % because during the automatic \inverb|\hypertarget|ing the + % lines are labelled |clnum.|\<number>. When |\HLPrefix| was + % defined as dot, MakeIndex rejected the entries as `illegal page + % number'. \changes[\HLPrefix]{v0.98a}{06/09/05}{again + % \cs{@empty}fied since \cs{hypertarget}ing the codelines names + % them \cs[]{clnum} (since v0.98).} + \fi} + +\def\DefEntry#1{\underline{#1}} +\def\UsgEntry#1{\textit{#1}} +\def\CommonEntryCmd{relax} + + + +\outer\def\DefIndex{\begingroup + \MakePrivateLetters + \gmu@ifstar + {\@sanitize\MakePrivateOthers%^^A\verbatim@specials + \Code@DefIndexStar}% + {\Code@DefIndex}} + +\long\def\Code@DefIndex#1{\endgroup{% + \escapechar\m@ne% because we will compare the macro's name with + % a~string without the backslash. + \@defentryze{#1}{1}}} + +\long\def\Code@DefIndexStar#1{% + \endgroup{% + \addto@estoindex{#1}% + \@defentryze{#1}{0}}% +} + +\def\gmd@justadot{.} + +\long\def\@defentryze#1#2{% + \@xa\glet\csname gmd/defentry/\detokenize{#1 }\endcsname\gmd@justadot% The\\ + % \LaTeX\ \inverb|\@namedef| macro could not be used since it's not + % `long'. The space to sound with the checker. \ilrr + % \Define\last@defmark + \ifcat\relax\@xa\@nx\@firstofmany#1\@nil + % \nostanza if we meet a~\CS, then maybe it's a~\CS to be + % ‘defentryzed’ or maybe it's a~‘verbatim special’ \CS. The only way + % to distinguish those cases is to assume there shouldn't be + % a~verbatim containing only a~‘verbatim special’ \CS. + \@xa\def\@xa\gmu@tempa\@xa{\@allbutfirstof#1\@nil}% + \ifx\gmu@tempa\@empty + \afterfifi\@firstoftwo% if |#1| is a~single \CS, we + % \incmd\xiistring\ it. Otherwise we \incmd\detokenize\ it. + \else\afterfifi\@secondoftwo + \fi + \else\@xa\@secondoftwo + \fi + {\xdef\last@defmark{\xiistring#1}}% we |\string| the argument just in case it's + % a~control sequence. But when it can be a~\CS, we |\@defentryze| in + % a~scope of |\escapechar=-1|, so there will never be a~backslash at + % the beginning of |\last@defmark|'s meaning (unless we + % |\@defentryze| |\\|). + {\xdef\last@defmark{\detokenize{#1}}}% + \@xa\gdef\csname gmd/isaCS/\last@defmark\endcsname{#2}% |#2| is +}% of |\@defentryze|. + +\long\def\@usgentryze#1{% + \@xa\let\csname gmd/usgentry/\detokenize{#1}\endcsname\gmd@justadot} + +\@emptify\envirs@toindex + +\outer\def\CodeUsgIndex{\begingroup + \MakePrivateLetters + \gmu@ifstar + {\@sanitize\MakePrivateOthers%^^A\verbatim@specials + \Code@UsgIndexStar}% + {\Code@UsgIndex}} +\long\def\Code@UsgIndex#1{% + \endgroup{% + \escapechar\m@ne + \global\@usgentryze{#1}}} + +\long\def\Code@UsgIndexStar#1{% + \endgroup + {%^^A\verbatim@specials + \addto@estoindex{#1}% + \@usgentryze{#1}}% +} + +\outer\def\CodeCommonIndex{\begingroup + \MakePrivateLetters + \gmu@ifstar + {\MakePrivateOthers\@sanitize\Code@CommonIndexStar}% + {\Code@CommonIndex}} + +\long\def\Code@CommonIndex#1{\endgroup} + +\long\def\Code@CommonIndexStar#1{% + \endgroup\addto@estoindex{#1}} + +\long\def\text@indexmacro#1{% + {\escapechar\m@ne \xdef\macro@pname{\xiistring#1}}% + % ^^A \typeout{@@@@ 4803}% + \@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|. + \if\verbatimchar\macro@pname + \def\im@firstpar{[$]}%^^A$ + \else\def\im@firstpar{}% + \fi + {\do@properindex% see line \ref{do@properindex}. + \@xa \index@macro\im@firstpar\macro@iname\macro@pname}} + +\def\quote@mname{% + \def\macro@iname{}% + \quote@charbychar} + +\def\quote@charbychar#1{% + \ifx\relax#1% finish quoting when you meet |\relax| or: + \else + \ifnum0\ifcat\@nx#1\@nx~1\fi\ifcat\@nx#1\relax1\fi>0 % we can meet + % active char and/or control sequences (made by) verbatim + % specials, therefore we check whether \inhash1 is an active char + % and if it is a~\CS. + \afterfifi{% we can meet an active char or a~\CS iff we use + % verbatim specials. + \ifdefined\verbatim@specials@list + \afterfi{% + \begingroup + \escapechar\@xa\@xa\@xa`\@xa\@firstofmany\verbatim@specials@list\@nil + \@xa\endgroup + \@xa\quote@charbychar\detokenize{#1}%% for a~\CS\ + % \incs{detokenize} adds a~space but if so, it will be ignored + % by the argument scanner. + }% of |\afterfi|. + \else\PackageError{gmdoc}{Please report a\space bug in + \bslash quote@charbychar in line 4934}{}% + \fi% of |\ifdefined\verbatim@specials@list|. + }% of |\afterfifi|. + \else + \quote@char#1% + \xdef\macro@iname{\macro@iname \gmd@maybequote#1}% + \afterfifi\quote@charbychar + \fi + \fi} + +\def\TextUsgIndex{\begingroup + \MakePrivateLetters + \gmu@ifstar{\MakePrivateOthers\Text@UsgIndexStar}{\Text@UsgIndex}} + +\long\def\Text@UsgIndex#1{% + \endgroup\@usgentryze#1% + \text@indexmacro#1} + +\long\def\Text@UsgIndexStar#1{\endgroup\@usgentryze{#1}% + \text@indexenvir{#1}} + +\long\def\text@indexenvir#1{% + {\verbatim@specials + \edef\macro@pname{\xiistring#1}% + \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\gmu@tempa{\@xa\@gobble\macro@pname}% + \@tempswatrue + \else + \let\gmu@tempa\macro@pname + \@tempswafalse + \fi + % ^^A \typeout{@@@@@ 4858}% + \@xa\quote@mname\gmu@tempa\relax% \label{quote@mname comm}we + % process |\string|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|. + \if@tempswa + \def\quoted@eschar{\quotechar\bslash}% + \else\@emptify\quoted@eschar\fi% we won't print any backslash before + % an environment's name, but we will before a~\CS's name. + \do@properindex% see line \ref{do@properindex}. + \index@macro\macro@iname\macro@pname}} + +\def\TextCommonIndex{\begingroup + \MakePrivateLetters + \gmu@ifstar{\MakePrivateOthers\Text@CommonIndexStar}{\Text@CommonIndex}} + +\long\def\Text@CommonIndex#1{\endgroup + \text@indexmacro#1} + +\long\def\Text@CommonIndexStar#1{\endgroup + \text@indexenvir{#1}} + + +\outer\def\CodeMarginize{\begingroup + \MakePrivateLetters + \gmu@ifstar + {\MakePrivateOthers\egCode@MarginizeEnvir} + {\egCode@MarginizeMacro}} + +\long\def\egCode@MarginizeMacro#1{\endgroup + \Code@MarginizeMacro#1} + +\long\def\Code@MarginizeMacro#1{{% |#1| is always a~\CS. + % ^^A \typeout{@@@@ :::\xiistring#1:::}% + % ^^A \show\detokenize + \escapechar\m@ne + \@xa\glet\csname gmd/2marpar/\xiistring#1\endcsname\gmd@justadot + }} + +\long\def\egCode@MarginizeEnvir#1{\endgroup + \Code@MarginizeEnvir{#1}} + +\long\def\Code@MarginizeEnvir#1{\addto@estomarginpar{#1}} + +\def\mark@envir{%\label{mark@envir} + \ifx\envirs@tomarginpar\@empty + \else + \def\do{\Text@Marginize*}% + \envirs@tomarginpar% + \g@emptify\envirs@tomarginpar% + \fi + \ifx\envirs@toindex\@empty + \else + {\verbatim@specials + \gmd@doindexingtext + \envirs@toindex + \g@emptify\envirs@toindex}% + \fi} + +\def\gmd@doindexingtext{% + \def\do##1{% the |\envirs@toindex| list contains |\string|ed + % macros or environments' names in braces and each preceded + % with |\do|. We extract the definition because we use it also in + % line \ref{gmd@doindexingtext 2nd use}. + \if\bslash\@firstofmany##1\@nil% if + % |##1| begins with a~backslash, we will gobble it for + % MakeIndex not see it. + \edef\gmd@resa{\@gobble##1}% + \@tempswatrue + \else + \edef\gmd@resa{##1}\@tempswafalse + \fi + \@xa\quote@mname\gmd@resa\relax% see line + % \ref{quote@mname comm} \& subs. for commentary. + {\if@tempswa + \def\quoted@eschar{\quotechar\bslash}% + \else\@emptify\quoted@eschar + \fi + \index@macro\macro@iname{##1}}}% +} + +\@emptify\envirs@tomarginpar +\@emptify\envirs@toindex + +\outer\def\Define{% note that since it's |\outer|, it doesn't have to + % be \incmd\protected. + \begingroup + \MakePrivateLetters + \gmu@ifstar{\@sanitize%^^A\verbatim@specials + \Code@DefEnvir}{\Code@DefMacro}} + +\outer\def\CodeUsage{\begingroup + \MakePrivateLetters + \gmu@ifstar{% + \@sanitize%^^A\verbatim@specials + \MakePrivateOthers + \Code@UsgEnvir}{\Code@UsgMacro}} + +\DeclareCommand\Code@DefMacro\long{om}{% + \Code@DefIndex#2% we use the internal macro; it'll close the group. + \IfValueTF{#1}% + {\Code@MarginizeMacro#1}% + {\Code@MarginizeMacro#2}% +} + +\DeclareCommand\Code@UsgMacro\long{om}{% + \Code@UsgIndex#2% here also the internal macro; it'll close the + % group + \IfValueTF{#1}% + {\Code@MarginizeMacro#1}% + {\Code@MarginizeMacro#2}% +} + +\def\codeline@wrindex#1{\if@filesw + \immediate\write\@indexfile + {\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. \ilrr + \fi + \protected@edef\gmu@tempa{% + \@nx\protected@write\@nx\@glossaryfile{}% + {\string\glossaryentry{#1\encapchar\gmu@tempa}% + {\HLPrefix\number\c@codelinenum}}}% + \gmu@tempa +} + + +\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 + +\def\gag@index{\let\index=\@gobble + %\label{gag@index} + \let\codeline@wrindex=\@gobble} +\Store@Macros{\index\codeline@wrindex} + +\def\ungag@index{\Restore@Macros {\index\@@codeline@wrindex}} + %\label{ungag@index} + +\DeclareCommand\Code@DefEnvir\long{om}{% + \endgroup + % ^^A \typeout{@@@@@ 5069: \unexpanded{#1}}% + {%^^A\verbatim@specials + \IfValueTF{#1}% + {\addto@estomarginpar{#1}}% + {\addto@estomarginpar{#2}}% + \addto@estoindex{#2}% + \@defentryze{#2}{0}}} + +\DeclareCommand\Code@UsgEnvir\long{om}{% + \endgroup + {%^^A~\verbatim@specials + \IfValueTF{#1}% + {\addto@estomarginpar{#1}}% + {\addto@estomarginpar{#2}}% + \addto@estoindex{#2}% + \@usgentryze{#2}}} + +\long\def\addto@estomarginpar#1{% + % ^^A \def\gmu@tempa{\do{#1}}% we |\string|ed the argument to + % ^^A % allow it to be a~control sequence but now (2008/12/14) it's not + % ^^A % necessary because |#1| is sanitised. + % ^^A \@xa\gaddtomacro\@xa\envirs@tomarginpar\@xa{\gmu@tempa} +\gaddtomacro\envirs@tomarginpar{\do{#1}}} + +\long\def\addto@estoindex#1{% + % ^^A \typeout{@@@@ \unexpanded{#1}}% + % ^^A \edef\gmu@tempa{\@nx\do{\xiistring#1}} + % ^^A \@xa\gaddtomacro\@xa\envirs@toindex\@xa{\gmu@tempa} + \gaddtomacro\envirs@toindex{\do{#1}}} + +\def\TextUsage{\begingroup + % \chgs{2008/12/8 v0.99s added \cmd\@sanitize\ in the starred + % version} + % \label{TextUsage} + \MakePrivateLetters + \gmu@ifstar{\@sanitize\MakePrivateOthers + \Text@UsgEnvir}{\Text@UsgMacro}} + +\DeclareCommand\Text@UsgMacro\long{om}{% + \endgroup + % \chgs[\narrativett]{2008/12/12 v0.99s introduced in \pk{gmutils} + % and employed in the narrative verbatims, including \cs{ampulexdef} + % of the \pk{gmverb} macros} + \IfValueTF{#1}% + {\Text@Marginize*{#1}{\scanverb*{#1}}}% + {\Text@Marginize*{#2}{\scanverb*{#2}}}% + \begingroup\Code@UsgIndex#2% we declare the kind of formatting of the entry. + \text@indexmacro#2} + +\DeclareCommand\Text@UsgEnvir\long{om}{% + \endgroup + % ^^A \typeout{@@@@ :::\detokenize{#1}::::}% + % ^^A \typeout{@@@@ :::\detokenize{#2}::::}% + \IfValueTF{#1}% + {\Text@Marginize*{#1}{\scanverb*{#1}}}% + {\Text@Marginize*{#2}{\scanverb*{#2}}}% + \@usgentryze{#2}% we declare the `usage' kind of formatting of the + % entry and index the sequence |#1|. + \text@indexenvir{#2}} + +\pdef\TextMarginize{\@bsphack\begingroup + % \chgs{2008/12/8 v0.99s added \cmd\@sanitize\ in the starred + % version} + \MakePrivateLetters + \gmu@ifstar{% + \MakePrivateOthers\egText@MarginizeEnv}{\egText@MarginizeCS}} + +\long\def\egText@MarginizeEnv#1{\endgroup + \Text@Marginize*{#1}% \chgs{2008/12/07 v0.99s a~bug fixed: braces + % added around \hash1} + \@esphack} + +\long\def\egText@MarginizeCS#1{% + \endgroup + \Text@Marginize*{#1}% +} + +\if@marginparsused + \reversemarginpar + \marginparpush\z@ + \marginparwidth8pc\relax + % ^^A \settowidth{\marginparsep}{\ \ }% + % + % You may wish to put not only macros and environments to + % a~marginpar. + \long\def\gmdmarginpar#1{% + \marginpar{\raggedleft\strut + \hskip0ptplus100ptminus100pt% + #1}}%\stanza + % +\else + \long\def\gmdmarginpar#1{}% +\fi + +\let\gmu@tempa\all@stars +\@xa\addtomacro\@xa\gmu@tempa\@xa{\all@unders} +\@xa\DeclareCommand\@xa\Text@Marginize\@xa!% +\@xa{\@xa Q\@xa{\gmu@tempa}m}{% + \gmdmarginpar{% + \addtomacro\verb@lasthook{\marginpartt}% + \IfValueTF{#1}{\scanverb#1}{\scanverb}{#2}}% +}% of |\Text@Marginize|. +\let\marginpartt\narrativett + +\def\do@properindex{%\label{do@properindex} + \if@printalllinenos\else + \@pageinclindextrue + \let\special@index=\index + \fi} + + +\newenvironment*{macrocode*}{%\label{macrocode*} + \if@codeskipput\else\par\addvspace\CodeTopsep\@codeskipputgtrue\fi + \QueerEOL}%^^A\docstrips + {\par\addvspace\CodeTopsep\CodeEscapeChar\\} + % Let's remind that the starred version makes | | + +\newenvironment*{macrocode}{%\label{macrocode} + \if@codeskipput\else\par\addvspace\CodeTopsep\@codeskipputgtrue\fi + \QueerEOL}% \changes{v0.99l}{2008/08/06}{removed \cs{CodeSpacesBlank}} + {\par\addvspace\CodeTopsep\CodeEscapeChar\\} +\let\oldmc\macrocode +\let\endoldmc\endmacrocode +\n@melet{oldmc*}{macrocode*} +\n@melet{endoldmc*}{endmacrocode*} + +\addtomacro\oldmc{\@oldmacrocode@launch}% +\@xa\addtomacro\csname oldmc*\endcsname{% + \@oldmacrocode@launch} + +\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 + \@makeother\|% because |\ttverbatim| doesn't do that. + \MakePrivateLetters% see line \ref{MPL}.\par + % ^^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. + % Not to complicate assume |*| may occur at most once and only at + % 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. + \@xa\gmd@currenvxistar\@currenvir*\relax + \@oldmacrocode} + +\foone{\catcode`*11 } +{\def\gmu@xistar{*}} + +\def\gmd@currenvxistar#1*#2\relax{% + \edef\@currenvir{#1\if*#2\gmu@xistar\fi}} + +\foone{% +\catcode`[=1 \catcode`]=2 +\catcode`\{=\active \@makeother\} +\@makeother\^^B +\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 |/@nx | four times. +/xdef/oldmc@def[& +/def/@nx/oldmc@end####1/@nx% /@nx\end& +/@nx{/@currenvir}[& +####1^^B/@nx/gmd@oldmcfinis]]& +/egroup&% now |\oldmc@edef| is defined to have one parameter delimited +&% with \incmd\end\arg{current env.'s name} +/oldmc@def& +/oldmc@end]&% \CDPerc +] + +\def\gmd@oldmcfinis{% + \def\gmu@tempa{\end{\@currenvir}}% + \@xa\gmu@tempa\@xa\def\@xa\gmd@lastenvir\@xa{\@currenvir}% + \@xa\CodeDelim\@xa*\stored@code@delim + \gmd@mchook}% see line \ref{gmd@mchook} + +\def\OldMacrocodes{%% \changes{v0.99m}{2008/08/10}{renamed from + %% \cs{VerbMacrocodes}} + \let\macrocode\oldmc + \n@melet{macrocode*}{oldmc*}} + + +\foone{\catcode`\%\active} +{\def\docstrips@percent{\catcode`\%\active + \let%\gmd@codecheckifds}} + +\def\gmd@codecheckifds#1#2{% note that |#1| is just to gobble + % \inverb|\gmd@charbychar| token. +\typeout{@@@@@ codecheckifds hash 1: »\unexpanded{#1}«, 2: »\unexpanded{#2}«}% + \ifnum \if@dsdir 1\else 0\fi\ifgmd@dsVerb 1\fi>\z@ + \afterfi{% + \gmd@dsChecker{% + \if\@nx<\@nx#2\afterfi\gmd@docstripdirective + \else\afterfi{\xiipercent#1#2}% + \fi}% of the checker's arg + }% of |\afterfi| + \else\afterfi{\xiipercent#1#2}% + \fi} +\newenvironment{macro}{%\label{macro} + \@tempskipa=\MacroTopsep + \if@codeskipput\advance\@tempskipa by-\CodeTopsep\fi + \par\addvspace{\@tempskipa}\@codeskipputgtrue + \begingroup\MakePrivateLetters\MakePrivateOthers% we make also the + % `private others' to cover the case of other sequence in the + % argument. (We'll use the |\macro| macro also in the environment + % for describing and defining environments.) + \gmd@ifonetoken\Hybrid@DefMacro\Hybrid@DefEnvir}% + {\par\addvspace\MacroTopsep\@codeskipputgtrue} + % It came out that the \docfm's author(s) give the \env{macro} + % environment also starred versions of commands as argument. It's \acro{OK} + % since (the default version of) |\MakePrivateLetters| makes |*| + % a~letter and therefore such a~starred version is just one \CS. + % However, in \pk{doc.dtx} occur \env{macro}s that mark + % \emph{implicit} definitions i.e., such that the defined \CS is not + % scanned in the subsequent code. +\@namedef{macro*}{\let\gmd@ifonetoken\@secondoftwo\macro} +\@xa\let\csname endmacro*\endcsname\endmacro +\def\gmd@ifsingle#1#2\@nil{% + \def\gmu@tempa{#2}% + \ifx\gmu@tempa\@empty} +\def\gmd@ifonetoken#1#2#3{% + \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|. \ilrr + \gmd@ifsingle#3\@nil + \afterfi{\@xa#1\gmu@tempb}% + \else + \edef\gmu@tempa{\@xa\string\gmu@tempb}% + \afterfi{\@xa#2\@xa{\gmu@tempa}}% + \fi} +\long\def\Hybrid@DefMacro#1{% + \Code@DefIndex{#1}% this macro closes the group opened by |\macro|. + \Text@MarginizeNext{*{#1}}} + +\long\def\Hybrid@DefEnvir#1{% + \Code@DefIndexStar{#1}% this macro also closes the group begun by + % |\macro|. + \Text@MarginizeNext{*{#1}}} + +\long\def\Text@MarginizeNext#1{% + \gmd@evpaddonce{\Text@Marginize#1\ignorespaces}} + +\long\def\gmd@evpaddonce#1{% + \global\advance\gmd@oncenum\@ne + \@xa\long\@xa\edef% \CodeUsgIndex*{NeuroOncer} + \csname gmd/evp/NeuroOncer\the\gmd@oncenum\endcsname{% + \@nx\g@relaxen + \csname gmd/evp/NeuroOncer\the\gmd@oncenum\endcsname}% Why does it + % work despite it shouldn't? Because when the \CS got with + % \inverb|\csname›…\endcsname| is undefined, it's equivalent to + % |\relax| and therefore unexpandable. That's why it passes + % \inverb|\edef| and is able to be assigned.\ilrr + \@xa\addtomacro\csname gmd/evp/NeuroOncer\the\gmd@oncenum\endcsname{#1}% + \@xa\addto@hook\@xa\everypar\@xa{% + \csname gmd/evp/NeuroOncer\the\gmd@oncenum\endcsname}% +} + +\newcount\gmd@oncenum + +\@xa\let\@xa\environment\csname macro*\endcsname +\@xa\let\@xa\endenvironment\csname endmacro*\endcsname + +\def\DoNotIndex{\bgroup\MakePrivateLetters\DoNot@Index} + +\long\def\DoNot@Index#1{\egroup% we close the group, + \let\gmd@iedir\gmd@justadot% we declare the direction of the \<?>cluding + % to be \emph{ex}cluding. We act this way to be able to reverse the + % exclusions easily later.\ilrr + \dont@index#1.} + +\long\def\dont@index#1{% + \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\gmu@tempa.% a~dot finishes expelling + \else + \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\gmu@tempa{\string#1 }}% its to sound with + % \incs{detokenize}s in tests. + \@xa\let% + \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 \CS shall not be indexed. + % We |\let| not |\def| to spare \TeX's memory. + \afterfifi\dont@index + \fi + \fi} + +\DoNotIndex\{ \DoNotIndex\}% \label{DNIbraces}the index entries of + +\begin{MakePrivateLetters}% Yes, |\DoNotIndex| does + % |\MakePrivateLetters| on its own but No, it won't have any effect + % if it's given in another macro's |\def|. + % \HideAllDefining + \gdef\DefaultIndexExclusions{% + \DoNotIndex{\@ \@@par \@beginparpenalty \@empty}%\label{DIE1} + \DoNotIndex{\@flushglue \@gobble \@input}% + \DoNotIndex{\@makefnmark \@makeother \@maketitle}% + \DoNotIndex{\@namedef \@ne \@spaces \@tempa}% + \DoNotIndex{\@tempb \@tempswafalse \@tempswatrue}% + \DoNotIndex{\@thanks \@thefnmark \@topnum}% + \DoNotIndex{\@@ \@elt \@forloop \@fortmp \@gtempa \@totalleftmargin}% + \DoNotIndex{\" \/ \@ifundefined \@nil \@verbatim \@vobeyspaces}% + \DoNotIndex{\| \~ \ \active \advance \aftergroup \begingroup \bgroup}% + \DoNotIndex{\mathcal \csname \def \documentstyle \dospecials \edef}% + \DoNotIndex{\egroup}% + \DoNotIndex{\else \endcsname \endgroup ⵢendinput \endtrivlist}% + \DoNotIndex{\expandafter \fi \fnsymbol \futurelet \gdef \global}% + \DoNotIndex{\hbox \hss \if \if@inlabel \if@tempswa \if@twocolumn}% + \DoNotIndex{\ifcase}% + \DoNotIndex{\ifcat \iffalse \ifx \ignorespaces \index \input \item}% + \DoNotIndex{\jobname \kern \leavevmode \leftskip \let \llap \lower}% + \DoNotIndex{\m@ne \next \newpage \nobreak \noexpand \nonfrenchspacing}% + \DoNotIndex{\obeylines \or \protect \raggedleft \rightskip \rm \sc}% + \DoNotIndex{\setbox \setcounter \small \space \string \strut}% + \DoNotIndex{\strutbox}% + \DoNotIndex{\thefootnote \thispagestyle \topmargin \trivlist \tt}% + \DoNotIndex{\twocolumn \typeout \vss \vtop \xdef \z@}% + \DoNotIndex{\, \@bsphack \@esphack \@noligs \@vobeyspaces \@xverbatim}% + \DoNotIndex{\` \catcode \end \escapechar \frenchspacing \glossary}% + \DoNotIndex{\hangindent \hfil \hfill \hskip \hspace \ht \it \langle}% + \DoNotIndex{\leaders \long \makelabel \marginpar \markboth \mathcode}% + \DoNotIndex{\mathsurround \mbox}%\verb+% \newcount \newdimen \newskip+ + \DoNotIndex{\nopagebreak}% + \DoNotIndex{\parfillskip \parindent \parskip \penalty \raise \rangle}% + \DoNotIndex{\section \setlength \TeX \topsep \underline \unskip}% + \DoNotIndex{\vskip \vspace \widetilde \\ \% \@date \@defpar}% + \DoNotIndex{\[ \]}% see line \ref{DNIbraces}. + \DoNotIndex{\count@ \ifnum \loop \today \uppercase \uccode}% + \DoNotIndex{\baselineskip \begin \tw@}% + \DoNotIndex{\a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q}% + \DoNotIndex{\r \s \t \u \v \w \x \y \z \A \B \C \D \E \F \G \H}% + \DoNotIndex{\I \J \K \L \M \N \O \P \Q \R \S \T \U \V \W \X \Y \Z}% + \DoNotIndex{\1 \2 \3 \4 \5 \6 \7 \8 \9 \0}% + \DoNotIndex{\! \# \$ \& \' \( \) \. \: \; \< \= \> \? \_}% |\+| + % seems to be so rarely used that it may be advisable to index it. + \DoNotIndex{\discretionary \immediate \makeatletter \makeatother}% + \DoNotIndex{\meaning \newenvironment \par \relax \renewenvironment}% + \DoNotIndex{\repeat \scriptsize \selectfont \the \undefined}% + \DoNotIndex{\arabic \do \makeindex \null \number \show \write \@ehc}% + \DoNotIndex{\@author \@ehc \@ifstar \@sanitize \@title}% + \DoNotIndex{\if@minipage \if@restonecol \ifeof \ifmmode}% + \DoNotIndex{\lccode %|%\newtoks| + \onecolumn \openin \p@ \SelfDocumenting}% + \DoNotIndex{\settowidth \@resetonecoltrue \@resetonecolfalse \bf}% + \DoNotIndex{\clearpage \closein \lowercase \@inlabelfalse}% + \DoNotIndex{\selectfont \mathcode \newmathalphabet \rmdefault}% + \DoNotIndex{\bfdefault}% + % From the above list I~removed some |\new›…| declarations because + % I~think it may be useful to see gathered the special |\new›…|s of + % each kind. For the same reason I~would not recommend excluding + % from the index such declarations as |\AtBeginDocument|, + % |\AtEndDocument|, |\AtEndOfPackage|, |\DeclareOption|, + % |\DeclareRobustCommand| etc. But the + % common definitions, such as |\›(new⁄|provide›)command| and + % |\›(e⁄|g⁄|x›)def|s, as the most common, in my opinion excluded should + % be.^^A\) + % + % \stanza + % And some my exclusions: + \DoNotIndex{\@@input \@auxout \@currentlabel \@dblarg}% + \DoNotIndex{\@ifdefinable \@ifnextchar \@ifpackageloaded}% + \DoNotIndex{\@indexfile \@let@token \@sptoken \^}% the latter comes + % from \CSs like |\^^M|, see sec. \ref{Tasks}. + \DoNotIndex{\addto@hook \addvspace}% + \DoNotIndex{\CurrentOption}% + \DoNotIndex{\emph \empty \firstofone}% + \DoNotIndex{\font \fontdimen \hangindent \hangafter}% + \DoNotIndex{\hyperpage \hyperlink \hypertarget}% + \DoNotIndex{\ifdim \ifhmode \iftrue \ifvmode \medskipamount}% + \DoNotIndex{\message}% + \DoNotIndex{\NeedsTeXFormat \newcommand \newif}% + \DoNotIndex{\newlabel}% + \DoNotIndex{\of}% + % ^^A\PassOptionsToClass\PassOptionsToPackage + \DoNotIndex{\phantom \ProcessOptions \protected@edef}% + \DoNotIndex{\protected@xdef \protected@write}% + \DoNotIndex{\ProvidesPackage \providecommand}% + \DoNotIndex{\raggedright}% + \DoNotIndex{\raisebox \refstepcounter \ref \rlap}% ^^A\RequirePackage + \DoNotIndex{\reserved@a \reserved@b \reserved@c \reserved@d}% + \DoNotIndex{\stepcounter \subsection \textit \textsf \thepage \tiny}% + \DoNotIndex{\copyright \footnote \label \LaTeX}% + % \changes[\DefaultIndexExclusions]{v0.98a}{06/09/06}{more + % macros added to the `exclude list'} + \DoNotIndex{\@eha \@endparenv \if@endpe \@endpefalse \@endpetrue}% + \DoNotIndex{\@evenfoot \@oddfoot \@firstoftwo \@secondoftwo}% + \DoNotIndex{\@for \@gobbletwo \@idxitem \@ifclassloaded}% + \DoNotIndex{\@ignorefalse \@ignoretrue \if@ignore}% + \DoNotIndex{\@input@ \@input}% + \DoNotIndex{\@latex@error \@mainaux \@nameuse}% + \DoNotIndex{\@nomath \@oddfoot}%|%\@onlypreamble| should be indexed + % \acro{IMHO}. + \DoNotIndex{\@outerparskip \@partaux \@partlist \@plus}% + \DoNotIndex{\@sverb \@sxverbatim}% + \DoNotIndex{\@tempcnta \@tempcntb \@tempskipa \@tempskipb}%\\ + % I~think the layout parameters even the kernel, should not be + % excluded: \inverb|\@topsep| \inverb|\@topsepadd|^^B + % \ \inverb|\abovedisplayskip| \inverb|\clubpenalty| etc. + \DoNotIndex{\@writeckpt}% + \DoNotIndex{\bfseries \chapter \part \section \subsection}% + \DoNotIndex{\subsubsection}% + \DoNotIndex{\char \check@mathfonts \closeout}% + \DoNotIndex{\fontsize \footnotemark \footnotetext \footnotesize}% + \DoNotIndex{\g@addto@macro \hfilneg \Huge \huge}% + \DoNotIndex{\hyphenchar \if@partsw \IfFileExists }% + \DoNotIndex{\include \includeonly \indexspace}% + \DoNotIndex{\itshape \language \LARGE \Large \large}% + \DoNotIndex{\lastbox \lastskip \m@th \makeglossary}% + \DoNotIndex{\maketitle \math@fontsfalse \math@fontstrue \mathsf}% + \DoNotIndex{\MessageBreak \noindent \normalfont \normalsize}% + \DoNotIndex{\on@line \openout \outer}% + \DoNotIndex{\parbox \part \rmfamily \rule \sbox}% + \DoNotIndex{\sf@size \sffamily \skip}% + \DoNotIndex{\textsc \textup \toks@ \ttfamily \vbox}% + % \changes[\DoNotIndex]{v0.97}{06/09/04}{Excluding some star-versions of + % commands} + % \nostanza\noindent + % |%% \DoNotIndex{\begin*}| maybe in the future, if the idea gets + % popular\dots \nostanza + \DoNotIndex{\hspace* \newcommand* \newenvironment* \providecommand*}% + \DoNotIndex{\renewenvironment* \section* \chapter*}%\label{DIE2} + }% of |\DefaultIndexExclusions|.\par + % I~put all the expellings into a~macro because I~want them + % to be optional. +\end{MakePrivateLetters} + +\if@indexallmacros\else + \DefaultIndexExclusions +\fi + +\def\DoIndex{\bgroup\MakePrivateLetters\Do@Index} + +\long\def\Do@Index#1{\egroup\@relaxen\gmd@iedir\dont@index#1.}% note + +\def\UndoDefaultIndexExclusions{% + \Store@Macro\DoNotIndex + % ^^A\dont@index + \let\DoNotIndex\DoIndex + % ^^A \let\dont@index=\do@index + \DefaultIndexExclusions + % ^^A \RestoreMacro\dont@index + \Restore@Macro\DoNotIndex} + +\long\def\IndexPrologue#1{\@bsphack\def\index@prologue{#1}\@esphack} + +\def\indexdiv{\@ifundefined{chapter}{\section*}{\chapter*}} + +\@ifundefined{index@prologue} {\def\index@prologue{\indexdiv{Index}% + \markboth{Index}{Index}% + Numbers written in italic refer to the \if@pageindex pages \else + code lines \fi where the + corresponding entry is described; numbers underlined refer to the + \if@pageindex\else code line of the \fi definition; numbers in + roman refer to the \if@pageindex pages\else code lines \fi where + the entry is used. + \if@pageindex\else + \ifx\HLPrefix\@empty + The numbers preceded with `p.' are page numbers. + \else The numbers with no prefix are page numbers. + \fi\fi + \ifx\IndexLinksBlack\relax\else + All the numbers are hyperlinks. + % ^^A, they are made black just to let Adobe Reader work + % ^^A~faster. + \fi + \gmd@dip@hook% this hook is intended to let a~user add + % something without redefining the entire prologue, see below. + }}{} + +\@emptify\gmd@dip@hook +\long\def\AtDIPrologue#1{\g@addto@macro\gmd@dip@hook{#1}} + +\AtDIPrologue{%\label{verb:ampulex:index} + \ampulexdef\verb\ttverbatim\verbatim@specials + {\ttverbatim\verbatim@specials}} + +\RequirePackage{multicol} + +\newdimen\IndexMin \IndexMin = 133pt\relax% originally it was set +\newcount\c@IndexColumns \c@IndexColumns = 3 +\renewenvironment{theindex} + {\begin{multicols}\c@IndexColumns[\index@prologue][\IndexMin]% + \IndexLinksBlack + \IndexParms \let\item\@idxitem \ignorespaces}% + {\end{multicols}} + +\def\IndexLinksBlack{\hypersetup{linkcolor=black}}% To make Adobe + +\@ifundefined{IndexParms} + {\def\IndexParms{% + % \label{IndexParms} + \parindent \z@ + \columnsep 15pt + \parskip 0pt plus 1pt + \rightskip 15pt + \mathsurround \z@ + \parfillskip=-15pt plus 1 fil % \docfm\ defines this parameter + % rigid but that's because of the stretchable space (more + % precisely, a~|\dotfill|) between the item and the entries. But + % in \pk{gmdoc} we define no such special delimiters, so we add + % an infinite stretch. + \small + \def\@idxitem{\par\hangindent 30pt}% + \def\subitem{\@idxitem\hspace*{15pt}}% + \def\subsubitem{\@idxitem\hspace*{25pt}}% + \def\indexspace{\par\vspace{10pt plus 2pt minus 3pt}}% + \ifx\EntryPrefix\@empty\else\raggedright\fi% long (actually, + % a~quite \emph{short but nonempty} entry prefix) made space + % stretches so terribly large in the justified paragraphs that + % we should make |\raggedright| rather. + \ifnum\c@IndexColumns>\tw@\raggedright\fi% the numbers in narrow + % col\-umns look better when they are |\raggedright| in my opinion. + }}{} + +\def\PrintIndex{% we ensure the standard meaning of the line end + % character not to cause a~disaster. + \@ifQueerEOL{\StraightEOL\printindex\QueerEOL}% + {\printindex}} + + +\foone{\@makeother\<\@makeother\> + \glet\sgtleftxii=<} +{ + \def\gmd@docstripdirective{% + \begingroup\let\do=\@makeother + \do\*\do\/\do\+\do\-\do\,\do\&\do\|\do\!\do\(\do\)\do\>\do\<% ^^Ayes, we + % ^^A make \inverb|<|\catother\ since a~directive |<<|\<any text till ^^B>> + % ^^A~the end of line> theoretically may occur. + \@ifnextchar{<}{% + \let\do=\@makeother \dospecials + \gmd@docstripverb} + {\gmd@docstripinner}}% + + \def\gmd@docstripinner#1>{% + \endgroup + \def\gmd@modulehashone{% + \Module{#1}\space + \@afternarrgfalse\@aftercodegtrue\@codeskipputgfalse}% + % ^^A \gmd@docstripshook + \gmd@textEOL\gmd@modulehashone} + % A~word of explanation: first of all, we + % close the group for changed |\catcode|s; the directive's text has its + % |\catcode|s fixed. Then we put the directive's text wrapped with the + % formatting macro into one macro in order to give just one token + % the \gmdoc's \TeX\ code scanner. + % ^^A But before we launch the \TeX\ code + % ^^A scanning with all the b\&w, we virtually restore the meaning of + % ^^A further |<|s to let them start further \ds\ directives, + % ^^A and after this possible restore (if it \emph{actually} takes place + % ^^A depends on the declaration used: |\docstrip| or |\docstrips|) we + % Then launch this big \TeX\ code scanning machinery by calling + % |\gmd@textEOL| which is an alias for the `narrative' meaning of the + % line end. This macro opens the verbatim group and launches the + % char-by-char scanner. That is this scanner because of what we + % encapsulated the directive's text with the formatting into one + % macro: to let it pass the scanner. + % + % That's why in the `old' macrocodes case the active |%| closes the + % group before launching |\gmd@docstripdirective|. + % + % \stanza + % The `verbatim' directive macro works very similarly. +} + +\foone{\@makeother\<\@makeother\> + \glet\sgtleftxii=< + \catcode`\^^M=\active}% +{% + \def\gmd@docstripverb<#1^^M{% + \endgroup% + \def\gmd@modulehashone{% + \ModuleVerb{#1}\@afternarrgfalse\@aftercodegtrue% + \@codeskipputgfalse}% + \xdef\gmd@dsVerbDelim{\detokenize{#1}}% + \gmd@textEOL\gmd@modulehashone^^M}% +} + +\edef\gmd@dsVerbDelim{\detokenize{#@$$$$#_()(_)*981-71092519-40^^A^^B}} + + +\pdef\dsVerbClose{% + \global\gmd@dsVerbtrue} + +\providecommand*\Module[1]{{% + \mod@math@codes$\langle\mathsf{#1}\rangle$}} + +\providecommand*\ModuleVerb[1]{{% + \mod@math@codes$\langle\langle\mathsf{#1}$}} + +\def\ModuleVerbClose#1{{% + \xiipercent + \mod@math@codes$\mathsf{#1}$ + {\normalfont[\ds\ verbatim closing dir.]}}} + +\def\mod@math@codes{\mathcode`\|="226A \mathcode`\&="2026 } + +\def\gmd@DefineChanges{% + \outer\long\def\changes{% + \gmd@changes@init + \changes@}} + +\def\gmd@changes@init{% + \@bsphack\begingroup\@sanitize + \catcode`\\\z@ \catcode`\ 10 \MakePercentIgnore +\catcode`\^=7 + \MakePrivateLetters \StraightEOL + \MakeGlossaryControls} + +\newcommand\changes[4][]{\PackageWarningNoLine{gmdoc}{% + ^^JThe \bslash changes command used \on@line + ^^Jwith no \string\RecordChanges\space declared. + ^^JI shall not warn you again about it}% + %^^A\gmd@countlines{#4}% + \renewcommand\changes[4][]{%^^A\gmd@countlines{#4} + }} + +\def\MakeGlossaryControls{% + \edef\actualchar{\string=}\edef\quotechar{\string!}% + \edef\levelchar{\string>}\edef\encapchar{\xiiclub}}%for the glossary the + % `actual', the `quote' and the `level' chars are respectively |=|, + % |!| and |>|, the `encap' char remains untouched. I~decided to + % preserve the \docfm's settings for the compatibility. + +\newcommand\changes@[4][\generalname]{% + \if@RecentChange{#3}% if the date is later than the one stored in + % \cs{c@Chang\+es\+Start\+Date}, + \@tempswafalse + \ifx\generalname#1% then we check whether a~\CS-entry is given + % in the optional first argument or is it unchanged. + \ifx\last@defmark\relax\else% if no particular \CS is + % specified in |#1|, we check whether |\last@defmark| contains + % something and if so, we put it into |\gmu@tempb| scratch macro. + \@tempswatrue + \edef\gmu@tempb{% it's a~bug fix: while typesetting traditional + % \file{.dtx}es, \inverb|\last@defmark| came out with \inverb|\| at the + % beginning (which resulted with \inverb|\\|\<name> in the change + % log) but while typesetting the `new' way, it occurred + % without the bslash. So we gobble the bslash if it's + % present and two lines below we handle the exception of + % \inverb|\last@defmark|\equals|{\}| (what would happen if + % a~definition of \inverb|\\| was marked in new way \gmdoc ing).%^^A] + \if\bslash\last@defmark\else\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., + %a~particular \CS is specified by it (if some day one + % wishes to |\changes| |\generalname|, \heshe\ should type + % |\changes[generalname]|\dots) + \@tempswatrue + {\escapechar\m@ne + \xdef\gmu@tempb{\string#1}}% + \if\bslash\@xa\@firstofmany\string#1\relax\@nil% we check + % whether \inverb|#1| is a~\CS\dots\ilrr + \def\gmd@glossCStest{1}%\dots\ and tell the glossary if so. + \fi + \fi + \@ifundefined{gmd@glossCStest}{\def\gmd@glossCStest{0}}{}% + \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 + % \ref{GeneralName}. + \fi + #2\levelchar% + \if@tempswa% If the macro |\last@defmark| + % doesn't contain any \CS name (i.e., is empty) nor |#1| + % specifies a~\CS, the current + % changes entry was done at top-level. In this case we precede + % it by |\generalname|. + \gmu@tempb + \actualchar\bslash verb*% + \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%^^A\gmd@deeolize{ + #4%^^A} + }}% + \gmu@tempa + \grelaxen\gmd@glossCStest + \fi% of |\if@recentchange| + %^^A\gmd@countlines{#4}% + \endgroup\@esphack} + +\@relaxen\last@defmark +\@emptify\GeneralName + +\def\ChangesGeneral{\grelaxen\last@defmark}% If automatic detection of + +\AtBegInput{\ChangesGeneral} + +\newcount\c@ChangesStartDate + +\def\if@RecentChange#1{% + \gmd@setChDate#1\@nil\@tempcnta + \ifnum\@tempcnta>\c@ChangesStartDate} + +\def\gmd@setChDate#1/#2/#3\@nil#4{% the last parameter will be a~|\count| + % register. + #4=\numexpr#1*\@M+#2*100+#3\relax + %\CH{2010/06/23 changed from \TeX's arithmetic to \cmd\numexpr} +} + + +\def\ChangesStart#1#2{% + \gmd@setChDate#2\@nil\c@ChangesStartDate + \typeout{^^JPackage gmdoc info: ^^JChanges' start date #1 memorised + as \string<\the\c@ChangesStartDate\string> \on@line.^^J} + \advance\c@ChangesStartDate\m@ne% we shall show the changes \emph{at ^^B + % the specified day} and later. + \ifnum\c@ChangesStartDate>19820900 %\unskip\StraightEOL\footnote{^^A + % 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\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.}}% + \gmu@tempa + \fi} +\def\generalname{General} + +\def\RecordChanges{\makeglossary\gmd@DefineChanges + \@relaxen\RecordChanges} + +\newdimen\GlossaryMin \GlossaryMin = 80pt +\newcount\c@GlossaryColumns \c@GlossaryColumns = 2 +\newenvironment{theglossary}{% + \begin{multicols}\c@GlossaryColumns + [\glossary@prologue][\GlossaryMin]% + \GlossaryParms \IndexLinksBlack + \let\item\@idxitem \ignorespaces}% + {\end{multicols}} + +\long\def\GlossaryPrologue#1{\@bsphack + \def\glossary@prologue{#1}% + \@esphack} +\@ifundefined{glossary@prologue} + {\def\glossary@prologue{\indexdiv{{Change History}}% + \markboth{{Change History}}{{Change History}}% + }}{} +\AtBeginDocument{% + \@ifundefined{GlossaryParms}{\let\GlossaryParms\IndexParms}{}} + +\def\PrintChanges{% to avoid a~disaster among queer EOLs: + \@ifQueerEOL + {\StraightEOL\@input@{\jobname.gls}\QueerEOL}% + {\@input@{\jobname.gls}}% + \g@emptify\PrintChanges} + +\pdef\toCTAN{%\ + % \begin{enumargs} + % \item \<year/month/day>\textvisiblespace\<version number> + % \end{enumargs} + % \changes{v0.99r}{2008/11/22}{added} + % \chgs{2008/11/30 v0.99s made a~shorthand for \cs{chgs} not + % \cs{changes}} + \gmd@changes@init + \gmd@toCTAN@} + +\def\gmd@toCTAN@#1{% + \edef\gmu@tempa{\gmd@chgs@parse#1 \@nil}% + \edef\gmu@tempa{% + \unexpanded{\changes@[\generalname]}% + {\@xa\@firstofthree\gmu@tempa}% + {\@xa\@secondofthree\gmu@tempa}% + {put to \acro{CTAN} on \@xa\@secondofthree\gmu@tempa}}% + \gmu@tempa} + + +\outer\pdef\chgs{\gmd@changes@init\gmd@chgs} + +\DeclareCommand\gmd@chgs{% + o % the optional \CS the change refers to + >!m % change's date, version and text +}{% + \IfValueTF{#1}{%% + \edef\gmu@tempa{\@nx\changes@[\unexpanded{#1}]% + \@xa\unexpanded\@xa{\gmd@chgs@parse#2\@nil}}}% + {\edef\gmu@tempa{\@nx\changes@ + \@xa\unexpanded\@xa{\gmd@chgs@parse#2\@nil}}}% + \gmu@tempa}% of |\gmd@chgs| + +\long\def\gmd@chgs@parse#1 #2 #3\@nil{{#2}{#1}{#3}}% + +\outer\pdef\CH{% + \gmd@changes@init\gmd@chgsplus} + +\DeclareCommand\gmd@chgsplus{\SameAs\gmd@chgs}{% + \DCUse\gmd@chgs{#1}{#2}% + \gmd@threeway{#1}#2\@nil +} + +\long\def\gmd@threeway +#1% opt. \CS that |\CH| refers to +#2 % (delimd.\ with a blank) date +#3 % (delimd.\ with a blank) version +#4\@nil % text +{% + \par (#2, #3\IfValueT{#1}{, \texttt{\detokenize\@xa{\string#1}}}:) + #4\scantokens{}% to provide proper line end which'll take care of + % |\par| \&c. +} + +\newcount\check@sum + +\def\CheckSum#1{\@bsphack\global\check@sum#1\relax\@esphack} + +\newcounter{CheckSum} + +\newcommand*\step@checksum{\stepcounter{CheckSum}} +\AtEndInput{\check@checksum} + +\def\check@checksum{\relax + \ifnum\check@sum=\z@ + \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 + \edef\gmu@tempa{% + \@nx\typeout{*****+*+*+*+*+*+*+*+*+*+^^J% + * The input file \gmd@inputname: Checksum passed.^^J% + \gmd@chschangeline + * (package gmdoc info.)^^J% + *****+*+*+*+*+*+*+*+*+*+^^J}} + \else + \edef\gmu@tempa{% + \@nx\typeout{********\gmd@wykrzykniki^^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% + ********\gmd@wykrzykniki^^J}}% + % \chgs{2008/11/30 v0.99s + % \env{\quotechar!*\quotechar!*\quotechar!…} sequence changed to + % \env{\quotechar! \quotechar! \quotechar!…} for better + % distinction} + \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@} + +\def\gmd@wykrzykniki{! ! ! ! ! ! ! ! ! ! ! !} + +\def\gmd@chschangeline{% + \xiipercent\space\string\chschange + {\@ifundefined{fileversion}{v???}{\fileversion}}% + {\the\year/\the\month/\the\day}% + {\the\c@CheckSum}^^J% + \xiipercent\space\string\chschange + {\@ifundefined{fileversion}{v???}{\fileversion}}% + {\@xa\@gobbletwo\the\year/\the\month/\the\day}% + {% with two di\-g\-it year in case you use |\ChangesStart|. + \the\c@CheckSum}^^J} + +\outer\pdef\chschange{% \ + % \begin{enumargs} + % \dc m file version, + % \dc m date, + % \dc checksum, + % \dc o the reason of check sum change, possibly short. + % \end{enumargs} + \@ifQueerEOL + {\def\EOLwasQueer{11}}{\def\EOLwasQueer{10}}% + \gmd@changes@init + \chschange@} + +\DeclareCommand\chschange@{mmmo}{%\label{chschange} + \changes@{#1}{#2}{CheckSum #3 + \IfValueT{#4}{because of #4}% + }% |\csname›…| because + % \incs{cha\+n\+g\+es} is \inverb|\outer|. + \CheckSum{#3}% + \IfValueF{#4}{% + \if\EOLwasQueer + \afterfi{% + \@ifnextchar\par{% + \@xa\gmd@textEOL\gobble}% + {}% + }% of |\afterfi|, + \fi}% of no value of |#4|, +}% of |\chschange@|.\nostanza + +\newcommand*\ltxPageLayout{% + \setlength{\textwidth}{355pt}% + \setlength\marginparwidth{95pt}% + \setlength\oddsidemargin{82pt}% + \setlength\evensidemargin{82pt}} + + +\DeclareCommand\DocInclude{O{}mO{}}{%\ + % \begin{enumargs} + % \dc o path (with closing slash), will not be printed + % \dc m file name without extension, will be printed + % \dc o file extension (with dot) if not \file{.sty}, \file{.cls}, + % \file{.tex}, \file{.dtx} nor \file{.fdd} + % \end{enumargs}\ + % originally it took just one + % argument. Here we make it take two, first of which is intended to + % be the path (with the closing \inverb |/|). This is intended not to print + % the path in the page footers only the filename.\par + % \CodeUsage\HLPrefix + \gdef\HLPrefix{\filesep}% + \gdef\EntryPrefix{\filesep}% we define two rather kernel parameters + % to expand to the file marker. The first will bring the information + % to one of the default \inverb|\IndexPrologue|'s + % |\if|s. Therefore the + % definition is global. The latter is such for symmetry. + \def\GeneralName{#2\actualchar\pk{#2} }% \label{GeneralName} for the + % changes' history main level entry. + % + % Now we check whether we try to include ourselves and if + % so---we'll (create and) read an \file{.auxx} file instead of + % (the main) \file{.aux} to avoid an infinite recursion of |\input|s. + % + \edef\gmd@jobname{\jobname}% + \edef\gmd@difilename{% we want the filename all `other', just as + % in \inverb|\jobname|. + \@xa\@xa\@xa\@gobble\@xa\string\csname#2\endcsname}% + \ifx\gmd@jobname\gmd@difilename + \def\gmd@auxext{auxx}% + \else + \def\gmd@auxext{aux}% + \fi + \relax + %^^A\if@ltxDocInclude + \clearpage + % ^^A\fi + \gmd@docincludeaux \def\currentfile{gmdoc-IncludeFileNotFound.000}% + \let\fullcurrentfile\currentfile + \@ifnonempty{#3}% + {% + \unless\if.\@firstofmany#3\relax\@nil + \PackageError{gmdoc}{Optional \xiihash3 of + \string\DocInclude\space + if present has to begin with a dot (.)}{}% + \fi + \edef\currentfile{#2#3}% + \IfFileExists{#1\currentfile}{}% + {\PackageError{gmdoc}{\string\DocInclude\space file + \currentfile\space not found}{}}% + }% of if extension given. + {% if extension not given: + \IfFileExists{#1#2.fdd}{\edef\currentfile{#2.fdd}}{% it's not \pk{.fdd}, + \IfFileExists{#1#2.dtx}{\edef\currentfile{#2.dtx}}{% it's not \pk{.dtx} + % either, + \IfFileExists{#1#2.sty}{\edef\currentfile{#2.sty}}{% it's not + % \pk{.sty}, + \IfFileExists{#1#2.cls}{\edef\currentfile{#2.cls}}{% it's + % not \pk{.cls}, + \IfFileExists{#1#2.tex}{\edef\currentfile{#2.tex}}{% it's + % not \pk{.tex}, + \IfFileExists{#1#2.fd}{\edef\currentfile{#2.fd}}{% so it + % must be \pk{.fd} or error. + \PackageError{gmdoc}{\string\DocInclude\space file + #1#2.fdd/dtx/sty/cls/tex/fd not found.}{}% + }}}}}}% + }% of if no extension given + % \changes{v0.98j}{06/10/16}{\pk{.fdd} added in \cs{DocInclude}'s + % search for the extension.} + \edef\currentfile{\@xa\detokenize\@xa{\currentfile}}% + \edef\fullcurrentfile{#1\currentfile}% + \ifnum\@auxout=\@partaux + \@latexerr{\string\DocInclude\space cannot be nested}\@eha + \else \@docinclude{#1}#2#3 \fi}% Why is |#2| delimited with | | not + +\def\@docinclude#1#2 {% To match the macro's parameter string, is an + % answer. But why is |\@docinclude| defined so? Originally, in + % \pk{ltxdoc} it takes one argument and it's delimited with a~space + % probably in resemblance to the true |\input| \nlpercent(|\@@input| in + % \LaTeX). ^^A\if@ltxDocInclude + \clearpage + %^^A\fi + \if@filesw \gmd@writemauxinpaux{#2.\gmd@auxext}\fi% this strange macro with + % a~long name is another spurious thing to allow |_| in the filenames (see + % line \ref{gmd@writemauxinpaux}). which are allowed anyway unless + % active or \cat14. + \@tempswatrue + \if@partsw \@tempswafalse\edef\gmu@tempb{#2}% + \@for \gmu@tempa:=\@partlist\do{\ifx\gmu@tempa\gmu@tempb\@tempswatrue\fi}% + \fi + \if@tempswa% the file is on |\@partlist| + \let\@auxout\@partaux + \if@filesw + \immediate\openout\@partaux #2.\gmd@auxext\relax% Yes, only |#2|. It's to + % create and process the partial \pk{.aux(x)} files always in the main + % document's (driver's) directory. + % \changes[\DocInclude]{v0.97}{06/09/04}{\protect\TeX forced to + % process the partial \pk{.aux}es in the main document directory} + \immediate\write\@partaux{\relax}% + \fi + % \begin{quotation}We need to save (and later restore) various + % index-related commands which might be changed by the included + % file.\end{quotation} + % \changes{v0.98a}{06/09/06}{\cs{MacroStoringDo} renamed (in + % \pk{gmutils}) to \cs{StoringAndRelaxingDo}, and + % \cs{MacroRestoringDo} to \cs{RestoringDo}.} + \StoringAndRelaxingDo\gmd@doIndexRelated + \if@ltxDocInclude\part{\currentfile}% In the \pk{ltxdoc}-like setup + % we make a~part title page with only the filename and the file's + % |\maketitle| will typeset an \pk{article}-like title. + \else\let\maketitle=\InclMaketitle + \fi% In the default setup we + % redefine |\maketitle| to typeset a~common chapter or part heading. + \if@ltxDocInclude\xdef@filekey\fi + \GetFileInfo{\currentfile}% it's my (GM) addition with the account + % of using file info in the included files' title/\:heading etc. + \incl@DocInput{\fullcurrentfile}% originally just |\currentfile|. + \if@ltxDocInclude\else\xdef@filekey\fi% in the default case we add + % new file to the file key \emph{after} the input because in this + % case it's the files own |\maketitle| what launches the + % sectioning command that increases the counter. + % \par And here is the moment to restore the index-related + % commands. + \RestoringDo\gmd@doIndexRelated + % ^^A\if@ltxDocInclude + \clearpage + % ^^A\fi + \gmd@writeckpt{#1#2}% + \if@filesw \immediate\closeout\@partaux \fi + \else% the file isn't on |\@partlist| + \@nameuse{cp@#1#2}% + \g@emptify\gmd@ABIOnce + \fi + \let\@auxout\@mainaux}% end of |\@docinclude|. +\def\xdef@filekey{{\@relaxen\narrativett% \label{LetTTFRelax}This + % assignment is very trickily crafted: it makes \emph{all} + % |\narrativett|s present in the |\filekey|'s expansion unexpandable + % not only the one added in this step. + \xdef\filekey{\filekey, \thefilediv={\narrativett\currentfile}}}} + +\def\gmd@writemauxinpaux#1{% \label{gmd@writemauxinpaux} + % this name comes from `\emph{write} out to \emph main + % \emph{\pk{.aux}} to \emph{in}put \emph partial + % \emph{\pk{.aux}}'.\par + % We wrap |\@input{|\<partial \pk{.aux}>|}| in a~|_|\catother\ + % hacked scope. This hack is especially recommended here since the + % \pk{.aux} file may contain a~non-|\global| stuff that should not + % be localised by a~group that we would have to establish if we + % didn't use the hack. (Hope you understand it. If not, notify me + % and for now I'll only give a~hint: ``Look at it with the \TeX's + % eyes''. More uses of this hack are to be seen in \pk{gmutils} + % where they are a~bit more explained.) + \immediate\write\@mainaux{% + \unexpanded{% + \bgroup + \@makeother\_% to allow underscore + \@makeother\~% to allow paths beginning with |~/| + \firstofone}{\egroup + \string\@input{#1}}}} + +\def\gmd@writeckpt#1{% + \immediate\write\@partaux{% + \unexpanded{% + \bgroup + \@makeother\_% + \@makeother\~% + \firstofone}\@charlb\egroup}% + \@writeckpt{#1}% + \immediate\write\@partaux{\@charrb}} + +\def\gmd@doIndexRelated{% + \do\tableofcontents \do\makeindex \do\EnableCrossrefs + \do\PrintIndex \do\printindex \do\RecordChanges \do\PrintChanges + \do\theglossary \do\endtheglossary} + +\@emptify\filesep +\def\aalph#1{\@aalph{\csname c@#1\endcsname}} +\def\@aalph#1{% + \ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or + j\or k\or l\or m\or n\or o\or p\or q\or r\or s\or + t\or u\or v\or w\or x\or y\or z\or A\or B\or C\or + D\or E\or F\or G\or H\or I\or J\or K\or L\or M\or + N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or + X\or Y\or Z\else\@ctrerr\fi} + +\def\gmd@docincludeaux{% + % We set the things for including the files only once. + \global\@relaxen\gmd@docincludeaux + % By default, we will include multiple files into one document + % as chapters in the classes that provide |\chapter| and as parts + % elsewhere. + \ifx\filediv\relax + \ifx\filedivname\relax% (nor |\filediv| neither + % |\filedivname| is defined by the user) + % \changes[\filediv]{v0.98a}{06/09/06}{definition moved into + % \cs{DocInclude} and let \cs{relax} by default ($\quotechar=$a~bug fix).} + \@ifundefined{chapter}{% + \SetFileDiv{part}}%\changes[\DocInclude]{v0.98f}{06/9/29}{\cs{filediv(name)} + % defined as \cs[]{(\protect\bslash)part} for the classes that + % don't know \cs{chapter}} + {\SetFileDiv{chapter}}% + \else% (|\filedivname| is defined by the user, |\filediv| is not) + \SetFileDiv{\filedivname}% why not? Inside is |\edef| so it'll work. + \fi + \else% (|\filediv| is defined by the user + \ifx\filedivname\relax% and |\filedivname| is not) + %^^A~I~deleted a~six level test which one sectioning command + %^^A~|\filedivname| isx. + \PackageError{gmdoc}{You've redefined \string\filediv\space + without redefining \string\filedivname.}{Please redefine the + two macros accordingly. You may use \string\SetFileDiv{name + without bslash}.}% + \fi + \fi + % \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 + % li\-ne lets |\the|\<chapter> etc.\ equal |\thefilediv|. + \def\filesep{\thefilediv-}% File separator (identifier) for the index. + \let\filekey=\@gobble + \g@addto@macro\index@prologue{% + \gdef\@oddfoot{\parbox{\textwidth}{\strut\footnotesize + \raggedright{\bfseries File Key:} \filekey}}% The footer for + % the pages of index. + \glet\@evenfoot\@oddfoot}% \label{oneside}anyway, it's intended to + % be oneside. + \g@addto@macro\glossary@prologue{% + \gdef\@oddfoot{\strut Change History\hfill\thepage}% The footer + % for the changes history. + \glet\@evenfoot\@oddfoot}% + % \changes[\DocInclude]{v0.98c}{06/9/10}{Change History footer + % 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. + \@xa\ifx\csname ver@\currentfile\endcsname\relax + File \thefilediv: {\narrativett\currentfile} % + \else + \GetFileInfo{\currentfile}% + File \thefilediv: {\narrativett\filename} % + Date: \filedate\ % + Version \fileversion + \fi + \hfill\thepage}% + \glet\@evenfoot\@oddfoot% see line \ref{oneside}. + % ^^A \show\filedivname% for debug + \@xa\def\csname\filedivname name\endcsname{File}% we + % redefine the name of the proper division to `File'. + \ifx\filediv\section + \let\division=\subsection + \let\subdivision=\subsubsection + \let\subsubdivision=\paragraph + % If |\filediv| is higher than + % |\section| we don't change the three divisions (they are + % |\section|, |\subsection| and |\subsubsection| by default). + % |\section| seems to me the lowest reasonable sectioning command + % for the file. If |\filediv| is lower you should rather rethink + % the level of a~file in your documentation not redefine the two + % divisions. + \fi}% end of |\gmd@docincludeaux|. + +\def\SetFileDiv#1{% + \edef\filedivname{#1}% + \@xa\let\@xa\filediv\csname#1\endcsname} + +\def\SelfInclude{\DocInclude{\jobname}} + +\newif\if@ltxDocInclude + +\newcommand*\ltxLookSetup{% + \SetFileDiv{part}% + \ltxPageLayout + \@ltxDocIncludetrue +} + +\@onlypreamble\ltxLookSetup + +\let\incl@DocInput=\DocInput + +\@emptify\currentfile% for the pages outside the + +\newcommand*\olddocIncludes{% + \let\incl@DocInput=\OldDocInput} + +\newcommand*\gmdocIncludes{% + \let\incl@DocInput=\DocInput + \AtBegInput{\QueerEOL}}% to move back the |\StraightEOL| declaration put +\AtBegInput{%^^A~ why provide not just \cs{def}? + \providecommand*\maketitle{\par + \begingroup \def \thefootnote {\fnsymbol {footnote}}% + \setcounter {footnote}\z@ + \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}% + \long\def\@makefntext##1{\parindent 1em\noindent + \hb@xt@1.8em{% + \hss\@textsuperscript{\normalfont\@thefnmark}}##1}% + \if@twocolumn \twocolumn [\@maketitle ]% + \else \newpage \global \@topnum \z@ \@maketitle \fi + \thispagestyle{titlepage}\@thanks \endgroup + \setcounter {footnote}\z@ + \gdef\@date{\today}\g@emptify\@thanks% + \g@relaxen\@author\g@relaxen\@title% + }%\par + % \begin{quotation}When a number of articles are concatenated into + % a~journal, for example, it is not usual for the title pages of + % such documents to be formatted differently. Therefore, a class + % such as \pk{ltugboat} can define this macro in advance. However, + % if no such definition exists, we use page style plain for title + % pages.\end{quotation} + \@ifundefined{ps@titlepage}{\let\ps@titlepage=\ps@plain}{}% + % \par And let's provide |\@maketitle| just in case: an error occurred + % without it at \TeX ing with \pk{mwbk.cls} because this class with the + % default options does not define |\@maketitle|. The below definitions + % are taken from \pk{report.cls} and \pk{mwrep.cls}. + \providecommand*\@maketitle{% + \newpage\null \vskip 2em\relax% + \begin{center}% + \titlesetup + \let \footnote \thanks + {\LARGE \@title \par}% + \vskip 1.5em% + {\large \lineskip .5em% + \begin{tabular}[t]{c}% + \strut \@author + \end{tabular}\par}% + \vskip 1em% + {\large \@date}% + \end{center}% + \par \vskip 1.5em\relax}%\par + % We'd better restore the primary meanings of the macros making + % a~title. (\LaTeXe\ source, File F: ltsect.dtx Date: 1996/12/20 Version + % v1.0z, lines 3.5.7.9--12.14--17.) + \providecommand*\title[1]{\gdef\@title{#1}} + \providecommand*\author[1]{\gdef\@author{#1}} + \providecommand*\date[1]{\gdef\@date{#1}} + \providecommand*\thanks[1]{\footnotemark + \protected@xdef\@thanks{\@thanks + \protect\footnotetext[\the\c@footnote]{#1}}% + }% + \providecommand*\and{%| % \begin{tabular}| + \end{tabular}% + \hskip 1em \@plus.17fil% + \begin{tabular}[t]{c}}%| % \end{tabular}| + % And finally, let's initialise \cs{tit\+le\+set\+up} if it is not yet. + \providecommand*\titlesetup{}% +}% end of |\AtBegInput|. +\@relaxen\filediv +\@relaxen\filedivname +\@relaxen\thefilediv + + +\def\InclMaketitle{% + % \changes{v0.98a}{06/09/05}{renamed from \cs{incl@maketitle} because + % I~needed it in self-input hacks.} + % \chgs{2008/12/10 v0.99s a~bug fixed: \cmd\if\cmd\relax\cmd\@date\ + % changed to \cmd\ifx} + % + {\def\and{, }% we make |\and| just a~comma. + {\let\thanks=\@gobble% for the toc version of the heading we + % discard |\thanks|. + \protected@xdef\incl@titletotoc{% + \@title\@ifauthor{% + \protect\space(\@author)}{}}% we add the author iff the `files have + % different authors' \emph{and} author exists \nlpercent(|@variousauthors|) + }% + \def\thanks##1{\footnotemark + \protected@xdef\@thanks{\@thanks% to keep the previous |\thanks| + % if there were any. + \protect\footnotetext[\the\c@footnote]{##1}}}% for some + % mysterious reasons so defined |\thanks| do typeset the footnote + % mark and text but they don't hyperlink it + % properly. A~\pk{hyperref} bug? + \@emptify\@thanks + \protected@xdef\incl@filedivtitle{% + [{\incl@titletotoc}]% braces to allow |[| and + % |]| in the title to toc. + {\protect\@title + {\protect\smallerr% this macro is provided by the \pk{gmutils} + % package after the \pk{relsize} package. + \@ifauthor + {\protect\\[0.15em]\@nx\@author + \ifx\relax\@date\else, \fi}% after use, |\@date| is let to + % \incmd\relax. + {\ifx\relax\@date\else\protect\\[0.15em]\fi} + % The default is that all the included files have the same + % author(s). In this case we won't print the author(s) in + % the headings. Otherwise we wish to print them. The + % information which case are we in is brought by the + % |\if@variousauthors| switch defined in line \ref{@variousauthors}. + \protect\@date}}% end of |\incl@filedivtitle|'s brace (2nd + % or 3rd argument). + }% end of |\incl@filedivtitle|'s |\protected@xdef|.\par + % We |\protect| all the title components to avoid expanding + % |\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. + \@xa\filediv\incl@filedivtitle + \@thanks + \g@relaxen\@author \g@relaxen\@title \g@relaxen\@date + \g@emptify\@thanks +}% end of |\InclMaketitle|. + + +\newif\if@variousauthors + +\newcommand*\PrintFilesAuthors{\@variousauthorstrue} +\newcommand*\SkipFilesAuthors{\@variousauthorsfalse} + +\def\@ifauthor{%\ + % \begin{enumargs} + % \item what if true + % \item what if false + % \end{enumargs} + \ifnum\numexpr\if@variousauthors1\else0\fi* + \ifx\@author\relax0\else\ifx\@author\@empty0\else1\fi\fi>0 + \@xa\@firstoftwo + \else + \@xa\@secondoftwo + \fi +} + + +\def\GetFileInfo#1{% + \def\filename{#1}% + \def\gmu@tempb##1 ##2 ##3\relax##4\relax{% + \def\filedate{##1}% + \def\fileversion{##2}% + \def\fileinfo{##3}}% + \edef\gmu@tempa{\csname ver@#1\endcsname}% + \@xa\gmu@tempb\gmu@tempa\relax? ? \relax\relax} + + +\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} + +\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 +!gmd@writeFI(#2)(#3)(#5)% +!gmd@FIrescan(#1Provides#2{#3}#4[#5]#6)% this macro will close the group. +)% \CodeEscapeChar\\ +) + +\def\gmd@writeFI#1#2#3{% + % ^^A \typeout{@@@ write FI}\show\relax + {\newlinechar=\endlinechar% \chgs{2008/11/30 v0.99s added assignment + % of \cmd\newlinechar} + \immediate\write\@auxout{% + \global\@nx\@namedef{% + ver@#2.\if P\@firstofmany#1\@nil sty\else cls\fi}{#3}}}} + +\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=\endlinechar\scantokens{#1}}\egroup^^M}} + + +\def\ProvideFileInfo#1{% + \begingroup + \catcode`\ 10 \catcode\endlinechar 10 % + \@makeother\/\@makeother\&% + \kernel@ifnextchar[{\gmd@providefii{#1}}{\gmd@providefii{#1}[]}%^^A] + } + + % \DefIndex\gmd@providefii +\def\gmd@providefii#1[#2]{%\\ + % (we \emph{don't} write the file info to \pk{.log}) + \@xa\xdef\csname ver@#1\endcsname{#2}% + \endgroup} + +\def\ProvideSelfInfo{\ProvideFileInfo{\jobname.tex}} + + +\def\gmd@upperDIV#1{% + \if d#1D\fi + \if i#1I\fi + \if v#1V\fi +} + +\def\edefInfo +#1% name +#2% datum +{% + \edef\gmd@edefInfo@resa{\gmd@upperDIV #2}% + \@nameedef{file#2}{% + \ifcsname #1Leaf\gmd@edefInfo@resa\endcsname % e.g.~|gmbaseLeafVersion| + \xA\xA\xA\detokenize\xA\xA\xA{% + \csname #1Leaf\gmd@edefInfo@resa\endcsname + }% + \else + \ifcsname #1\gmd@edefInfo@resa\endcsname % e.g.~|gmbaseVersion| + \xA\xA\xA\detokenize\xA\xA\xA{% + \csname #1\gmd@edefInfo@resa\endcsname + }% + \else + \ifcsname \gmBundleFile \gmd@edefInfo@resa\endcsname % e.g.~|gmutilsVersion| + \xA\xA\xA\detokenize\xA\xA\xA{% + \csname \gmBundleFile \gmd@edefInfo@resa\endcsname + }% + \fi + \fi + \fi + }% of edefined macro +}% of |\edefInfo| + +\def\FileInfoFromName#1{% + \edefInfo{#1}{date}% + \edefInfo{#1}{version}% + \edefInfo{#1}{info}% + \def\GeneralName{#1\actualchar\pk{#1} }% for the changes' history. +} + +\def\BundleInfoFromName#1{% + \def\gmBundleFile{#1}% + \Store@MacroSt {#1LeafDate}% + \Store@MacroSt {#1LeafVersion}% + \Store@MacroSt {#1LeafInfo}% + \n@melet{#1LeafDate}{@undefined}% + \n@melet{#1LeafVersion}{@undefined}% + \n@melet{#1LeafInfo}{@undefined}% + \FileInfoFromName{#1}% + \Restore@MacroSt {#1LeafDate}% + \Restore@MacroSt {#1LeafVersion}% + \Restore@MacroSt {#1LeafInfo}% +} + +\pdef\filenote{This file has version number \fileversion{} dated \filedate{}.} +\pdef\thfileinfo{\thanks\filenote} + +\pdef\fnfileinfo{% + \gmu@ifedetokens{\@currext}{toc}% + {}% + {\footnote\filenote}% +} + +\foone{\obeylines}% +{% + \pdef\IndexInput#1{% \changes{v0.98b}{06/09/07}{\cs{StoreMacro}ing + %% and \cs{RestoreMacro}ing + % \cs{code@delim} added} + \Store@Macro\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}\Restore@Macro\code@delim}% +} +\newenvironment{gmlonely}{\StraightEOL}{} + +\newcommand\skipgmlonely[1][]{% + \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. + \setbox0=\vbox\bgroup}{\egroup\gmd@skipgmltext}} + + +\foone{\catcode`\_=8 }% we ensure the standard |\catcode| of |_|. +{% + \newcommand*\catother{${}_{12}$}%\par + % Similarly, if we need to say some char is of category 13 (`active'), + % we'll write \catactive, got by |\catactive| + \newcommand*\catactive{${}_{13}$}%\par + % and a~letter, \catletter + \newcommand*\catletter{${}_{11}$}%. +} +\newenvironment*{copyrnote}{% + \StraightEOL\everypar{\hangindent3em\relax\hangafter1 }% + \par\addvspace\medskipamount\parindent\z@\obeylines}{% + \@codeskipputgfalse\stanza} +\StoreEnvironment{quotation} +\def\gmd@quotationname{quotation} +\renewenvironment{quotation}{% + % \changes{v0.99j}{2008/08/03}{Improved behaviour of redefined + % \env{quotation} to be the original if used by another environment.} + % The first non-me user complained that \env{abstract} comes out in + % quotation marks. That is because \env{abstract} uses \env{quotation} + % internally. So we first check whether the current environment is + % \env{quotation} or something else. + \ifx\@currenvir\gmd@quotationname + \afterfi{\par``\ignorespaces}% + \else\afterfi{\storedcsname{quotation}}% + \fi} +{\ifx\@currenvir\gmd@quotationname + \afterfi{\ifhmode\unskip\fi''\par}% + \else\afterfi{\storedcsname{endquotation}}% + \fi} + +\def\gmdnoindent{% + \ifvmode\leavevmode\hskip-\parindent\ignorespaces + \fi}% \incs{ignorespaces} is added to eat a~space inserted% by +\pdef\inverb{% + % \changes{v0.99g}{2007/11/12}{added} + \gmu@ifstar{% + \def\gmu@tempa{\verbhyphen}% the pre-break. + \@emptify\gmu@tempb% the no-break. + \gmd@inverb}% + {\@emptify\gmu@tempa% the pre-break empty + \def\gmu@tempb{\gmboxedspace}% the no-break boxed space. + \gmd@inverb}} + +\newcommand*\gmboxedspace{\hbox{\normalfont{ }}} + +\pdef\gmd@nlperc{% \changes{v0.99n}{2008/08/22}{% added + % \cs{hbox}es in \cs{discretionary} to score \cs{hyphenpenalty} not + % \cs{exhyphenpenalty}} + % \chgs{2008/12/06 v0.99s \cs{newcommand*} replaced with \cs{pdef} + % and optional argument's declaration removed since nothing is done + % to \texttt{\#1} in the body of now-macro. Wrapped in a~group for + % setting \cmd\hyphenpenalty} + \ifhmode\unskip\fi + \begingroup\hyphenpenalty\inverbpenalty\relax + \discretionary{\hbox{\gmu@tempa}}% (pre-break). I~always put + % a~\incs{hbox} here to make this discretionary score the + % \incs{hyphenpenalty} not \incs{exhyphenpenalty} (\TB\ p.~96) since + % the latter may be 10,000 in Polish typesetting. + {\hbox{\narrationmark}}% (post-break) + {\gmu@tempb}% (no-break). + \endgroup + \penalty10000\hskip0sp\relax} + +\def\inverbpenalty{-1000} + +\pdef\gmd@inverb{% + \gmd@nlperc + \ifmmode\hbox\else\leavevmode\null\fi + \bgroup + \ttverbatim + \narrativett + \def\breakablevisspace{% + \discretionary{\visiblespace}{\narrationmark}{\visiblespace}}% + \def\breakbslash{% + \discretionary{}{\narrationmark\type@bslash}{\type@bslash}}% + \def\breaklbrace{% + \discretionary + {\xiilbrace\verbhyphen}% + {\narrationmark}% + {\xiilbrace}}% + \gm@verb@eol + %^^A \gmu@ifstar {\@sverb@chbsl} + %^^A~ {\gmobeyspaces\frenchspacing\@sverb@chbsl} + \@sverb@chbsl% It's always with visible spaces. +} + +\pdef\nlperc{\newline\narrationmark\ignorespaces} + +\pdef\nlpercent{% + % ^^A \gmu@ifstar{\def\gmu@tempa{{\tt\xiipercent}}% + % ^^A \@emptify\gmu@tempb + % ^^A \gmd@nlperc}% + % ^^A { + % \chgs{200/12/7 v0.99s starred version discarded as never used and + % undocumented} + % \UnDef + \@emptify\gmu@tempa + \def\gmu@tempb{\gmboxedspace}% + \gmd@nlperc + % ^^A} +} + +\pdef\incs{% an in-line \cs{cs} + % \changes{v0.99m}{008/08/07}{added} + % \chgs{200/12/7 v0.99s starred version discarded as never used and + % undocumented} + % ^^A \gmu@ifstar{\def\gmu@tempa{{\tt\xiipercent}}% + % ^^A \@emptify\gmu@tempb + % ^^A \gmd@nlperc\cs}% + % ^^A { + % \UnDef + \@emptify\gmu@tempa + \def\gmu@tempb{\gmboxedspace}% + \gmd@nlperc\cs + % ^^A} +} + +\def\inenv{\incs[]}% an in-line \cs{env} + +\def\incmd{% it has to be |\def| to let it expand to let \incmd\cmd\ + % convert its argument to a~safe string. + \nlpercent\cmd} + +\def\inhash{\nlpercent\hash} + + +\@xa\ampulexdef\csname\@dc@InnerName\cs\endcsname +[#1] [#1] {\begingroup} {\ifdefined} +{\begingroup \def\+{\discre{\gmv@hyphen}{\narrationmark}{}}% + \ifdefined} + + +\providecommand*\ds{DocStrip} + + +\newcommand*\CDAnd{\CodeDelim\&} + +\newcommand*\CDPerc{\CodeDelim\%} + +\let\division=\section + +\let\subdivision=\subsection + +\let\subsubdivision=\subsubsection +\newcounter{gmd@mc} + +\def\gmd@mchook{\stepcounter{gmd@mc}% \label{gmd@mchook} + \gmd@mcdiag + \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}} + +\@emptify\gmd@mcdiag + +\def\mcdiagOn{\def\gmd@mcdiag{% + \typeout{^^J\bslash end{\gmd@lastenvir} No.\the\c@gmd@mc + \space\on@line, cln.\the\c@codelinenum.}}} + +\def\mcdiagOff{\@emptify\gmd@mcdiag} +\DeclareEnvironment{enumargs}{o}%\ +{% + \StraightEOL + \if@aftercode + \edef\gmu@tempa{\the\leftskip}% + \edef\gmu@tempb{\the\hangindent}% + \fi + \enumerate + \if@aftercode + \leftskip=\glueexpr\gmu@tempa+\gmu@tempb\relax + \fi + \edef\gmd@ea@hashes{% + \#\ifcase\IfValueTF{#1}{#1}{1}\relax + \or\or\#\or\or\#\#\#\fi}% + %\stanza + \@namedef{label\@enumctr}{% + \env{\if@aftercode\narrationmark\fi + \relax% to stop |\ignorespaces| + \gmd@ea@bwrap + \gmd@ea@hashes + \csname the\@enumctr\endcsname + \gmd@ea@ewrap}}% of |\label⁄<@enumctr>|. + \let\mand\item + \provide\gmd@ea@wraps{% + \emptify\gmd@ea@ewrap + \emptify\gmd@ea@bwrap}% + \gmd@ea@wraps + \def\opt{%\HideDef + \def\gmd@ea@bwrap{[}\def\gmd@ea@ewrap{]}% + \item + \gmd@ea@wraps}% + %\stanza + \settowidth{\@tempdima}{\narrativett x\gmd@ea@hashes7x}% + \edef\gmd@ea@xxxwd{\the\@tempdima}% + %\stanza + \DeclareCommand\dc !{% + Q{*>} % (1) we check whether there's a~sergeant right of the prefix or + % a~star to suppress parentheses, + Q{P!lL\long iI} % (2) an optional ‘bare’ prefix for a~‘long’ argument + % or for ignored + b % (3) prefix(es) in curly braces + % ( % This way we allow the prefix(es) to be braced or not + % at the author's option), + >\@xa T{\@dc@argtypes} % (4) (optional) argument type + % specifier, + b % (5) (optional) default value of the specified argument or + % (for |K| and |G|) mandatory. + b % (6) default of |K| and |G|. + }{% + \gmu@ifxany *{##1}% + {% a~|*| suppresses bracket/brace/parentheses decoration. + \def\gmd@ea@bwrap{\hbox to \gmd@ea@xxxwd\bgroup\hss}% + \def\gmd@ea@ewrap{\hss\egroup}% + }% + {% if there's no |*| in \hash1, be wrap the item label in + % braces/brackets/parentheses. + \gmu@ifxany ##4{bB}{% I~decide not to print |m| type + % arguments in braces because the braces are not mandatory for + % this type. + \def\gmd@ea@bwrap{\{}% + \def\gmd@ea@ewrap{\}}% + }{}% + \gmu@ifxany ##4{cC}{% + \def\gmd@ea@bwrap{(}% + \def\gmd@ea@ewrap{)}% + }{}% + \gmu@ifxany ##4{oO}{% + \def\gmd@ea@bwrap{[}% + \def\gmd@ea@ewrap{]}% + }{}% + \gmu@ifxany ##4{G}{% + \def\gmd@ea@bwrap{\detokenize\@xa{\@firstoftwo##5}}% + \def\gmd@ea@ewrap{\detokenize\@xa{\@secondoftwo##5}}%% + }{}% + \gmu@ifxany ##4{A}{% + \def\gmd@ea@bwrap{<}% + \def\gmd@ea@ewrap{>}% + }{}% + }% of if no |*| in \hash1. + \gmu@ifxany ##4{mQsSTK\afterassignment}{% + \def\gmd@ea@bwrap{\hbox to \gmd@ea@xxxwd\bgroup\hss}% + \def\gmd@ea@ewrap{\hss\egroup}% + }{}% + % we add a~normal space + \addtomacro\gmd@ea@ewrap{{\normalfont\ }}% + \IfValueT{##2}{% + \addtomacro\gmd@ea@ewrap{>\{\string##2\}}}% + \IfValueT{##3}{% + \addtomacro\gmd@ea@ewrap{>\{##3\}}}% + \IfValueT{##4}{% + \ifx s##4% + \addtomacro\gmd@ea@ewrap{% + \llap{\metachar[}\scanverb{*}\metachar]}% + \else\addtomacro\gmd@ea@ewrap{##4}% + \fi}% + \IfValueT{##5}{% + \addtomacro\gmd@ea@ewrap{\{% + %\nostanza|%\ttverbatim| breakable chars won't work because we are in + % the item's label's \incmd\hbox. \nostanza + \scanverb*{##5}% + \}}}% + \IfValueT{##6}{% + \addtomacro\gmd@ea@ewrap{\{% + %\nostanza|%\ttverbatim| breakable chars won't work because we are in + % the item's label's \incmd\hbox. \nostanza + \scanverb*{##6}% + \}}}% + \def\gmd@blubra{% + \addtomacro\gmd@ea@bwrap{% + \begingroup + \relaxen\gmd@ea@hashes + \@namedef{the\@enumctr}{\<ign.>}% + }% + \prependtomacro\gmd@ea@ewrap{% + \endgroup}% + \addtomacro\gmd@ea@ewrap{% + \global \advance \csname c@\@enumctr\endcsname \m@ne + }% + \emptify\gmd@blubra + }% + \gmu@ifsbintersect {##2}{Ii}{\gmd@blubra}{}% + \gmu@ifsbintersect {##3}{Ii}{\gmd@blubra}{}% + \gmu@ifxany ##4{\afterassignment}{\gmd@blubra}{}% + \item\relax}% + % \stanza + \IfNoValueT{#1}{\@ifnextac\@gobble{}}% to gobble a~possible active line end or + % active \hathat{A} or \hathat{B} that might + % have occurred because of \incmd\futurelet\ of the optional + % argument checker. + }% of begin definition \ResumeDef +{\endenumerate} + +\newenvironment*{enumargs*}{% + \def\gmd@ea@wraps{% \HideDef + \def\gmd@ea@bwrap{ }\def\gmd@ea@ewrap{ }}% \ResumeDef + \enumargs}{\endenumargs} + + +\def\CharacterTable{\begingroup + \@makeother\{\@makeother\}% + \Character@Table} + +\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]% + %^^A~\gmd@countlines[#1]\gmd@countlines[#2] + ]] +\outer\def\DescribeMacro{% + \@bsphack + \begingroup\MakePrivateLetters + \gmd@ifonetoken\Describe@Macro\Describe@Env} +\outer\def\DescribeEnv{% + \@bsphack + \begingroup\MakePrivateOthers\Describe@Env} + +\outer\def\Describe{% It doesn't typeset its argument in the point of + % occurrence. + \leavevmode + \@bsphack + \begingroup\MakePrivateLetters + \gmu@ifstar{\MakePrivateOthers\Describe@Env}{\Describe@Macro}} + +\long\def\Describe@Macro#1{% + \endgroup + \strut\Text@Marginize*{#1}% + \@usgentryze#1% we declare kind of formatting the entry + \text@indexmacro#1% + \@esphack} + +\def\Describe@Env#1{% + \endgroup + \strut\Text@Marginize*{#1}% + \@usgentryze{#1}% we declare the `usage' kind of + % formatting the entry and index the sequence |#1|. + \text@indexenvir{#1}% + \@esphack} + + +\let\MacroFont\tt + +\let\MacroIndent\CodeIndent +\let\MacrocodeTopsep\CodeTopsep +\let\SpecialEscapechar\CodeEscapeChar + + +\AtEndInput{\@ifundefined{theCodelineNo}{}{\PackageInfo{gmdoc}{The + \string\theCodelineNo\space macro has no effect here, please use + \string\LineNumFont\space for setting the font and/or + \string\thecodelinenum\space to set the number format.}}} +\def\noeffect@info#1{\@ifundefined{#1}{}{\PackageInfo{gmdoc}{^^J% + The \bslash#1 macro is not supported by this package^^J + and therefore has no effect but this notification.^^J + If you think it should have, please contact the maintainer^^J + indicated in the package's legal note.^^J}}} + +\AtEndInput{% + \noeffect@info{PrintDescribeMacro}% + \noeffect@info{PrintMacroName}% + \noeffect@info{PrintDescribeEnv}% + \noeffect@info{PrintEnvName}} + +\def\CodelineNumbered{\AtBeginDocument{\gag@index}} +\@onlypreamble\CodelineNumbered +\let\CodelineIndex\@pageindexfalse +\@onlypreamble\CodelineIndex + +\let\PageIndex\@pageindextrue +\@onlypreamble\PageIndex + +\def\DisableCrossrefs{\@bsphack\gag@index\@esphack} + +\def\EnableCrossrefs{\@bsphack\ungag@index + \def\DisableCrossrefs{\@bsphack\@esphack}\@esphack} +\newcommand*\AlsoImplementation{\@bsphack + \long\def\StopEventually##1{\gdef\Finale{##1}}% we define + % \incs{Fi\+n\+a\+le} just to expand to the argument of \incs{StopEventually} not + % to to add anything to the end input hook because \incs{Finale} should + % only be executed if entire document is typeset.\nostanza\par + % + % \hangindent\verbatimhangindent \hangafter1\relax + % \gmdnoindent \leftskip\CodeIndent + % |%\init@checksum| is obsolete in + % \pk{gmdoc} at this point: the \env{CheckSum} counter is reset just at + % the beginning of (each of probably numerous) input(s). + % \nostanza\par + \@esphack} + +\AlsoImplementation + + +\def\OnlyDescription{\@bsphack\long\def\StopEventually##1{% + % \begin{quotation} In this case the argument of |\StopEventually| + % should be set and afterwards \TeX\ should stop reading from + % this file. Therefore we finish this macro with\end{quotation} + ##1ⵢendinput}\@esphack} + + +\@relaxen\Finale + +\let\SpecialMainIndex=\DefIndex + +\def\SpecialMainEnvIndex{\csname CodeDefIndex\endcsname*}% we don't + +\let\SpecialIndex=\CodeCommonIndex + +\let\SpecialUsageIndex=\TextUsgIndex + +\def\SpecialEnvIndex{\csname TextUsgIndex\endcsname*} + +\def\SortIndex#1#2{\index{#1\actualchar#2}} +\def\verbatimchar{&} + + + +\@ifundefined{main}{}{\let\DefEntry=\main} + +\@ifundefined{usage}{}{\let\UsgEntry=\usage} + +\newcounter{StandardModuleDepth} + +\noeffect@info{DocstyleParms} + +\@emptify\DontCheckModules \noeffect@info{DontCheckModules} +\@emptify\CheckModules \noeffect@info{CheckModules} +\@emptify\AltMacroFont \noeffect@info{AltMacroFont} + +\def\MakePercentIgnore{\catcode`\%9\relax} +\def\MakePercentComment{\catcode`\%14\relax} +\def\OldDocInput{% \changes{v0.99g}{2007/11/11}{obsolete redefinition + % of the \env{macro} environment removed} + \AtBegInputOnce{\StraightEOL + \let\@MakeShortVerb=\old@MakeShortVerb + % \label{oldmkshvrrb} + \OldMacrocodes}% + \bgroup\@makeother\_% it's to allow |_| in the filenames. The next + % macro will close the group. + \Doc@Input} +%% \AVerySpecialMacro % delete the first % when.\unskip|..|\CDPerc + +\DeclareCommand\OCRInclude{O{}mO{}}{% + \Store@Macro\incl@DocInput + \def\incl@DocInput##1{% + \begingroup + \CodeSpacesBlank + \@beginputhook + \title{\currentfile}\maketitle + \noverbatimspecials + \relaxen\@xverbatim + \relaxen\check@percent + \Restore@Macro\@verbatim + \verbatimleftskip\z@skip + \verbatim + \@makeother\|% because |\ttverbatim| doesn't do that. + \texcode@hook% we add some special stuff, e.g.\ in \pk{gmdocc.cls} we + \@input{##1}% + \endgroup}% + \csname\@dc@InnerName\DocInclude\endcsname{#1}{#2}{#3}% + \Restore@Macro\incl@DocInput +} + + +\foone{\catcode`\^^M\active }{% + \def\@NoEOF#1^^M{% + \@relaxen\EOFMarkⵢendinput}% + \def\@EOF#1^^M{ⵢendinput}} + +\def\NoEOF{\QueerEOL\@NoEOF} +\def\EOF{\QueerEOL\@EOF} +\endinput +%% +%% End of file `gmdoc.sty'. diff --git a/macros/latex/contrib/gmdoc/gmdocc.cls b/macros/latex/contrib/gmdoc/gmdocc.cls new file mode 100644 index 0000000000..befb51f531 --- /dev/null +++ b/macros/latex/contrib/gmdoc/gmdocc.cls @@ -0,0 +1,340 @@ +%% +%% \iffalse ^^A we skip the debug setting +\IfFileExists{\string~/bin/gen_and_xela}{\errorcontextlines=1000 }{} +%% \fi +%% ^^A $Id: TheUltimateMaster.gmd,v 0.298 2011/02/02 18:35:58 natror Exp natror $ +%% This is file “gmdocc.cls” generated with the DocStrip utility. +%% +%% +%% The original source files were: +%% +%% gmdoc/gmdoc.gmd (with options: `docc') +%% +%% +%% Copyright © +%% by Grzegorz ‘Natror’ Murzynowski +%% natror (at) gmail (dot) com +%% +%% This program is subject to the LaTeX Project Public License. +%% See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html +%% for the details of that license. +%% +%% LPPL status: "author-maintained". +%% +%% +%% +%% For the documentation please refer to the file(s) +%% gmdoc.{gmd,pdf}. +%% +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{gmdocc} + [2010/08/15 v0.993 a class for gmdoc driver files (GM)] + + +%% +%% +%% This file is a~part of \pk{gmdoc} bundle and provides a~document +%% class for the driver files documenting \LaTeXpar\ packages \&a.\ +%% with my \pk{gmdoc.sty} package. It's not necessary, of course: most +%% probably you may use another document class you like. +%% +%% By default this class loads \pk{mwart} class with a4paper (default) +%% option and \pk{lmodern} package with T1 fontencoding. It loads also +%% my \pk{gmdoc} documenting package which loads some auxiliary +%% packages of mine and the standard ones. +%% +%% If the \pk{mwart} class is not found, the standard \pk{article} +%% class is loaded instead. Similarly, if the \pk{lmodern} is not +%% found, the standard Computer Modern font family is used in the +%% default font encoding. +%% + +\PassOptionsToPackage{rgb}{xcolor} + +\RequirePackage{xkeyval} + +\newcommand*\gm@DOX{\DeclareOptionX[gmcc]<>} +\newcommand*\gm@EOX{\ExecuteOptionsX[gmcc]<>} + +\newif\ifgmcc@mwcls + +\gm@DOX{class}{% the default will be Marcin Woli\nacute ski class + % (\pk{mwcls}) analogous to \pk{article}, see line \ref{EOXmwart}. + \def\gmcc@CLASS{#1}% + \@for\gmcc@resa:=mwart,mwrep,mwbk\do {% + \ifx\gmcc@CLASS\gmcc@resa\gmcc@mwclstrue\fi}% +} + +\gm@DOX{mwart}{\gmcc@class{mwart}}% The \pk{mwart} class may also + +\gm@DOX{mwrep}{\gmcc@class{mwrep}}% If you need + +\gm@DOX{mwbk}{\gmcc@class{mwbk}}% and this MW class + +\gm@DOX{article}{\gmcc@class{article}}% you can also + +\gm@DOX{outeroff}{\let\outer\relax}% This option allows + +\newif\if@debug + +\gm@DOX{debug}{\@debugtrue}% This option causes \pk{trace} to + +\gm@DOX{noindex}{% + \PassOptionsToPackage{noindex}{gmdoc}}% This + +\newif\if@gmccnochanges + +\gm@DOX{nochanges}{\@gmccnochangestrue}% This option turns the + + +\newif\ifgmcc@oldfonts + +\gm@DOX{sysfonts}{\gmcc@oldfontsfalse} + +\gm@DOX{mptt}[17]{\relax}% now a~no-op, left only for backwards + +\def\gmcc@tout#1{\typeout{^^J@@@@ gmdocc class: #1^^J}} + +\def\gmcc@setfont#1{% + \gmcc@oldfontsfalse% note that if we are not in \XeTeX, this switch + % will be turned true in line \ref{ofstrue} + \AtEndOfClass{% + \ifdefined\zf@init\afterfi{% + \gmcc@tout{Main font set to #1}% + \def\gmcc@dff{Numbers={OldStyle, Proportional}} + \@xa\setmainfont\@xa[\gmcc@dff, Mapping=tex-text]{#1}% + % ^^A \setsansfont[Mapping=tex-text]{Latin Modern Sans}% + % ^^A \gmcc@tout{Sans serif font set to Latin Modern Sans}% + % ^^A \setmonofont{Latin Modern Mono}% + % \chgs{2008/12/01 v0.82 I~commented out setting of Latin Modern + % fonts for sans serif and monospaced: \XeTeX\discret/\pk{fontspec} + % does that by default.} + % ^^A \def\sl{\it} \def{\textsl}\textit% we cover original \incs{sl} + % ^^A % and \incs{textsl} with \incs{def} to allow consistent font + % ^^A % change later. + \@xa\defaultfontfeatures\@xa{\gmcc@dff, Scale=MatchLowercase}%\ + % when put before \incs{setmainfont}, + \gmath + \def\LineNumFont{% \chgs{2008/11/30 v0.82 added} + \normalfont\scriptsize\addfontfeature{Numbers=Monospaced}}% + }% + \else\afterfi{\gmcc@tout{I~can set main font to #1 only in + XeTeX/fontspec}}% + \fi + }} + +\gm@DOX{minion}{\gmcc@setfont{Minion Pro}} +\gm@DOX{pagella}{\gmcc@setfont{TeX Gyre Pagella} + % ^^A \def\gmcc@PAGELLA{1}% caused an error +} +\gm@DOX{cronos}{% \chgs{2008/12/01 v0.82 added, for Iwona sans font} + \AtEndOfClass{\setsansfont[Mapping=tex-text]{Cronos Pro}}} +\gm@DOX{trebuchet}{% \chgs{2008/12/03 v0.82 added, for Trebuchet + % \ac{MS} sans font} + \AtEndOfClass{\setsansfont[Mapping=tex-text]{Trebuchet MS}}} +\gm@DOX{myriad}{% \chgs{2008/12/03 v0.82 added, for Myriad Web Pro + % sans font} + \AtEndOfClass{\setsansfont[Mapping=text-text]{Myriad Web Pro}}} +\gm@DOX{lsu}{% \chgs{2008/12/03 v0.82 added, for Lucida Sans Unicode + % sans font} + \AtEndOfClass{\setsansfont[Mapping=tex-text]{Lucida Sans Unicode}}} + +\gm@DOX{cursor}{% \chgs{2008/12/01 v0.82 added, for \TeX\ Gyre Cursor + % mono font, which I~embolden a~little and shrink + % horizontally a~little} + % \chgs{2008/12/12 v0.82 subtly distinguished weights of + % the \TeX\ Gyre Cyursor typewriter font in the code + % and in verbatims in the commentary} + \AtEndOfClass{% + \setmonofont[FakeBold=2.5, BoldFeatures={FakeBold=0}, + FakeStretch=0.87, Ligatures=NoCommon + ]{TeX Gyre Cursor}% + \def\marginpartt{\tt\addfontfeature{FakeBold=2, + FakeStretch=0.609}% + \color{black}}% to provide proper color when marginpar occurs + % between lines that break a~coloured text. + \def\narrativett{\ttfamily\addfontfeature{FakeBold=1}}% + \let\UrlFont\narrativett + }% of |\AtEndOfClass|. +}% of the |cursor| option. + +\gm@DOX{fontspec}{\PassOptionsToPackage{#1}{fontspec}} + +\gm@EOX{class=mwart}% \label{EOXmwart}We set the default basic class to + + +\newif\if@gmcc@tikz@ +\gm@DOX{tikz}{\@gmcc@tikz@true} + +\PassOptionsToPackage{countalllines}{gmdoc}% \chgs[countalllines]{2008/11/30 + +\DeclareOptionX*{\PassOptionsToPackage{\CurrentOption}{gmdoc}} + +\ProcessOptionsX[gmcc]<> + +\long\def\@gobble#1{} +\long\def\@firstofone#1{#1} + +\if@gmcc@tikz@\expandafter\@firstofone\else\expandafter\@gobble\fi +{\RequirePackage{tikz}} + +\XKV@ifundefined{ifSecondClass}{% + \newif\ifSecondClass}{} + +\ifSecondClass\else +\ifgmcc@mwcls + \IfFileExists{\gmcc@CLASS.cls}{}{\gmcc@mwclsfalse}% As + % announced, we do the ontological test to any \pk{mwcls}. +\fi +\ifgmcc@mwcls + \LoadClass[fleqn, oneside, noindentfirst, 11pt, withmarginpar, + sfheadings]{\gmcc@CLASS}% +\else + \LoadClass[fleqn, 11pt]{article}% Otherwise the standard \pk{article} is + % loaded. +\fi +\fi + +\RequirePackage[mw=on]{gmutils}[2008/10/08]% we load it early to provide + +\ifgmcc@mwcls\afterfi\ParanoidPostsec\fi + +\@ifXeTeX{}{\gmcc@oldfontstrue} + +\AtBeginDocument{\mathindent=\CodeIndent} + +\ifgmcc@oldfonts + \IfFileExists{lmodern.sty}{% We also examine the ontological status of + % this package + \RequirePackage{lmodern}% and if it shows to be satisfactory (the + % package shows \emph{to be}), we load it and set the proper + % font encoding. + \RequirePackage[T1]{fontenc}% + }{}% + \def\agrave {\`a}% + \def\cacute {\'c}% + \def\eacute {\'e}% + \def\idiaeres{\"\i}% + \def\nacute {\'n}% + \def\ocircum {\^o}% + \def\oumlaut {\"o}% + \def\uumlaut {\"u}% +\else% this case happens only with \XeTeX. + \let\do\relaxen + \do\Finv\do\Game\do\beth\do\gimel\do\daleth% these five caused the + % `already defined' error. + \let\@zf@euenctrue\zf@euencfalse + \XeTeXthree% + \def\agrave {\char"00E0 }% + \def\cacute {\char"0107 }% Note the space to be sure the number + % ends here. + \def\eacute {\char"00E9 }% + \def\idiaeres{\char"00EF }% + \def\nacute {\char"0144 }% + \def\oumlaut {\char"00F6 }% + \def\uumlaut {\char"00FC }% + \def\ocircum {\char"00F4 }% + \AtBeginDocument{% + \def\ae{\char"00E6 }% + \def\l {\char"0142 }% + \def\oe{\char"0153 }% + }% +\fi + +\RequirePackage{geometry} +\def\gmdoccMargins@params{{top=77pt, height=687pt, % =53 lines but the + % |lines| option seems not to work 2007/11/15 with \TeX\ Live 2007 + % and \XeTeX 0.996-patch1 + left=4cm, right=2.2cm}} +\def\gmdoccMargins{% + \@xa \newgeometry\gmdoccMargins@params} + +\@xa\geometry\gmdoccMargins@params + +\if@debug% For debugging we load also the \pk{trace} package that was + \RequirePackage{trace}% + \errorcontextlines=100 % And we set an error info parameter. +\fi + +\newcommand*\ifdtraceon{\if@debug\afterfi\traceon\fi} +\newcommand*\ifdtraceoff{\if@debug\traceoff\fi} + +\RequirePackage{gmdoc} + +\ifgmcc@oldfonts + \@ifpackageloaded{lmodern}{% The Latin Modern font family provides + % a~light condensed typewriter font that seems to be the most + % suitable for the marginpar CS marking. + \def\marginpartt{\normalfont\fontseries{lc}\ttfamily}}{}% +\else + \def\marginpartt{\fontspec{LMTypewriter10 LightCondensed}}% +\fi + + +\raggedbottom + +\setcounter{secnumdepth}{0}% We wish only the parts and chapters to be + +\renewcommand*\thesection{\arabic{section}}% isn't it redundant at the + +\@ifnotmw{} +{% if MW class + \@ifclassloaded{mwart} + {% We set the indentation of Contents: + \SetTOCIndents{{}{\quad}{\quad}{\quad}{\quad}{\quad}{\quad}}% + } + {% for \pk{mwart} …\ilrr + \SetTOCIndents{{}{\bf9.\enspace}{\quad}{\quad}{\quad}{\quad}{\quad}}% + }% and for the two other \pk{mwcls}s. \ilrr + \pagestyle{outer}}% We set the page numbers to be printed in the + +\def\titlesetup{\bfseries\sffamily}% We set the title(s) to be + +\if@gmccnochanges\let\RecordChanges\relax\fi% If the |nochanges| + +\RecordChanges% We turn the writing the |\changes| out to the + +\RequirePackage{amsfonts} +\RequirePackage[intlimits]{amsmath} +\RequirePackage{amssymb} + +\dekclubs*% We declare the club sign \verb+|+ to be a~shorthand for +\edverbs% to redefine |\[| so that it puts a~shortverb in a~|\hbox|. +\smartunder% and we declare the |_| char to behave as usual in the + +\exhyphenpenalty\hyphenpenalty% 'cause \pk{mwcls} set it |=10000| due + +\def\EOFMark{\rightline{\ensuremath{\square}}} + +\DoNotIndex{\@nx \@xa %^^A\count \dimen \box \setbox \copy +} + +\provide\ac{\acro} + +\def\+{\-\penalty\@M\hskip\z@} % a~discretionary hyphen that allows + +\Xedekfracc + +\let\mch\metachar + +\ATfootnotes +\AtBegInput{\ATfootnotes} + +\UrlFix + +\GMverbatimspecials + +\def\texcode@hook{\makestarlow} + +\let\lv\leavevmode +\CommandLet\ac\acro + +\def\OK{\acro{OK}\spifletter} + +\pdef\oczko{;-)\spifletter} + + +\endinput +%% +%% End of file `gmdocc.cls'. diff --git a/macros/latex/contrib/gmdoc/gmglo.ist b/macros/latex/contrib/gmdoc/gmglo.ist new file mode 100644 index 0000000000..782efbd7e6 --- /dev/null +++ b/macros/latex/contrib/gmdoc/gmglo.ist @@ -0,0 +1,9 @@ +preamble +"\n \\begin{theglossary} +\n \\makeatletter\n" +postamble +"\n\n \\end{theglossary}\n" +keyword "\\glossaryentry" +actual '=' +quote '!' +level '>'
\ No newline at end of file diff --git a/macros/latex/contrib/gmdoc/gmoldcomm.sty b/macros/latex/contrib/gmdoc/gmoldcomm.sty new file mode 100644 index 0000000000..641061ed61 --- /dev/null +++ b/macros/latex/contrib/gmdoc/gmoldcomm.sty @@ -0,0 +1,94 @@ +% +% \GetFileInfo{gmoldcomm.sty} +% \title{The \pk{gmoldcomm} Package\thfileinfo} +% \author{Natror (Grzegorz Murzynowski)} +% \date{\today} +% \maketitle +% +% +% This is a~package +% for handling the old comments in \LaTeXe\ Source Files when \LaTeX^^B +% ing them with the \pk{gmdoc} package. +% +% Written by Natror (Grzegorz Murzynowski) 2007/11/10. +% +% It's a~part of the \pk{gmdoc} bundle and as such a~subject to the +% \LaTeX\ Project Public License. +% +% +% \stanza +% Scan \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} + [2007/11/10 v0.99 LaTeX old comments handling (GM)] + +\newenvironment{oldcomments}{% + \catcode`\\=\active + \let\do\@makeother + \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 + \StoreMacro\finish@macroscan + \def\finish@macroscan{% + \@xa\gmd@ifinmeaning\macro@pname\of\gmoc@notprinted% + {}{{\tt\ifvmode\%\fi\bslash\macro@pname}}% + \gmoc@checkenv + }% +}{} + +{\escapechar\m@ne +\xdef\gmoc@notprinted{\string\begin,\string\end}} + +\def\gmoc@maccname{macrocode} +\def\gmoc@ocname{oldcomments} + + +\foone{% + \catcode`\[=1 \catcode`\]=2 + \catcode`\{=12 \catcode`\}=12 } +[\def\gmoc@checkenv[% + \@ifnextchar{%^^A} + [\gmoc@checkenvinn][]]% +% +\def\gmoc@checkenvinn{#1}[% + \def\gmoc@resa[#1]% + \ifx\gmoc@resa\gmoc@maccname + \def\next[% + \begingroup + \def\@currenvir[macrocode]% + \RestoreMacro\finish@macroscan + \catcode`\\=\z@ + \catcode`\{=1 \catcode`\}=2 + \macrocode]% + \else + \ifx\gmoc@resa\gmoc@ocname + \def\next[\end[oldcomments]]% + \else + \def\next[% + % ^^A \typeout[**** detected environment [#1]]% + \{#1\}% + % ^^A \show\relax + ]% + \fi + \fi + \next]% +] + +\foone{% + \catcode`\/=\z@ + \catcode`\\=\active} +% \CodeEscapeChar\/ +{/def/gmoc@defbslash{% + /let\/scan@macro}} +% \CodeEscapeChar\\ + +\def\task#1#2{} + +\endinput + +%\NoEOF |