From 8918c746e16f948b427ad09021ef1af0a81f8136 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 28 Sep 2012 22:47:02 +0000 Subject: nicetext (28sep12) git-svn-id: svn://tug.org/texlive/trunk@27843 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/nicetext/fifinddo.sty | 61 +++++----- Master/texmf-dist/tex/latex/nicetext/makedoc.cfg | 27 +++-- Master/texmf-dist/tex/latex/nicetext/makedoc.sty | 19 ++-- Master/texmf-dist/tex/latex/nicetext/nicetext.RLS | 1 + Master/texmf-dist/tex/latex/nicetext/niceverb.sty | 133 ++++++++++++---------- Master/texmf-dist/tex/latex/nicetext/stacklet.sty | 119 +++++++++++++++++++ 6 files changed, 245 insertions(+), 115 deletions(-) create mode 100644 Master/texmf-dist/tex/latex/nicetext/stacklet.sty (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/nicetext/fifinddo.sty b/Master/texmf-dist/tex/latex/nicetext/fifinddo.sty index d8bb3ef6a94..23c2eaa8e02 100644 --- a/Master/texmf-dist/tex/latex/nicetext/fifinddo.sty +++ b/Master/texmf-dist/tex/latex/nicetext/fifinddo.sty @@ -5,7 +5,7 @@ %% for processing tex(t) files %% (checking, filtering, converting, substituting, expanding, ...) -\def\fileversion{0.51} \def\filedate{2012/03/17} +\def\fileversion{0.6} \def\filedate{2012/08/27} %% This file can be redistributed and/or modified under %% the terms of the LaTeX Project Public License; either @@ -29,20 +29,20 @@ filtering TeX(t) files by TeX (UL)] %% %% === Category codes === -%% -%% We use the ``underscore" as ``compound identifier." -\catcode`\_=11 %% underscore used in control words -%% -%% |\MakeOther| is a synonym for `\@makeother', needed for matching -%% special characters from the input file. It is exemplified by -%% |\fdPatternCodes| which is the default of |\PatternCodes|. -%% The latter is used in setup macros for reading patterns. +%% We use the ``underscore" as ``compound identifier:" +\RequirePackage{stacklet} \PushCatMakeLetter\_ %% 2012/08/27 +%% v0.6 moves definition of |\MakeActiveDef| to 'actcodes' +%% in the 'catcodes' bundle: +\RequirePackage{actcodes} +%% 'fifinddo' uses \TeX's feature of delimited macro parameters +%% for matching \emph{strings} of characters. +%% In order to get expected results, \emph{category codes} must match as well. +%% |\PatternCodes| is used in setup macros for reading patterns +%% for this purpose. It defaults to |\fdPatternCodes|. %% We offer |\SetPatternCodes{}| -%% (redefining `\PatternCodes') -%% and |\ResetPatternCodes| -%% (for returning to `\fdPatternCodes') +%% for redefining `\PatternCodes' +%% and |\ResetPatternCodes| for returning to `\fdPatternCodes', %% so setup scripts such as 'mdoccorr.cfg' have shorter lines. -\@ifundefined{MakeOther}{\let\MakeOther\@makeother}{} \newcommand*{\fdPatternCodes}{\MakeOther\&\MakeOther\$} \newcommand*{\SetPatternCodes}{\def\PatternCodes} \newcommand*{\ResetPatternCodes}{\let\PatternCodes\fdPatternCodes} @@ -61,8 +61,11 @@ %% in your `\PatternCodes', or |\Delimiters| to introduce %% new ones at the same time, e.g., `\Delimiters\[\]': \newcommand*{\Delimiters}[2]{% - \MakeOther\{\MakeOther\}\catcode`#1\@ne \catcode`#2=\tw@} -%% + \MakeOther\{\MakeOther\}\CatCode#1\@ne \CatCode#2=\tw@} +%% |\CatCode\| is introduced for v0.6. +%% It should appear in a package 'manycats' of the 'catcodes' +%% bundle, but that's to much for 2012/08/27---TODO. +\providecommand*{\CatCode}{\catcode`} %% For replacing strings or for defining other strings of ``other" %% characters by `\edef', you can use some \LaTeX\ constructs---here %% are copies |\PercentChar| and |\BackslashChar| of them @@ -74,29 +77,20 @@ %% |\BasicNormalCatcodes| restores Plain~\TeX's %% \textbf{macro parsing} and comment character: \newcommand*{\BasicNormalCatCodes}{% - \catcode`\\\z@ \Delimiters\{\}% + \CatCode\\\z@ \Delimiters\{\}% % \restorecr !? - \catcode`\ =10 \catcode`\%=14} + \CatCode\ =10 \CatCode\%=14} %% However, reading files \emph{line by line} makes parsing of %% macro parameters somewhat difficult %% when the parameter code spans code lines. %% A line must not end with a curly brace when a macro requires %% another parameter; instead, it must contain the curly left %% brace for the next parameter. +%% +%% `\BasicNormalCatCodes' may be reimplemented by a package +%% 'normcats' in the 'catcodes' bundle---TODO~... %% -%% |\MakeActiveDef\{}| makes an active -%% character expanding to -\newcommand*{\MakeActiveDef}[1]{% - \catcode`#1\active - \begingroup - \lccode`\~`#1\relax \lowercase{\endgroup \def~}} -%% (cf. `\@sverb'/`\do@noligs' in \LaTeX's 'doc.sty'). -%% This even allows defining active characters with parameters -%% (suggested by Heiko Oberdiek LATEX-LIST 2010/09/18, -%% may be nice for UTF-8). -%% The macro has been used for conversion of text encodings. -%% %% <- TODO atari.fdf -%% +%% %% rm. \MakeActiveDef 2012/08/27 %% %% == File handling == %% %% structured 2011/11/19 @@ -278,7 +272,7 @@ \newcommand*{\ProcessFinalFileWith}{% \FinalInputFiletrue \ProcessFileWith} %% -%% \pagebreak %% 2011/11/19 again +%% \pagebreak %% 2011/11/19 again %% == Basic handling of substring conditionals == %% \label{sec:theory} %% %% TODO move theory to fifinddo.tex 2009/04/12 @@ -1013,7 +1007,7 @@ %% == Leave package mode == %% We restore the underscore `_' for math subscripts. %% (This might better depend on something \dots) %% TODO 2009/04/07 -\catcode`\_=8 +\PopLetterCat\_ %% 2012/08/27 %% \endinput %% \TeX\ ignores the rest of the file when it is \emph{input} @@ -1134,6 +1128,7 @@ v0.44 2011/10/23 messages from \ResultFile and \CloseResultFile -> r0.46 v0.45 2011/10/26 little modification of \CloseResultFile message, "sacrificing" \pagebreak before Sec. 4 -- fine! + v0.5 2011/11/13 \PrependExpandableAllReplacer*, \MakeSetupCommand; doc.: {center} with too long verbatim quote 2011/11/19 input check fixed, doc. there adjusted, @@ -1144,5 +1139,7 @@ v0.5 2011/11/13 \PrependExpandableAllReplacer*, \MakeSetupCommand; -> r0.5 v0.51 2012/01/20 updated (C); TODO on pseudo-tilde 2012/03/17 fixed \FDnormalTilde/\FDpseudoTilde + -> r0.53 +v0.6 2012/08/27 using 'catcodes', introducing \CatCode TODO: cleveref 2010/03/18 diff --git a/Master/texmf-dist/tex/latex/nicetext/makedoc.cfg b/Master/texmf-dist/tex/latex/nicetext/makedoc.cfg index e14efcd8b9d..3f81eb7de0c 100644 --- a/Master/texmf-dist/tex/latex/nicetext/makedoc.cfg +++ b/Master/texmf-dist/tex/latex/nicetext/makedoc.cfg @@ -1,4 +1,4 @@ -\ProvidesFile{makedoc.cfg}[2012/05/10 documentation settings] +\ProvidesFile{makedoc.cfg}[2012/07/13 documentation settings] \author{Uwe L\"uck\thanks{\url{http://contact-ednotes.sty.de.vu}}} % \author{Uwe L\"uck---{\tt http://contact-ednotes.sty.de.vu}} @@ -52,26 +52,19 @@ \hypersetup{% pdfauthor={Uwe L\374ck}% } - \RequirePackage{niceverb}[2011/01/24] \RequirePackage{readprov} %% 2010/12/08 \RequirePackage{hypertoc} %% 2011/01/23 \RequirePackage{texlinks} %% 2011/01/24 \RequirePackage{relsize} %% 2011/06/27 \RequirePackage{color} %% 2011/08/06 +%% Logical markup |\strong{}|, |\file{}|, |\acro{}|, +%% |\meta{}|, |\pkg{}|, |\code{}|: \makeatletter - \@ifdefinable{strong} - {\let\strong\textbf} %% 2011/01/24 - \@ifdefinable{file} - {\let\file\texttt} %% 2011/05/23 - \@ifdefinable{acro} - {\let\acro\textsmaller} %% 2011/05/23 - \@ifdefinable{\meta} - {\let\meta\textit} %% 2011/07/22 - \@ifdefinable{\pkg} %% corr. 2011/11/20 - {\let\pkg\textsf} %% 2011/11/09 - \@ifdefinable{\code} - {\let\code\texttt} %% 2011/11/20 + \def\do#1#2{\@ifdefinable#1{\let#1#2}}%% 2012/07/13 + \do\strong\textbf \do\file\texttt \do\acro\textsmaller + %% <- wrong tests before 2012/07/13 + \do\meta\textit \do \pkg\textsf \do\code\texttt \ifpdf \pdfstringdefDisableCommands{% \let\acro\textrm @@ -82,6 +75,12 @@ \fi %% TODO 2011/07/22 -> `htlogml.sty' \makeatother +\newcommand*{\pkgtitle}[2]{% %% 2012/07/13 + \global\let\pkgtitle\relax + \pkg{\huge #1}\\---\\#2\thanks{This + document describes version + \textcolor{blue}{\UseVersionOf{\jobname.sty}} + of \textsf{\jobname.sty} as of \UseDateOf{\jobname.sty}.}} \errorcontextlines=4 \pagestyle{headings} diff --git a/Master/texmf-dist/tex/latex/nicetext/makedoc.sty b/Master/texmf-dist/tex/latex/nicetext/makedoc.sty index 2ae18c94962..2c529456621 100644 --- a/Master/texmf-dist/tex/latex/nicetext/makedoc.sty +++ b/Master/texmf-dist/tex/latex/nicetext/makedoc.sty @@ -4,7 +4,7 @@ %% -- author-maintained in the sense of LPPL below -- %% for preparing documentations from packages. -\def\fileversion{0.51} \def\filedate{2012/04/03} +\def\fileversion{0.52} \def\filedate{2012/08/28} %% This file can be redistributed and/or modified under %% the terms of the LaTeX Project Public License; either @@ -39,14 +39,10 @@ \PackageCodeFalse %% %% 'makedoc' is an extension of 'fifinddo' on which it depends. -\RequirePackage{fifinddo}[2009/04/13] -%% Both 'fifinddo' and 'makedoc' use the ``underscore" `_' -%% as ``private letter" and restore its standard ``subscript" -%% function ({\it \TeX book Chap.\,7}) at their end. -%% Push\slash pop functionality as with `@' and `\RequirePackage' -%% is missing here. So after loading 'fifinddo', -%% we need to declare our private letter (again). -\catcode`\_=11 %% underscore used in control words +\RequirePackage{fifinddo}[2012/08/27] +%% 'fifinddo' v0.6 loads 'stacklet.sty', so we can use %% 2012/08/28 +%% the underscore as a ``private letter" by the following: +\PushCatMakeLetter\_ %% 2012/08/28 %% %% \subsection{&\MakeDocCorrectHook\ (\dqtd{`txt2TeX'})} %% \label{sec:mdoccorr} %% 2012/03/17 @@ -589,8 +585,8 @@ } %% This feature may \emph{change}. %% -%% \subsection{Leaving the package} %% mod. 2012/03/18 -\catcode`\_=8 %% restores underscore use for subscripts +%% \subsection{Leaving the package} %% mod. 2012/03/18 +\PopLetterCat\_ %% 2012/08/28 \endinput %% %% \subsection{VERSION HISTORY} @@ -643,3 +639,4 @@ v0.5 2012/03/17 removing 1 \make_job_doc TODO; star versions; 2012/03/18 star variants completed, copyright updated, doc. "Leaving" v0.51 2012/04/03 \_makedoc_autocorr_true +v0.52 2012/08/28 using `stacklet.sty' diff --git a/Master/texmf-dist/tex/latex/nicetext/nicetext.RLS b/Master/texmf-dist/tex/latex/nicetext/nicetext.RLS index ece914ff365..a56f9da94c2 100644 --- a/Master/texmf-dist/tex/latex/nicetext/nicetext.RLS +++ b/Master/texmf-dist/tex/latex/nicetext/nicetext.RLS @@ -1,3 +1,4 @@ \ProvidesFile{nicetext.RLS} %% RELEASE INFO + [2012/09/28 r0.6 use & adapt to `catcodes', \string\pkgtitle] [2012/05/27 r0.53 makedoc.cfg \string\MDaddtoabstract] [2012/04/03 r0.52 bug fix] %% 2012/05/26 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{\}| %% (or simply |\CatCode\|) %% 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{}{\}|, -%% `\CatCode' may still be useful for displaying -%% (debugging or playing). -%% Note that `\' is the {\it second} argument here. -\newcommand*{\AssignCatCodeTo}[2]{\catcode`#2=#1\relax} -%% |\MakeLetter\| is used for \emph{private letters}, i.e., -%% to allow 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\| just revives the meaning of -%% 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 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\| activates -%% and then gives it the meaning of . -\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{}{\}| \ %% \ 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\| 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\| and |\MakeActive\| were implemented +%% here before v0.5, now they are in 'actcodes'~... +% \def \MakeOther {\AssignCatCodeTo{12}} +%% % |\MakeActive\| just revives the meaning of +%% % 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 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\\| +%% % 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\| 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... diff --git a/Master/texmf-dist/tex/latex/nicetext/stacklet.sty b/Master/texmf-dist/tex/latex/nicetext/stacklet.sty new file mode 100644 index 00000000000..3324a8391e3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/nicetext/stacklet.sty @@ -0,0 +1,119 @@ + \input plainpkg +\ProvidesPackage{stacklet}[2012/08/27 v0.3 private letters (UL)] +%% +%% Copyright (C) 2012 Uwe Lueck, +%% http://www.contact-ednotes.sty.de.vu +%% -- author-maintained in the sense of LPPL below -- +%% +%% This file can be redistributed and/or modified under +%% the terms of the LaTeX Project Public License; either +%% version 1.3c of the License, or any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% There is NO WARRANTY (actually somewhat experimental). +%% +%% Please report bugs, problems, and suggestions via +%% +%% http://www.contact-ednotes.sty.de.vu +%% +%% == Usage == +%% === Installing and Calling === +%% The file `stacklet.sty' is provided ready, +%% installation only requires +%% putting it somewhere where \TeX\ finds it +%% (which may need updating the filename data +%% base).\urlfoot{ukfaqref}{inst-wlcf} +%% However, the file `plainpkg.tex' must be installed likewise. +%% +%% \emph{With} \LaTeX, the file should be loaded by `\RequirePackage{stacklet}' +%% or `\usepackage{stacklet}'. +%% +%% \emph{Without} \LaTeX, both `\input stacklet.sty' and +%% `\input plainpkg' load `stacklet.sty'. +%% +%% === Commands and Syntax === +%% \label{sec:stacklet-cmds} +%% 'stacklet.sty' provides +%% \[|\PushCatMakeLetter\| +%% \quad \textit{and}\quad +%% |\PopLetterCat\|\] +%% for getting ``private letters" and giving them back +%% their previous category code +%% in package files with or without \LaTeX. +%% As \LaTeX\ has its own stack for `@', there are also +%% \[|\PushCatMakeLetterAt| +%% \quad \textit{and}\quad +%% |\PopLetterCatAt|\] +%% that care for `@''s category code \emph{without} \LaTeX\ only. +%% +%% == The Code == +%% === Name Space === +%% Each ``private letter" gets its own stack, +%% in some name space, determined by |\cat_stack| +%% (`\withcsname' is from 'plainpkg.tex'): +\withcsname\xdef cat_stack\endcsname{% + \noexpand\string \withcsname\noexpand cat_stack\endcsname + \noexpand\string} +%% I.e., ?`cat_stack' will expand to +%% \[?`string'\,?`cat_stack'\,?`string'\] +%% in the notation of the \ctanpkgref{dowith} package. +% \withcsname\show cat_stack\endcsname +%% +%% === Pushing === +%% |\PushCatMakeLetter\| ... +\xdef\PushCatMakeLetter#1{% + \noexpand\withcsname + \withcsname\noexpand pushcat_makeletter\endcsname + \withcsname\noexpand cat_stack\endcsname#1\endcsname#1} +% \show\PushCatMakeLetter +\withcsname\gdef pushcat_makeletter\endcsname#1#2{% +%% #1 is the stack token, #2 is the ``quoted" character. Pushing~... + \xdef#1{\the\catcode`#2\relax% +%% ... the new entry. `\relax' separates entries, +%% braces instead tend to get lost in popping ... +%% If the stack has existed before, +%% its previous content is appended: + \ifx#1\relax \else #1\fi}% +%% I thought of storing `\catcode's hexadecimally (without braces) +%% using \LaTeX's `\hexnumber', but the latter has so many tokens~... +%% Finally rendering a ``letter": + \catcode`#211\relax} +%% Now we can use a ``private letter stack" for our own package: +\PushCatMakeLetter\_ +%% +%% === Popping === +%% |\PopLetterCat\| passes `\', the corresponding +%% stack token, and the latter's expansion to `\popcat_'. +%% `\end' serves as argument delimiter for the end of the stack only: +\gdef\PopLetterCat#1{% + \expandafter\expandafter\expandafter + \popcat_\csname\cat_stack#1\expandafter\endcsname + \expandafter \end \csname\cat_stack#1\endcsname#1} +%% `\popcat_' parses the expansion, assigns the old +%% category code and and stores the reduced stack: +\gdef\popcat_#1\relax#2\end#3#4{\catcode`#4#1\gdef#3{#2}} +%% ... check existence? TODO +%% +%% === No `@' Stack with \LaTeX === +%% |\PushCatMakeLetterAt| is like `\PushCatMakeLetter\@' +%% except that it has no effect under \LaTeX: +\gdef\PushCatMakeLetterAt{\ifltx\else\PushCatMakeLetter\@\fi} +%% |\PopLetterCatAt| by analogy ... +\gdef\PopLetterCatAt{\ifltx\else\PopLetterCat\@\fi} +%% +%% === Leaving the Package File === +%% ... in our new way: +\PopLetterCat\_ +\endinput +%% +%% === VERSION HISTORY === + +v0.1 2012/08/24 started + 2012/08/25 completed + 2012/08/26 extending doc.; \def\withcsname removed +v0.2 2012/08/26 \with_catstack containing \endcsname and with + three popping macros replaced by \csname + content \cat_stack, cf. memory.tex; + restructured + 2012/08/27 \PushCatMakeLetterAt fixed +v0.3 2012/08/27 def.s global -- cgit v1.2.3