From aa62fc329f8528d253bfaee40212cd5b83278ac6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 28 Apr 2007 00:53:23 +0000 Subject: gmverb update (26apr07) git-svn-id: svn://tug.org/texlive/trunk@4205 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/gmverb/gmverb.sty | 135 +++++++++++++++++--------- 1 file changed, 87 insertions(+), 48 deletions(-) (limited to 'Master/texmf-dist/tex/latex/gmverb') diff --git a/Master/texmf-dist/tex/latex/gmverb/gmverb.sty b/Master/texmf-dist/tex/latex/gmverb/gmverb.sty index ccc52c4be21..52f407cb682 100644 --- a/Master/texmf-dist/tex/latex/gmverb/gmverb.sty +++ b/Master/texmf-dist/tex/latex/gmverb/gmverb.sty @@ -1,7 +1,7 @@ % % \GetFileInfo{gmverb.sty} % \title{The \pk{gmverb} Package\thfileinfo} -% \author{Grzegorz `Natror' Murzynowski} +% \author{Natror (Grzegorz Murzynowski)} % \date{\today} % \maketitle %% @@ -13,10 +13,10 @@ %% % \begin{copyrnote} % -%%Written by Grzegorz `Natror' Murzynowski, +%%Written by Natror (Grzegorz Murzynowski), %% natror at o2 dot pl %% -%% \copyright\,2005, 2006 by Grzegorz `Natror' Murzynowski. +%% \copyright\,2005, 2006 by Natror (Grzegorz Murzynowski). %% %% This program is subject to the \LaTeX\ Project Public License. %% See \url{http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html} ^^A @@ -38,11 +38,14 @@ % \chschange{v0.76}{06/9/24}{679} % \chschange{v0.77}{06/9/28}{639} % \chschange{v0.78}{06/12/1}{648} +% \chschange{v0.80}{07/3/2}{683} +% \chschange{v0.80}{07/3/30}{667} +% \chschange{v0.82}{2007/4/26}{663} % \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{gmverb} - [2006/12/01 v0.78 After shortvrb (FM) but my way (GM)] + [2007/04/24 v0.82 After shortvrb (FM) but my way (GM)] % % \tableofcontents @@ -93,7 +96,7 @@ % turns the char used into a~short verbatim delimiter, e.g., after % \verb+\MakeShortVerb*\|+ (as you guess, the declaration has its % starred version, which is for visible spaces, and the non-starred for -% the spaces blank) you may type \verb+|\mymacro|+ to achieve |\mymacro| +% the spaces blank) you may type \verb+|\mymacro|+ to get |\mymacro| % instead of typing |\verb+\mymacro+|. Because the char used in this % example is my favourite and used just this way by DEK in the % \TeXbook's format, \pk{gmverb} provides a~macro \TextUsage\dekclubs\ @@ -107,13 +110,29 @@ % % One more difference between \pk{gmverb} and \pk{shortvrb} is that % the chars |\active|ated by |\MakeShortVerb| in the math mode behave -% as if they were `other', so you may type e.g., \verb+$|$+ to achieve +% as if they were `other', so you may type e.g., \verb+$|$+ to get % $|$ and |+| |\active|ated this way is in the math mode typeset properly % etc. % +% However, if you don't like such a~conditional behaviour, you may use +% \TextUsage\OldMakeShortVerb\ instead, what I~do when I~like to +% display short verbatims in displaymath. +% +% % There's one more declaration provided by \pk{gmverb}: % \TextUsage\dekclubs, which is a~shorthand for -% \verb+\MakeShortVerb*\|+\,. +% \verb+\MakeShortVerb*\|+ and \TextUsage\dekclubs*\ for +% \verb+\OldMakeShortVerb*\|+. +% +% So that, after the latter declaration, you can write +%\[\verb+\[|+\\verb+|\]+\] +% instead of +%\[\verb+\[\hbox{|+\\verb+|}\]+\] +% to get a~displayed shortverb. +% +% Both versions of |\dekclubs| OCSR. +% +% % % \stanza % As many good packages, this also does not support any options. @@ -178,20 +197,10 @@ % % \DoIndex{\verb \verb*} % \subdivision{Preliminaries} -% \CodeDefine\firstofone \CodeDefine\afterfi -\long\def\firstofone#1{#1} -\long\def\afterfi#1\fi{\fi#1} - -% The standard |\obeyspaces| command is only re|\catcode|ing of the -% space to be \catactive. Since we'll know a~bit of where these -% macros are used, we know we have also to (re)define such an active -% space to be some space. -% \CodeDefine\gmobeyspaces -\begin{catcode}`\ \active -\gdef\gmobeyspaces{\catcode`\ \active\let \ } -\end{catcode} -% (The above three preliminary definitions are present also in -% \pk{gmutils}.) +% +\RequirePackage{gmutils}[2007/04/24] +% For |\firstofone|, |\afterfi|, |\gmobeyspaces|, |\@ifnextcat| and +% |\noexpand|'s and |\expandafter|'s shorthands |\@nx| and |\@xa| resp. % \CodeDefine\twelvepercent % \begin{oldmc} @@ -216,7 +225,7 @@ % \changes{v0.78}{06/12/1}{added} \def\VerbHyphen#1{% {\escapechar\m@ne - \expandafter\gdef\expandafter\verbhyphen\expandafter{\string#1}}} + \@xa\gdef\@xa\verbhyphen\@xa{\string#1}}} % As you see, it's always global. @@ -299,12 +308,24 @@ % macro changing the |\catcode|s and make spaces visible and breakable % and left braces too. % \CodeDefine\ttverbatim +% \changes{v0.80}{2007/2/27}{\cs{ttverbatim@hook} added} \newcommand*\ttverbatim{% \let\do=\do@noligs \verbatim@nolig@list \let\do=\@makeother \dospecials \dobreaklbrace\dobreakbslash \dobreakspace - \tt} + \tt + \ttverbatim@hook} + +% While typesetting stuff in the QX fontencoding I~noticed there were +% no spaces in verbatims. That was because the QX encoding doesn't +% have any reasonable char at position 32. So we provide a~hook in +% the very core of the verbatim making macros to set proper +% fontencoding for instance. +\@emptify\ttverbatim@hook + +% \CodeDefine{\VerbT1} +\def\VerbT1{\def\ttverbatim@hook{\fontencoding{T1}\selectfont}} % We wish the visible spaces to be the default. % \CodeDefIndex\dobreakspace @@ -325,21 +346,21 @@ % \CodeDefine\@MakeShortVerb \def\@MakeShortVerb#1{% - \expandafter\ifx\csname cc\string#1\endcsname\relax + \@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}. - \expandafter + \@xa \xdef\csname cc\string#1\endcsname{\the\catcode`#1}% \begingroup \catcode`\~\active \lccode`\~`#1% \lowercase{% - \global\expandafter\let + \global\@xa\let \csname ac\string#1\endcsname~% - \expandafter\gdef\expandafter~\expandafter{% - \expandafter\ifmmode\expandafter\string\expandafter~% - \expandafter\else\expandafter\afterfi\@shortvrbdef~\fi}}% This + \@xa\gdef\@xa~\@xa{% + \@xa\ifmmode\@xa\string\@xa~% + \@xa\else\@xa\afterfi{\@shortvrbdef~}\fi}}% This % terrible number of |\expandafter|s is to make the shortverb char % just other in the math mode (my addition). \endgroup @@ -350,18 +371,18 @@ % \CodeDefine\DeleteShortVerb \def\DeleteShortVerb#1{% - \expandafter\ifx\csname cc\string#1\endcsname\relax + \@xa\ifx\csname cc\string#1\endcsname\relax \@shortvrbinfo\@empty{#1 not}{\@empty\verb(*)}% \else \@shortvrbinfo{Deleted }{#1 as}{\@empty\verb(*)}% \rem@special{#1}% \global\catcode`#1\csname cc\string#1\endcsname - \global \expandafter\let \csname cc\string#1\endcsname \relax + \global \@xa\let \csname cc\string#1\endcsname \relax \ifnum\catcode`#1=\active \begingroup \catcode`\~\active \lccode`\~`#1% \lowercase{% - \global\expandafter\let\expandafter~% + \global\@xa\let\@xa~% \csname ac\string#1\endcsname}% \endgroup \fi \fi} @@ -374,15 +395,15 @@ % \CodeDefine\@shortvrbinfo \def\@shortvrbinfo#1#2#3{% \PackageInfo{\gmv@packname}{% - ^^J\@empty #1\expandafter\@gobble\string#2 a short reference - for \expandafter\string#3}} + ^^J\@empty #1\@xa\@gobble\string#2 a short reference + for \@xa\string#3}} % \CodeDefine\add@special \def\add@special#1{% \rem@special{#1}% - \expandafter\gdef\expandafter\dospecials\expandafter + \@xa\gdef\@xa\dospecials\@xa {\dospecials \do #1}% - \expandafter\gdef\expandafter\@sanitize\expandafter + \@xa\gdef\@xa\@sanitize\@xa {\@sanitize \@makeother #1}} % For the commentary on the below macro see the \pk{doc} package's @@ -396,11 +417,11 @@ % \CodeDefine\rem@special \def\rem@special#1{% \def\do##1{% - \ifnum`#1=`##1 \else \noexpand\do\noexpand##1\fi}% + \ifnum`#1=`##1 \else \@nx\do\@nx##1\fi}% \xdef\dospecials{\dospecials}% \begingroup \def\@makeother##1{% - \ifnum`#1=`##1 \else \noexpand\@makeother\noexpand##1\fi}% + \ifnum`#1=`##1 \else \@nx\@makeother\@nx##1\fi}% \xdef\@sanitize{\@sanitize}% \endgroup} @@ -436,7 +457,7 @@ \@endparenv} % \CodeDefine\endverbatim* -\expandafter\let\csname endverbatim*\endcsname =\endverbatim +\n@melet{endverbatim*}{endverbatim} % \CodeDefine\@xverbatim \begingroup \catcode `!=0 % @@ -607,7 +628,25 @@ % one of many possible uses of a~general almost Rainer Sch\"opf's % macro: % \CodeDefine\dekclubs -\def\dekclubs{\MakeShortVerb*\|} +\def\dekclubs{\@ifstar{\OldMakeShortVerb*\|}{\MakeShortVerb*\|}} + +% But even if a~shortverb is unconditional, the spaces in the math +% mode are not printed. So, +%\CodeDefine\edverbs +% \changes{v0.79}{2007/01/01}{added} +% \changes{v0.80}{2007/02/27}{debugged, i.e. \cs{hbox} added back and +% redefinition of \cs{[}}%^^A] +\newcommand*\edverbs{% + \let\gmv@dismath\[% + \let\gmv@edismath\]% + \def\[{%^^A\] + \@ifnextac\gmv@disverb\gmv@dismath}% + \let\edverbs\relax}% + +\def\gmv@disverb{% + \gmv@dismath + % ^^A \@xa\ verb\string + \hbox\bgroup\def\]{\egroup\gmv@edismath}} %\subdivision{\pk{doc}- And \pk{shortvrb}-Compatibility} % @@ -620,19 +659,18 @@ % \CodeDefine\old@MakeShortVerb \def\old@MakeShortVerb#1{% - \expandafter\ifx\csname cc\string#1\endcsname\relax + \@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}. - \expandafter + \@xa \xdef\csname cc\string#1\endcsname{\the\catcode`#1}% \begingroup \catcode`\~\active \lccode`\~`#1% \lowercase{% - \global\expandafter\let - \csname ac\string#1\endcsname~% - \expandafter\gdef\expandafter~\expandafter{% + \global\@xa\let\csname ac\string#1\endcsname~% + \@xa\gdef\@xa~\@xa{% \@shortvrbdef~}}% \endgroup \global\catcode`#1\active @@ -649,9 +687,10 @@ \def\eg@MakeShortVerbStar#1{\MakeShortVerb*#1\endgroup} \def\eg@MakeShortVerb#1{\MakeShortVerb#1\endgroup} -\endinput% for the Tradition. +\endinput% for the Tradition. +% \changes{v0.81}{2007/04/13}{\cs{afterfi} made two-argument} % \PrintChanges \PrintIndex @@ -659,6 +698,6 @@ % (For my GNU Emacs:) %%% Local Variables: -%%% mode: latex -%%% TeX-master: "e:/LaTeX/TeXGuru/gmverb/gmverbDoc" +%%% mode: doctex +%%% TeX-master: "../../../../LaTeX/TeXGuru/gmverb/gmverbDoc.tex" %%% End: -- cgit v1.2.3