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 +++++++++++------------ 1 file changed, 29 insertions(+), 32 deletions(-) (limited to 'Master/texmf-dist/tex/latex/nicetext/fifinddo.sty') 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 -- cgit v1.2.3