diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/gmverb/gmverb.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/gmverb/gmverb.sty | 561 |
1 files changed, 356 insertions, 205 deletions
diff --git a/Master/texmf-dist/tex/latex/gmverb/gmverb.sty b/Master/texmf-dist/tex/latex/gmverb/gmverb.sty index b3d4cda16d2..09740e33966 100644 --- a/Master/texmf-dist/tex/latex/gmverb/gmverb.sty +++ b/Master/texmf-dist/tex/latex/gmverb/gmverb.sty @@ -1,35 +1,131 @@ -% -% \GetFileInfo{gmverb.sty} -% \title{The \pk{gmverb} Package\thfileinfo} -% \author{Natror (Grzegorz Murzynowski)} -% \date{\fakeonum[0.6]{\today}} -% \maketitle -%% -%% This is (a~documentation of) file \pk{gmverb.sty}, -%% intended to be used with \LaTeXe\ as a~package for -%% a~slight redefinition of the |\verb| macro and \env{verbatim} -%% environment and for short verb marking such as \verb+|\mymacro|+. -%% \medskip +%% +% \skiplines +%<*master> +%% \iffalse ^^A we skip the debug setting +\IfFileExists{\string~/bin/gen_and_xela}{\errorcontextlines=1000 }{} +%% \fi +%% ^^A $Id: TheUltimateMaster.gmd,v 0.250 2010/10/24 14:42:35 natror Exp natror $ +% \endskiplines +% +%% \BundleInfoFromName{gmverb} +%% \title{The \pk {gmverb} Package\thfileinfo } +%% \author{Grzegorz Murzynowski} +%% \maketitle %% -% \begin{copyrnote} -% -%%Written by Natror (Grzegorz Murzynowski), -%% natror at o2 dot pl +%% \let\ty\emph \let\df\dekfracc %% -%% \copyright\,2005, 2006, 2007, 2008, 2009, 2010 by Natror (Grzegorz Murzynowski). +%% \begin{copyrnote} %% +%% +%% Copyright ©\, 2005, 2006, 2007, 2008, 2009, 2010 +%% by Grzegorz ‘Natror’ Murzynowski +%% natror (at) o2 (dot) pl +%% %% This program is subject to the \LaTeX\ Project Public License. -%% See \url{http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html} ^^A +%% See ^^A +%% \url{http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html} ^^A %% for the details of that license.\rrthis %% -%% LPPL status: "author-maintained".\par +%% \acro{LPPL} status: "author-maintained". \par %% -%% Many thanks to my \TeX\ Guru Marcin Woli\nacute ski for his \TeX nical ^^A -%% support.\par -%\end{copyrnote} +%% +%% +%% +%% +%% For the documentation please refer to the file(s) +%% \file{gmverb.{gmd,pdf}}. +%% +%% \end{copyrnote} +%% +% +% +% \skiplines +%</master> +% \endskiplines +% +% +%% +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{gmverb} + [2010/09/07 v0.95 After shortvrb (FM) but my way (GM)] + + +%<*master> +% +% (A handful of meta-settings skipped) +% \skiplines +\def\Name#1#2{\expandafter#1\csname#2\endcsname} + +% The »v« letter before version number is obligatory and will be +% passed further. +\def\ProvideDateVersion#1[#2 v#3]{% + \Name\def{#1Date}{#2}% + \Name\def{#1Version}{v#3}% +} + +\def\ProvideInfo#1[#2 v#3 #4]{% + \ProvideDateVersion{#1}[#2 v#3]% + \Name\def{#1Info}{#4}% +} + +\def\ProvideLeafInfo#1[#2 v#3 #4]{% + \ProvideDateVersion{#1}[#2 v#3]% + \Name\def{#1LeafInfo}{#4}% +} + +\def\gmutilsThanks{% + Many thanks to my \TeX\ Guru Marcin Woliński for his \TeX nical + support.% +} + +% \endskiplines +%</master> +%\skiplines we skip the driver +%<*master> +\ifnum\catcode`\@=12 + + +\documentclass[debug, countalllines, codespacesgrey, outeroff, +% +pagella, trebuchet, cursor, fontspec=quiet]{gmdocc} + +\usepackage{eufrak}% for |\continuum| in the commentary. +\twocoltoc + +% +% + +\begin{document} + +\addtocontents{toc}{\unexpanded{\let\thfileinfo\relax}} + +\def\gmdExt{% + sty% +} + +\DocInput{\jobname.\gmdExt} + +\PrintChanges +\thispagestyle{empty} +\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} +\typeout{% + Produce index with^^J% + makeindex -r \jobname^^J} +\afterfi{\end{document}} + +\fi% of driver pass +%</master> +%\endskiplines +% +% \enoughpage 18 +% \tableofcontents % % \ChangesStart{}{1000/00/00} -% +% % \chschange{v0.70}{06/8/15}{523} % \chschange{v0.71}{06/9/04}{596} % \chschange{v0.72}{06/9/05}{660} @@ -56,33 +152,13 @@ % \chschange{v0.93}{2010/3/4}{1035} % [ a bug fix in \cmd\scanverb\space (halfing the hashes)] % \toCTAN{2010/03/04 v0.93} +% \chschange{v0.94}{2010/07/07}{979} +% [wrapping the \ac{UTF-8} dashes' setting in a \protect\XeTeX's conditional] +% \toCTAN{2010/07/07 v0.94} +% +% \chschange{}{2010/10/24}{1040} % -% \skiplines we skip the driver -\ifnum\catcode`\@=12 - -\documentclass [debug, countalllines, codespacesgrey, pagella, trebuchet, cursor] {gmdocc} -\twocoltoc -\begin{document} -\DocInput{\jobname.sty} -% \typeout{% -% Produce index with^^J% -% makeindex -r \jobname^^J} -% -% \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} -\afterfi{\end{document}} -\fi -%\endskiplines - -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{gmverb} - [2010/03/04 v0.93 After shortvrb (FM) but my way (GM)] - % -% \tableofcontents -% % \division{Intro, usage} % % This package redefines the |\verb| command and the \env{verbatim} @@ -92,10 +168,10 @@ % \env{verbatim}-like environments provided their contents would be not % \emph{horribly} long (as long as a macro's argument may be at most). % -% This package also allows the user to declare a chosen char(s) as +% This package also allows the user to declare a chosen char(s) as % a `short verb' e.g., to write \verb+|\a\verbatim\example|+ instead of % \verb+\verb|\a\verbatim\example|+. -% \dekmedskip +% \dekmedskip % % The \pk{gmverb} package redefines the |\verb| command and the % \env{verbatim} environment in such a~way that | |, |{| and |\| are @@ -119,11 +195,11 @@ % \stanza % Another difference is the \TextUsage\verbeolOK\ declaration % (\acro{OCSR}). Within its scope, |\verb| allows an -% end of a~line in its argument and typesets it just as a~space. +% end of a~line in its argument and typesets it just as a~space. % % As in the standard version(s), the plain |\verb| typesets the spaces -% blank and |\verb*| makes them visible. -% +% blank and |\verb*| makes them visible. +% % Moreover, \pk{gmverb} provides the \TextUsage\MakeShortVerb\ macro % that takes a~one-char control sequence as the only argument and % turns the char used into a~short verbatim delimiter, e.g., after @@ -154,18 +230,18 @@ % There's one more declaration provided by \pk{gmverb}: % \TextUsage\dekclubs, which is a~shorthand for % \verb+\MakeShortVerb\|+, \TextUsage*{\dekclubs*}\ for -% \verb+\MakeShortVerb*\|+ and \TextUsage\olddekclubs\ for -% \verb+\OldMakeShortVerb\|+. +% \verb+\MakeShortVerb*\|+ and \TextUsage\olddekclubs\ for +% \verb+\OldMakeShortVerb\|+. % -% There's one more declaration, \TextUsage\edverbs\ that makes +% There's one more declaration, \TextUsage\edverbs\ that makes % \cs{[} %^^A] % checks if the next token is an active char and opens an |\hbox| if -% so. That is done +% so. That is done % so that you can write (in |\edverbs|' and |\dekclubs|' scope) %\[\verb+\[|<verbatim stuff>|\]+\] -% instead of +% instead of %\[\verb+\[\hbox{|<verbatim stuff>|}\]+\] -% to get a~displayed shortverb. +% to get a~displayed shortverb. % % Both versions of |\dekclubs| \acro{OCSR}. % @@ -190,27 +266,33 @@ % curly braces because those are recatcoded to % ‘other’. But if you make some other pair of chars category 1 and 2 % that are not on the \cmd\dospecials\ list, then you can wrap the -% arguments in those chars, but what for?}, +% arguments in those chars, but what for?}, % \dc * m a~char for group starter (for catcode 1), has to be % unbraced, % \dc * m a~char for group ender (for catcode 2), has to be -% unbraced, +% unbraced, % \opt (optional) a~char for verbatim math shift (for catcode 3); it has % to be in square brackets if present. If % absent, nothing is set for the verbatim math shift, % \opt (optional) a~char for the shorthand for |\metachar|; it has to be -% in square brackets if present. +% in square brackets if present. If provided, e.g., |⁄››| as I suggest +% in |\GMverbatimspecials|, then it itself becomes an active char +% let-equal to |\meta|, and a \CS made of it, |⁄›⁄›| in this example, +% becomes |\string|. % \dc b optional in curly braces, additional stuff (commands) to be % executed in a~verbatim. % \end{enumargs} -% For example, after telling \TeX -% \[|\verbatimspecials ⁄⁄ ⁄« ⁄» [ ⁄¿ ] [ ⁄› ] {\def⁄string⁄|{$\vert$}}|\] (the +% All the specials defined this way, except the meta char, if preceded +% with the escape char, will be typeset verbatim. +% +% For example, after telling \TeX +% \[|\verbatimspecials ⁄⁄ ⁄« ⁄» [ ⁄¿ ] [ ⁄›› ] {\def⁄›⁄|{$\vert$}}|\] (the % slash is Unicode Fractional Slash, spaces are ignored) you -% can write \[\verb:|\macro⁄⁄arg⁄«arg. ⁄¿n+1⁄¿⁄»\⁄›[No⁄›]Value⁄›(T⁄⁄|F⁄›)|:\] to get +% can write \[\verb:|\macro⁄⁄arg⁄«arg. ⁄¿n+1⁄¿⁄»\⁄››[No⁄››]Value⁄››(T⁄⁄|F⁄››)|:\] to get % \[|\macro⁄arg«arg. ¿n+1¿»\›[No›]Value›(T⁄|F›)|\]%^^A| % -% To get a~‘verbatim special’ verbatim, precede it with the ‘verbatim -% escape’: |⁄⁄⁄⁄ ⁄⁄⁄« ⁄⁄⁄» ⁄⁄⁄¿ ⁄⁄⁄›| in the example above. +% ^^A % To get a~‘verbatim special’ verbatim, precede it with the ‘verbatim +% ^^A % escape’: |⁄⁄⁄⁄ ⁄⁄⁄« ⁄⁄⁄» ⁄⁄⁄¿ ⁄⁄⁄›| in the example above. % % Note also that \verb+⁄⁄|+ is a~control sequence so it doesn't % delimit the short verbatim \verb+|+'s argument. @@ -254,73 +336,95 @@ % arguments. Broken bar is declared as % \[|\verbDiscretionaryHyphen{"A6}{¦}|\] % +% \stanza Since version 0.95 (August 2010) this package also provides +% the |\VerbatimPitch| declaration that modifies the \env{verbatim} +% environments and derivatives so that the environment contents +% (recatcoded, i.e.\ “sanitised”) are wrapped in the macro +% |\VerbatimContents| and therefore available after environment's end +% (after |\endverbatim| to be precise, so also in the end-def of a +% derivative verbatim). +% +% This may be useful for \TeX nical examples: you can rescan the +% contents of a verbatim with |\scantokens| and execute/typeset it. +% Such a thing is done in the \pk{gmdoc} package, see the +% \env{verbatim@p} environment. +% % % % \subdivision{The package options} % As many good packages, this also does not support any options. % % \begin{gmlonely} -% \subdivision{Installation} -% -% Unpack the \file{gmverb-tds.zip} archive (this is an archive -% conforming the \acro{TDS} standard, see \file{CTAN/tds/tds.pdf}) -% in a~\file {texmf} directory or put the \pk{gmverb.sty} somewhere -% in the \file{texmf/tex/latex} branch on your own. Creating -% a~\file{texmf/tex/latex/gm} directory may be advisable if -% you consider using other packages written by me. -% -% Then you should refresh your \TeX\ distribution's files' database -% most probably. +% \subdivision{Installation} +% +% Unpack the \file{\jobname-tds.zip} +% archive (this is an archive that conforms the \acro{TDS} standard, +% see \file{CTAN/tds/tds.pdf}) in some texmf directory or just put +% the \pk{gmutils.sty} somewhere in the \file{texmf/\:tex/\:latex} +% branch. Creating a \file{texmf/\:tex/\:latex/\:gm} directory may +% be advisable if you consider using other packages written by me. +% +% Then you should refresh your \TeX\ distribution's files' database +% most probably. % \end{gmlonely} -% -% \subdivision{Contents of the \pk{gmverb.zip} archive} -% -% The distribution of the \pk{gmverb} package consists of the -% following three files and a~\acro{TDS}-compliant archive. +% +% \subdivision{Contents of the \pk{\jobname.zip} archive} +% +% The distribution of the \pk{gmutils} package consists of the +% following three files and a \acro{TDS}-compliant archive. % \begin{verse} -% \pk{gmverb.sty}\\ -% \pk{README}\\ -% \pk{gmverb.pdf}\\ -% \pk{gmverb.tds.zip} +% \pk{\jobname.\gmdExt}\\ +% \pk{README}\\ +% \pk{\jobname.pdf}\\ +% \pk{\jobname.tds.zip} % \end{verse} % -% This package requires another package of mine, \pk{gmutils}, -% also available on \acro{CTAN}. -% % \begin{gmlonely} -% \subdivision{Compiling of the documentation} -% -% The last of the above files (the \pk{.pdf}, i.e., \emph{this -% file}) is a~documentation compiled from the \pk{.sty} file by -% running \XeLaTeX\ on the \pk{gmverb.sty} file -% (|xelatex gmverb.sty| in the directory you wish the -% documentation to be in, you don't have copy the \file{.sty} file -% there, \TeX\ will find it) twice, then MakeIndex on the gmverb.idx file, and -% then \LaTeX\ on gmverb.tex once more. -% -% MakeIndex shell command: +% \subdivision{Compiling of the documentation} +% +% The last of the above files (the \pk{.pdf}, i.e., \emph{this +% file}) is a documentation compiled from the \pk{.\gmdExt} file by +% running \LaTeX\ on the \pk{\jobname.\gmdExt} file twice +% (|xelatex ⁄jobname.⁄gmdExt| in the directory you wish the +% documentation to be in^^A +% \ifnum\numexpr\strcmp{\gmdExt}{sty}*\strcmp{cls}{\gmdExt}=0\relax^^A +%, you don't have copy the \file{.\gmdExt} file +% there, \TeX\ will find it\fi), +% then MakeIndex on the \file{\jobname.idx} file, and then \LaTeX\ +% on \file{\jobname.\gmdExt} once more. +% +%MakeIndex shell commands: %\begin{verbatim} -%makeindex -r gmverb +%makeindex -r ⁄jobname +%makeindex -r -s gmglo.ist -o ⁄jobname.gls ⁄jobname.glo %\end{verbatim} -% The |-r| switch is to forbid MakeIndex to make implicit ranges since -% the (code line) numbers will be hyperlinks. -% -% Compiling the documentation requires the packages: -% \pk{gmdoc} (\pk{gmdoc.sty} and \pk{gmdocc.cls}), \pk{gmverb.sty}, -% \pk{gmutils.sty} and also some standard packages: -% \pk{hyperref.sty}, \pk{color.sty}, \pk{geometry.sty}, -% \pk{multicol.sty}, \pk{lmodern.sty} and \pk{fontenc.sty} that should -% be installed on your computer by default. -% -% If you had not installed the \pk{mwcls} classes (available on -% CTAN and present in \TeX\ Live e.g.), the result of your -% compilation might differ a~bit from the \pk{.pdf} provided in this -% \pk{.zip} archive in formatting: If you had not installed -% \pk{mwcls}, the standard \pk{article.cls} class would be used. +% +% The |-r| switch is to forbid MakeIndex to make implicit ranges since +% the (code line) numbers will be hyperlinks. +% +% Compiling the documentation requires the packages: +% \pk{gmdoc} (\pk{gmdoc.sty} and \pk{gmdocc.cls}), \pk{gmverb.sty}, +% the \pk{gmutils} bundle, \pk{gmiflink.sty} +% and also some standard packages: +% \pk{hyperref.sty}, \pk{color.sty}, \pk{geometry.sty}, +% \pk{multicol.sty}, \pk{lmodern.sty}, \pk{fontenc.sty} that should +% be installed on your computer by default. +% +% Moreover, you should put the \file{gmglo.ist} file, a MakeIndex +% style for the changes' history, into some \file{texmf/makeindex} +% (sub)directory. +% +% Then you should refresh your \TeX\ distribution's files' database +% most probably. +% +% If you had not installed the \pk{mwcls} classes (available on +% \acro{CTAN} and present in \TeX\ Live e.g.), the result of your +% compilation might differ a bit from the \pk{.pdf} provided in this +% \pk{.zip} archive in formatting: If you had not installed +% \pk{mwcls}, the standard \pk{article.cls} class would be used. % \end{gmlonely} -% -% -% \StopEventually{\NoEOF} +% +% % % % \division{The code} @@ -328,20 +432,20 @@ % \DoIndex{\verb \verb*} % \subdivision{Preliminaries} % -\RequirePackage{gmutils}[2008/10/08] +\RequirePackage{gmcommand}[2010/06/20] % For |\firstofone|, |\afterfi|, |\gmobeyspaces|, |\@ifnextcat|, |\foone| and % |\noexpand|'s and |\expandafter|'s shorthands |\@nx| and |\@xa| -% resp.\rrthis - - - +% resp. and |\DeclareCommand|.\rrthis +% +% +% % Someone may want to use another char for comment, but we assume here % `orthodoxy'. Other assumptions in \pk{gmdoc} are made. The `knowledge' % what char is the comment char is used to put proper `hyphen' when % a~\env{verbatim} line is broken. % \Define\verbhyphen % \changes{v0.75}{06/9/8}{renamed from a~rather confusing -% \cs{commentchar}} +% \cs{commentchar}} \let\verbhyphen\xiipercent % Provide a~declaration for easy changing it. Its argument should be @@ -353,7 +457,6 @@ \@xa\gdef\@xa\verbhyphen\@xa{\string#1}}} % As you see, it's always global. - % \subdivision{The breakables} % % Let's define a~|\discretionary| left brace such that if it breaks, @@ -363,16 +466,15 @@ \discretionary{\type@lbrace\verbhyphen}{}{\type@lbrace}% \yeshy} - \foone{\catcode`\[=1 \catcode`\{=\active \catcode`\]=2 }% [% - \def\dobreaklbrace[\catcode`\{=\active + \def\dobreaklbrace[\catcode`\{=\active \def{%^^A} [\breaklbrace\gm@lbracehook]]%\label{gm@lbracehook} ] % Now we only initialise the hook. Real use of it will be made in -% \pk{gmdoc}. +% \pk{gmdoc}. \relaxen\gm@lbracehook % The |\bslash| macro defined below I~use also in more `normal' \TeX ing, e.g., @@ -405,8 +507,6 @@ \pdef\nobreaklbrace{\def\breaklbrace{\type@lbrace\yeshy}} % \changes{v0.92}{2008/12/11}{renamed from \cmd\fixlbrace} - - \foone{\catcode`\!=0 \catcode`\\=\active}%%\CodeEscapeChar\!^^A % ^^A~One r-brace is turned off for Emacs by |\{|. {%^^A{ @@ -418,7 +518,7 @@ % we'll use in the almost Knuthian macro making verbatim. This `almost' % makes a~difference. % ^^A \foone{\catcode`\ =12 }% note this space is ${}_{10}$ and is gobbled -% ^^A % by parsing of the number. +% ^^A % by parsing of the number. \def\breakablevisspace{\discretionary{\visiblespace}{}{\visiblespace}} %\nostanza The \cs{visiblespace} macro is |\let| in \pk{gmutils} @@ -428,7 +528,7 @@ {% \newcommand*\dobreakvisiblespace{\def {\breakablevisspace}\obeyspaces}%^^A % |\def|ing it caused a~stack overflow disaster with \pk{gmdoc}.\ilrr -\newcommand*\dobreakblankspace{\let =\space\obeyspaces}% +\newcommand*\dobreakblankspace{\let =\space\obeyspaces}% } % \Define\xiiclub @@ -440,25 +540,33 @@ % |\ttverbatim| comes from \TeXbook\ too, but I~add into it a~\LaTeX\ % macro changing the |\catcode|s and make spaces visible and breakable % and left braces too. -% +% % \changes{v0.80}{2007/2/27}{\cs{ttverbatim@hook} added} \pdef\ttverbatim{% \let\do=\do@noligs \verbatim@nolig@list \let\do=\@makeother \dospecials \dobreaklbrace\dobreakbslash \dobreakspace - \makeatletter + \makeatletter % \chgs{2008/12/10 v0.92 added \cmd\makeatletter\ to sound with the % ‘verbatim specials’, namely to allow control sequences containing % \env @} \ifhmode \setspaceskip \fi - \tt - \edef\gmv@storedhyphenchar{\the\hyphenchar\font}% + \verbatimfont + \xdef\gmv@storedhyphenchar{\the\hyphenchar\font}% + % Assignment of the hyphenchar is always global so let the above + % edefinition be also such. \hyphenchar\font=\gmv@hyphenchar - \ttverbatim@hook} + \ttverbatim@hook +}% of |\ttverbatim| +% \CH{2010/08/14 v0.993 rigid \cmd\tt in \cmd\ttverbatim changed to +% redefinable \cmd\verbatimfont due to absurd problems with bad +% fontifying of \pk{gmdoc}} +% +\def\verbatimfont{\tt} % While typesetting stuff in the \acro{QX} fontencoding I~noticed there were % no spaces in verbatims. That was because the \acro{QX} encoding doesn't @@ -482,7 +590,7 @@ % \file{doc.pdf} and then is added my slight changes. \def\MakeShortVerb{% - \gm@ifstar + \gmu@ifstar {\def\@shortvrbdef{\verb*}\@MakeShortVerb}% {\def\@shortvrbdef{\verb}\@MakeShortVerb}} @@ -555,7 +663,7 @@ % removed and to unexpandable \CSs\ |\do| and \<\cs{do}'s argument> % otherwise. With |\do| defined this way the entire list is just % globally expanded itself. Analogous hack is done to the |\@sanitize| -% list. +% list. % \def\rem@special#1{% \def\do##1{% @@ -586,9 +694,15 @@ \hyphenpenalty=\gmv@hyphenpe\relax \exhyphenpenalty=\gmv@exhyphenpe \hyphenchar\font=\m@ne +% +% The line below serves as the delimiter for +% |\verbatim@PitchContents|, to discard the stuff before it (see +% l.~\ref{verbatim@PitchContents:1/2}). +% + \@gobble\verbatim }% in the \LaTeX\ version % there's \incs{@vobeyspaces} instead of \incs{gmobeyspaces}. -% \changes{v0.73}{06/09/06}{\cs{@vobeyspaces} changed to +% \changes{v0.73}{06/09/06}{\cs{@vobeyspaces} changed to % \cs{obeyspaces} to make the blank \cs{verb›[atim›]} spaces breakable} % \Define*{verbatim*} \@namedef{verbatim*}{\@beginparpenalty \predisplaypenalty \@verbatim @@ -597,8 +711,9 @@ } \def\endverbatim{\@@par - \hyphenchar\font=\gmv@storedhyphenchar % hyphenchar assignments are - % always global. +% ^^V \hyphenchar\font=\gmv@storedhyphenchar % hyphenchar assignments are +% ^^V % always global. And for an entire paragraph works the one +% last in it so we hide it. \ifdim\lastskip >\z@ \@tempskipa\lastskip \vskip -\lastskip \advance\@tempskipa\parskip \advance\@tempskipa -\@outerparskip @@ -621,7 +736,7 @@ !edef!verbatim@currenvir[% % ^^A !@xa!@xa!@xa!unexpanded % ^^A !@xa!@xa!@xa[% - % ^^A + % ^^A !@xa!scantokens!@xa[!@currenvir]% % ^^A]% ]% of |\verbatim@currenvir|. This macro is defined as the @@ -636,7 +751,10 @@ ####1!noexpand\end!@nx{% !@xa!unexpanded!@xa[!verbatim@currenvir]% }[% + !@nx!verbatim@PitchContents ####1% + !@nx!verbatim@PitchContents@Delim%added 2010/8/16 ####1!@nx!end[!@currenvir]]]% +% ^^A !s how!verbatim@edef !verbatim@edef !verbatim@end]% !endgroup @@ -645,13 +763,32 @@ % \Define\@sxverbatim \let\@sxverbatim=\@xverbatim +\def\verbatim@PitchContents@Left{% + \long\def\verbatim@PitchContents + ##1\@gobble\verbatim ##2\verbatim@PitchContents@Delim +} + +% By default we make |\verbatim@PitchContents| a gobbler. +\verbatim@PitchContents@Left {} + +\pdef\VerbatimPitch{% +% But in this declaration scope we make |\@xverbatim| pitch the contents of +% \env{verbatim}s in a macro. We use that in \pk{gmdoc} not to repeat +% examples' code. +% \label{verbatim@PitchContents:1/2} + \verbatim@PitchContents@Left {% + \gdef\VerbatimContents{##2}% + }% + % +}% of |\VerbatimThrow|. + % \Define\@verbatim % F.\,Mittelbach says the below is copied almost verbatim from \LaTeX\ % source, modulo |\check@percent|.\Define\@verbatim \def\@verbatim{% % \changes{v0.71}{06/09/04}{\cs{trivlist} substituted with % chosen explicit macros. Analogous in \cs{endverbatim}.} - % + % % Originally here was just |\trivlist \item[]|, but it worked % badly in my document(s), so let's take just highlights of if. \parsep\parskip @@ -671,6 +808,7 @@ \if@minipage\else\vskip\parskip\fi %^^A \leftmargin\parindent% please notify me if it's a~bad idea. It is. \advance\@totalleftmargin\verbatimleftskip + \parskip\verbatimparskip % added 2010/6/2 \raggedright \leftskip\@totalleftmargin% so many assignments to preserve the % \env{list} thinking for possible future changes. However, we may @@ -699,7 +837,6 @@ \@ifundefined{stanzaskip}{\newlength\stanzaskip}{} \stanzaskip=\medskipamount - \newskip\verbatimleftskip %\changes{v0.91}{2008/11/12}{added} \verbatimleftskip\leftmargini @@ -708,7 +845,8 @@ % \changes{v0.71}{06/09/04}{added to verbatim parameters.} \verbatimhangindent=3em - +\newskip\verbatimparskip +\verbatimparskip\z@skip \providecommand*\check@percent{} % In the \pk{gmdoc} package shall it be defined to check if the next @@ -732,7 +870,7 @@ \ttverbatim \verbatim@specials \gm@verb@eol - \gm@ifstar + \gmu@ifstar {\verb@lasthook\@sverb@chbsl}% {\gmobeyspaces\frenchspacing\verb@lasthook\@sverb@chbsl}}%\ % in the \LaTeX\ version there's |\@vobeyspaces| instead of @@ -749,7 +887,6 @@ % For the special case of a~backslash opening a~(short) verbatim, in % which it shouldn't be breakable, we define the checking macro. - \DeclareCommand\DefineTypeChar{mmo}{% % \begin{enumargs} % \dc m the char as a~\CS, @@ -768,21 +905,21 @@ \@xa\gn@melet\csname gmu@#2wd@name\endcsname{gmu@tempb}% here we % let the \CS\ with the name contained in |\gmu@⁄<char-name>wd@name| to % the expanded value of width of the char measured among copies of - % it. - \typeout{@@@@ package gmverb: - \@xa\string - \csname\csname gmu@#2wd@name\endcsname\endcsname - \space is - \csname\csname gmu@#2wd@name\endcsname\endcsname}% + % it. + % ^^A \typeout{@@@@ package gmverb: + % ^^A \@xa\string + % ^^A \csname\csname gmu@#2wd@name\endcsname\endcsname + % ^^A \space is + % ^^A \csname\csname gmu@#2wd@name\endcsname\endcsname}% \fi }% of |\gmu@measure⁄<char-name>|. % \stanza \@nameedef{type@#2}{% \@nx\leavevmode - \@xa\@nx\csname gmu@measure#2\endcsname + \@xanxcs{gmu@measure#2}% \hbox to \@nx\csname - \@xa\@nx\csname gmu@#2wd@name\endcsname\@nx\endcsname - {\IfValueTF{#3}{\@nx#3}{\@xa\@nx\csname #2\endcsname}% + \@xanxcs{gmu@#2wd@name}\@nx\endcsname + {\IfValueTF{#3}{\@nx#3}{\@xanxcs{#2}}% \@nx\hss}% }% of |\type@⁄<char-name>|, }% of |\DefineTypeChar|. @@ -806,8 +943,11 @@ % \Define\verb@egroup \def\verb@egroup{\global\let\verb@balance@group\@empty - \hyphenchar\font=\gmv@storedhyphenchar - \egroup} +% ^^V \hyphenchar\font=\gmv@storedhyphenchar % |\hyphenchar| behaves +% like |\hyphenpenalty| etc.: the last one in a paragraph is in charge +% for entire. + \egroup +} % \Define\gm@verb@eol %\changes[\verb]{v0.74}{06/09/07}{line end forbidden inside \texttilde} @@ -837,6 +977,7 @@ % \changes{v0.74}{06/09/07}{added} % And back to the main matter, \def\@sverb#1{% + % ^^A \typeout{@@@@ \detokenize{#1} @@@@}% \catcode`#1\active \lccode`\~=`#1% \gdef\verb@balance@group{\verb@egroup \@latex@error{Illegal use of \bslash verb command}\@ehc}% @@ -856,11 +997,11 @@ % And finally, what I~thought to be so smart and clever, now is just % one of many possible uses of a~general almost Rainer Sch\"opf's % macro: -\def\dekclubs{\gm@ifstar{\MakeShortVerb*\|}{\MakeShortVerb\|}} +\def\dekclubs{\gmu@ifstar{\MakeShortVerb*\|}{\MakeShortVerb\|}} \def\olddekclubs{\OldMakeShortVerb\|} % But even if a~shortverb is unconditional, the spaces in the math -% mode are not printed. So, +% mode are not printed. So, %\Define\edverbs % \changes{v0.79}{2007/01/01}{added} % \changes{v0.80}{2007/02/27}{debugged, i.e. \cs{hbox} added back and @@ -886,13 +1027,13 @@ % a~`shortverb' char should work as usual in the math mode. So let it % may be as they wish: % \Define\old@MakeShortVerb - + \def\old@MakeShortVerb#1{% \@xa\ifx\csname cc\string#1\endcsname\relax \@shortvrbinfo{Made }{#1}\@shortvrbdef \add@special{#1}% \AddtoPrivateOthers#1% a~macro to be \emph{really} defined in - % \pk{gmdoc}. + % \pk{gmdoc}. \@xa \xdef\csname cc\string#1\endcsname{\the\catcode`#1}% \begingroup @@ -910,13 +1051,12 @@ % \Define\OldMakeShortVerb \def\OldMakeShortVerb{\begingroup \let\@MakeShortVerb=\old@MakeShortVerb - \gm@ifstar{\eg@MakeShortVerbStar}{\eg@MakeShortVerb}} + \gmu@ifstar{\eg@MakeShortVerbStar}{\eg@MakeShortVerb}} % \Define\eg@MakeShortVerbStar \Define\eg@MakeShortVerb \def\eg@MakeShortVerbStar#1{\MakeShortVerb*#1\endgroup} \def\eg@MakeShortVerb#1{\MakeShortVerb#1\endgroup} - % \subdivision{Grey visible spaces} % In August 2008 Will Robertson suggested grey spaces for % \pk{gmdoc}. I~added a~respective option to that package but I~like @@ -940,7 +1080,6 @@ {\@xa\unexpanded\@xa{\visiblespace}}}}% }} - % \subdivision{Verbatim specials---\CSes in verbatims} \pdef\verbatimspecials{% This declaration only defines a~bearer\ @@ -956,13 +1095,13 @@ % \end{enumargs} \@bsphack \begingroup - \let\do\@makeother + \let\do\@makeother \dospecials \catcode`\ =10 \verbatim@specials@iii} \pdef\verbatim@specials@iii#1#2#3{% as you see, we take only first - % three arguments in a~despecialized group. It's to avoid + % three arguments in a~despecialized group. It's to avoid % \incs{futurelet} of the optionals' parser to touch (and thus % spoil) subsequent token. Yes, we could handle the case of a~space % or single line end but handling the case of a~backslash would be @@ -974,7 +1113,7 @@ \catcode`\ =9 \verbatim@specials@iv}% {\addtomacro\verbatim@specials@list{\NoValue\NoValue}% - \verbatim@specials@vi}% + \verbatim@specials@vi}% }% of |\verbatim@specials@iii|. \pdef\verbatim@specials@iv[#1]{% @@ -988,7 +1127,6 @@ \verbatim@specials@vi}% }% of |\verbatim@specials@iv|. - \pdef\verbatim@specials@v[#1]{% \endgroup \addtomacro\verbatim@specials@list{#1}% @@ -1041,19 +1179,25 @@ \pdef\noverbatimspecials{\let\verbatim@specials@list\@undefined} - \def\GMverbatimspecials{% - \gm@testdefined\XeTeXversion\iftrue - \verbatimspecials ⁄«»[¿][›]% - {\def\|{\metachar{$\vert$}}% - % ^^A \hyphenchar\font=\gmv@hyphenchar - \makestarlow - \relaxen\‘% to provide a~\CS\ separator (space is not $_{10}$\ in verbatims). - }% of |#6|. - \fi + \gmu@ifCSdefined {\XeTeXversion}% ^^A \begingroup \let\do\@makeother + % ^^A \do\⁄ \do\« \do\» \do\¿ \do\› + {\verbatimspecials + ⁄% escape + «»% |\bgroup| and |\egroup| + [¿]% math shift + [›]% meta-char + {\def\|{\metachar{$\vert$}}% + % ^^A \hyphenchar\font=\gmv@hyphenchar + \makestarlow + \relaxen\‘% to provide a~\CS\ separator (space is not \cat 10 in + % verbatims). + \let\›\string + }% of |#6|. + }% + {}% ^^A \endgroup }% of |\GMverbatimspecials|. - % \subdivision{Partial \cmd\verb\ in arguments} % Now command for partial verbatims in arguments of commands: @@ -1067,7 +1211,6 @@ \catcode`#\active}% } - \foone{\@makeother\^^R}{% \@xa\DeclareCommand\@xa\scanverb\@xa{% % \chgs{2010/03/01 v0.93 mandatory argument made long (a bug fix)} @@ -1075,7 +1218,7 @@ % \begin{enumargs} % \dc Q{*_} % \dc m the stuff to be rescanned and typeset verbatim. Note that |%| - % will be executed during first scan so at best will disappear. + % will be executed during first scan so at best will disappear. % \end{enumargs} Spaces are ignored (because of detokenizers that add % a~space after a~\CS) but if you declare some % \incmd\verbatimspecials, then you can use \inverb|⁄⁄ | where |⁄⁄| denotes @@ -1089,7 +1232,7 @@ \@xa\IfIntersect\@xa{\all@unders}{#1}% {}{% We make spaces ignored only if there was no underscore in % \inhash1 and if \inhash2 doesn't contain \inverb|\ |. - \IfAmong\ \among{#2}% + \gmu@ifxany\ {#2}% {}{\addtomacro\verb@lasthook{\catcode`\ =9 }}}% \addtomacro\verb@lasthook{\gmv@hashhalfing }% \@makeother\^^R% @@ -1105,7 +1248,6 @@ }% of |\scanverb|, }% of |\foone|. - \def\verbDiscretionaryHyphen#1#2{% % \chgs{2010/03/03 v0.93 added to synchronise hyphen chars in % \pk{gmdoc}'s documentation} @@ -1115,11 +1257,16 @@ \verbDiscretionaryHyphen{"A6}{¦} +\XeTeXifprefix\iftrue +% \CH{2010/06/28 v0.94 due to Will Robertson's remark that +% recatcoding long (no-\acro{ASCII}) dashes works only under \XeTeX\ +% and \LuaTeX, I embrace them in a \XeTeX\ conditional} + \def\gmu@tempa{% \DeclareCommand\verbLongDashes{ - >iS{–}% to memorise which dash we set + >iT{–}% to memorise which dash we set B{1.41} % expansion of en-dash - >iS{—} % as above + >iT{—} % as above B{2} % expansion of em-dash }% } @@ -1140,16 +1287,21 @@ }% \gmu@tempa - -\endinput% for the Tradition. - - +\fi % of if \XeTeX. +% +% Note that we have two “hyphens”: one for places where a line may be +% broken with a comment char and another, provided as |\hyphenchar|, +% for discretionary hyphens at points where correct \TeX\ code cannot +% be broken, such as \CS names. +% +% +% % \ChangesGeneral % % \changes{v0.81}{2007/04/13}{\cs{afterfi} made two-argument (first % undelimited, the stuff to be put after \cs{fi}, and the other, % delimited with \cs{fi}, to be discarded} - +% % \changes{v0.83}{2007/11/09}{added a~hook in the active left brace % definition intended for \pk{gmdoc} automatic detection of % definitions (in line \protect\ref{gm@lbracehook})} @@ -1171,17 +1323,16 @@ % \cs{›(begin⁄!|end›)group}} % % -% \PrintChanges \PrintIndex -% \Finale - -% (For my GNU Emacs:) -%%% Local Variables: +% +% +% +% +%%% (For my GNU Emacs:) +%%% Local Variables: %%% mode: doctex -%%% mode: flyspell -%%% ispell-local-dictionary: "british" -%%% TeX-master: "../../../../LaTeX/TeXGuru/gmverb/gmverbDoc.tex" %%% coding: utf-8 -%%% End: - -% LocalWords: breakbslash dobreakbslash chbsl exhyphenpe hyphenpe lasthook -% LocalWords: visspacesgrey sxverbatim septify measurewd bslashwd +%%% End: +% +\endinput +%% +%% End of file `gmverb.sty'. |