diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/nicetext/niceverb.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/nicetext/niceverb.sty | 133 |
1 files changed, 75 insertions, 58 deletions
diff --git a/Master/texmf-dist/tex/latex/nicetext/niceverb.sty b/Master/texmf-dist/tex/latex/nicetext/niceverb.sty index 4150de49265..b702dce09cc 100644 --- a/Master/texmf-dist/tex/latex/nicetext/niceverb.sty +++ b/Master/texmf-dist/tex/latex/nicetext/niceverb.sty @@ -1,8 +1,8 @@ \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{niceverb}[2011/12/05 v0.44 +\ProvidesPackage{niceverb}[2012/09/27 v0.5 minimize doc markup (UL)] -%% Copyright (C) 2009-2011 Uwe Lueck, +%% Copyright (C) 2009-2012 Uwe Lueck, %% http://www.contact-ednotes.sty.de.vu %% -- author-maintained in the sense of LPPL below -- %% @@ -18,66 +18,76 @@ %% http://www.contact-ednotes.sty.de.vu %% %% === Switching Category Codes === -%% v0.3 introduces `\AssignCatCodeTo' and `\MakeNormal'. -%% +%% Underscore as a ``private letter," using 'stacklet' with v0.5: +\RequirePackage{stacklet} \PushCatMakeLetter\_ %% 2012/08/27 +%% v0.3 introduced `\AssignCatCodeTo' and `\MakeNormal'. +%% v0.5 abolishes the former again and uses %% former 2012/08/28 +%% 'actcodes' for some part of `\catcode' switching: +\RequirePackage{actcodes} %% |\CatCode{\<character>}| %% (or simply |\CatCode\<character>|) %% saves one token per use and works when the category code %% of \qtd{&`} (``single left quote") has changed. -\newcommand*{\CatCode}{\catcode`} +%% As of v0.5, it may be defined by a different package: +\providecommand*{\CatCode}{\catcode`} %% \provi... 2012/08/27 % \newcommand*{\CatCode}[1]{\catcode`#1 } %% no better 2010/02/27 -%% With |\AssignCatCodeTo{<number>}{\<char>}|, -%% `\CatCode' may still be useful for displaying -%% (debugging or playing). -%% Note that `\<char>' is the {\it second} argument here. -\newcommand*{\AssignCatCodeTo}[2]{\catcode`#2=#1\relax} -%% |\MakeLetter\<char>| is used for \emph{private letters}, i.e., -%% to allow <char> in ``internal", non-user control sequences -%% ({\it\TeX book} Chap.\,3). -%% |\MakeOther| is just a different implementation of -%% \LaTeX's \cs{@makeother}. -\newcommand*\MakeLetter{\AssignCatCodeTo{11}} -\def \MakeOther {\AssignCatCodeTo{12}} -%% ... overriding 'fifinddo' if ... %% TODO 2010/03/12 -%% -%% |\MakeActive\<char>| just revives the meaning of <char> -%% it had most recently -%% (as an &\active character ... -%% maybe ``Undefined control sequence" unless ...) -%% This is fine for reviving 'niceverb' functionality -%% after having disabled it by `\MakeNormal'\linebreak[0]---provided -%% no other package used <char> actively in the meantime ... -\providecommand*{\MakeActive}{\AssignCatCodeTo\active} %% used v0.3 -%% We take a copy |\MakeActiveHere| of `\MakeActive' -%% as the latter may become a dangerous thing for compatibility -%% with 'hyperref'. -\@ifdefinable\MakeActiveHere{% - \let\MakeActiveHere\MakeActive} - %% <- TODO aliascid + elsewhere 2010/03/12 -%% |\MakeActiveLet\<char><macro name>| activates <char> -%% and then gives it the meaning of <macro name>. -\newcommand*{\MakeActiveLet}[2]{%% cf. \@sverb/\do@noligs (doc.sty) - \MakeActiveHere#1% %% 2010/03/12 - \begingroup - \lccode`\~`#1\relax \lowercase{\endgroup \let~#2}} -%% We take a copy |\MakeActiveLetHere| as well. +%% `\CatCode' is near to be moved into the 'catcodes' bundle, +%% and basic commands from 'stacklet' and 'actcodes' +%% may be reimplemented using it +%% ('manycats'; 'allcats' for loading entire 'catcodes' +%% in good order). +%% +%% |\AssignCatCodeTo{<number>}{\<char>}| \ %% \ 2012/08/28 +%% no longer is considered +%% useful (counted tokens in `memory.tex') and replaced by +%% `\CatCode'. +% \newcommand*{\AssignCatCodeTo}[2]{\catcode`#2=#1\relax} +%% |\MakeLetter\<char>| is replaced by the 'stacklet' package---I +%% thought, but \emph{here} it is also needed to declare +%% the ``private letters" of the package that is documented. +%% This should be ``variable." OK, the new (v0.5) `\private_letters' +%% is a step towards this: +\newcommand*{\private_letters}{\CatCode\@11\CatCode\_11\relax} +%% |\MakeOther\<char>| and |\MakeActive\<char>| were implemented +%% here before v0.5, now they are in 'actcodes'~... +% \def \MakeOther {\AssignCatCodeTo{12}} +%% % |\MakeActive\<char>| just revives the meaning of <char> +%% % it had most recently +%% % (as an &\active character ... +%% % maybe ``Undefined control sequence" unless ...) +%% % This is fine for reviving 'niceverb' functionality +%% % after having disabled it by `\MakeNormal'\linebreak[0]---provided +%% % no other package used <char> actively in the meantime ... +%% % % \providecommand*{\MakeActive}[1]{\CatCode#1\active} +%% % We take a copy |\MakeActiveHere| of `\MakeActive' +%% % as the latter may become a dangerous thing for compatibility +%% % with 'hyperref'. +%% % % \@ifdefinable\MakeActiveHere{% +%% % % \let\MakeActiveHere\MakeActive} +%% % % %% <- TODO aliascid + elsewhere 2010/03/12 +%% |\MakeActiveLet\<char>\<macro name>| +%% % is provided by 'actcodes' +%% % (which does not provide `\MakeActive'). %% rm. 2012/09/27 +%% % We take a copy |\MakeActiveLetHere| as well: +%% likewise is in 'actcodes'. 'niceverb' takes a copy +%% |\MakeActiveLetHere| of it for dealing with 'hyperref' +%% (see Section~\ref{sec:hyperref}). +%% 'hyperref'-compatibility of mere `\MakeActive' +%% is not provided any longer: \@ifdefinable\MakeActiveLetHere{% \let\MakeActiveLetHere\MakeActiveLet} %% %% |\MakeAlign\&| can be used to restore the meaning of `&' after we %% %% have made it `\active'. %% % \providecommand*{\MakeAlign} {\AssignCatCodeTo4} -%% We use the ``underscore" as a private letter -%% (the \LaTeX2 Project Team likes it as well). -%% Its usual meaning can be restored by |\MakeNormal\_| %% For restoring the usual category codes of \TeX's special %% characters later, we store them now. %% (I.e., these characters are listed in the macro `\dospecials' %% that expands to %% $$\mbox{\tt\def\do{\string\do\unskip\string}\dospecials}$$ %% their category codes are -%% {\AssignCatCodeTo{6}{\#}% -%% \AssignCatCodeTo{3}{\$}%% fifinddo-interference!? TODO 2010/02/27 -%% \AssignCatCodeTo{4}{\&}%% fifinddo-interference!? TODO 2010/02/27 +%% {\CatCode\#6%% was \AssignCat... 2012/08/27 +%% \CatCode\$3%% fifinddo-interference!? TODO 2010/02/27 +%% \CatCode\&4%% fifinddo-interference!? TODO 2010/02/27 %% \def\do#1{\def\do##1{, %% \the\CatCode##1}\the\CatCode#1}\dospecials} %% respectively; ``end of line", ``ignored", ``letter", ``other", and @@ -98,19 +108,16 @@ %% Also cf. 'ltfinal.dtx'. %% TODO: &\RestoreNormalCatcodes.} %% 2010/03/06 %% -%% Here we switch to the ``underscore" as a ``letter" indeed -%% (for the rest of the package): -\MakeLetter\_ - % \newcommand*{\make_iii_other}{\MakeOther\\\MakeOther\{\MakeOther\}} %% <- replaced 2009/04/05 %% |\MakeNormal\<char>| saves you from remembering ... \newcommand*{\MakeNormal}[1]{% \@ifundefined{\norm_catc_str#1}% {\MakeOther#1}% - {\AssignCatCodeTo{\csname\norm_catc_str#1\endcsname}#1}} + {\CatCode#1\csname\norm_catc_str#1\endcsname\relax}} \newcommand*{\norm_catc_str}{normal_catcode_\string} %% TODO add ^^I and ^^M + %% TODO save char tokens %% 2012/08/27 %% We take a copy |\MakeNormalHere| of `\MakeNormal' as %% with `\MakeActive'. \@ifdefinable\MakeNormalHere{\let\MakeNormalHere\MakeNormal} @@ -220,7 +227,7 @@ %% where it is too late to establish private letters %% according to next line which was in `\begin_min_verb' %% earlier---an important bug fix! - \MakeLetter\@\MakeLetter\_% + \private_letters %% v0.5 \cmd_syntax_verb }{\protect&\string}} \MakeNormal\& @@ -295,7 +302,7 @@ %% `\textunderscore', therefore restoring its category code %% needs some more care than with v0.32 and earlier: \edef\before_build_cs_sub{\the\CatCode\_}% - \MakeLetter\_\MakeLetter\@%% CAUTION, cf. ... + \private_letters %% v0.5 \test_more_cs} \newcommand*{\test_more_cs}{% \futurelet\let_token \decide_more_cs} @@ -662,6 +669,7 @@ \newcommand*{\dqtd}[1]{``#1"} %% %% ==== 'hyperref' ==== +%% \label{sec:hyperref} %% This is for\slash about compatibility with the 'hyperref' package. %% (One preliminary thing: in doubt, don't load 'niceverb' earlier %% than 'hyperref'.) %% TODO 2010/03/14 @@ -694,12 +702,15 @@ %% `\nofiles'. `\@auxout' may be `\@partaux' for `\include'. \newcommand*{\niceverb_aux_cat}[2]{% %% 2010/03/14 \protected@write\@auxout{}{\string#1\string#2}}% - \renewcommand*{\MakeActive}[1]{% - \MakeActiveHere#1% - \niceverb_aux_cat\MakeActiveHere#1}% +%% v0.5 restricts ``activating" to `\MakeActiveLet': +% \renewcommand*{\MakeActive}[1]{% +% \MakeActiveHere#1% +% \niceverb_aux_cat\MakeActiveHere#1}% \renewcommand*{\MakeActiveLet}[2]{% \MakeActiveLetHere#1#2% - \niceverb_aux_cat\MakeActiveHere#1}% +% \niceverb_aux_cat\MakeActiveHere#1}% + \protected@write\@auxout{}{% + \string\MakeActiveLetHere\string#1\string#2}}% \renewcommand*{\MakeNormal}[1]{% \MakeNormalHere#1% \niceverb_aux_cat\MakeNormalHere#1}% @@ -741,7 +752,7 @@ \AtBeginDocument{\useNiceVerb} %% %% === Leave Package Mode === -\MakeNormalHere\_ %% 2010/03/12 +\PopLetterCat\_ %% 2012/08/27 \endinput %% %% === VERSION HISTORY === @@ -835,3 +846,9 @@ with nicetext RELEASE r0.44 v0.45 2011/11/05 mod. \niceverb_collect_egroup/\VerticalCmdBox, tried \output problem without avail 2011/12/05 clarified "r0.44" +with nicetext RELEASE r0.5 +v0.5 2012/08/27 using 'catcodes', \providecommand\CatCode, + rm. \AssignCatCodeTo, \private_letters + 2012/08/28 fixed \private_letters; + rewording for filling lines + 2012/09/27 corrections about \MakeActive... |