diff options
author | Karl Berry <karl@freefriends.org> | 2010-05-25 23:23:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-05-25 23:23:51 +0000 |
commit | 30ffebfa9605d5de08c5f6158caa022ac3a8cb4a (patch) | |
tree | 21f8b273f171c850ac5399fd6402744257f98485 /Master/texmf-dist/tex/latex/skeycommand | |
parent | 053e863d132996b7ab5686ede2b74dba754e9f94 (diff) |
skeycommand update (25may10)
git-svn-id: svn://tug.org/texlive/trunk@18493 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/skeycommand')
-rw-r--r-- | Master/texmf-dist/tex/latex/skeycommand/skeycommand.sty | 102 |
1 files changed, 55 insertions, 47 deletions
diff --git a/Master/texmf-dist/tex/latex/skeycommand/skeycommand.sty b/Master/texmf-dist/tex/latex/skeycommand/skeycommand.sty index 3123bb0a215..bcbd07963e1 100644 --- a/Master/texmf-dist/tex/latex/skeycommand/skeycommand.sty +++ b/Master/texmf-dist/tex/latex/skeycommand/skeycommand.sty @@ -1,6 +1,6 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% % % -% This is file 'skeycommand.sty', version 0.2. % +% This is file 'skeycommand.sty', version 0.3. % % % % This package and accompanying files may be distributed and/or % % modified under the conditions of the LaTeX Project Public License, % @@ -49,9 +49,11 @@ \AtEndOfPackage{% \SKV@AfterPackageEnd{% \SKC@restorecodes - \SKV@Undef?{\SKC@catcode\SKC@restorecodes}% + \SKV@Undef!{\SKC@catcode\SKC@restorecodes}% }% } +\SKC@catcode{032}{10}% SP +\SKC@catcode{033}{12}% ! \SKC@catcode{036}{03}% $ \SKC@catcode{038}{03}% & \SKC@catcode{040}{12}% ( @@ -70,7 +72,7 @@ \def\SKC@rcsid$#1: #2 #3 #4 #5${#4 v#3} \ProvidesPackage{skeycommand}[% \SKC@rcsid - $Id: skeycommand.sty,v 0.2 2010/05/20 09:00:00 Ahmed Musa $ + $Id: skeycommand.sty,v 0.3 2010/05/21 09:00:00 Ahmed Musa $ Defining new commands and environments using keys (AM) ] \NeedsTeXFormat{LaTeX2e}[1996/12/01] @@ -90,25 +92,26 @@ \endinput }% }{% - \RequirePackage[verbose=true,keyparser=;,macroprefix=mp@, - keyprefix=KV,keyfamily=fam]{skeyval}[2010/05/01] + \RequirePackage[keyparser=;,keyprefix=KV,keyfamily=skeycommand, + macroprefix=skc@]{skeyval}[2010/05/01] } -\TestProvidedCommand\newdef{}{\let\newdef\SKV@def} +\TestProvidedCommand\newdef{}{\let\newdef\SKV@newdef} \TestProvidedCommand\robustdef{}{\let\robustdef\SKV@pdef} \TestProvidedCommand\redef{}{\let\redef\SKV@redef} -\ReserveMacroPrefixNames*{SKC} -\ReserveFamilyNames*{skeycmd} -\robustdef\SKC@info#1{\PackageInfo{skeycommand}{#1\@gobble}} -\robustdef\SKC@warn#1{\PackageWarningNoLine{skeycommand}{#1}} -\robustdef\SKC@err#1#2{\PackageError{skeycommand}{#1}{#2}} +\UseSkeyvalSetkeys +\ReserveMacroPrefixNames*{SKC@} +\ReserveFamilyNames*{skeycommand} +\robustdef*\SKC@info#1{\PackageInfo{skeycommand}{#1\@gobble}} +\robustdef*\SKC@warn#1{\PackageWarningNoLine{skeycommand}{#1}} +\robustdef*\SKC@err#1#2{\PackageError{skeycommand}{#1}{#2}} \NewBooleans[SKC@sw]{a}[false] -\newbiboolkeys[KV]{skeycmd}[SKC@]{verbose}[true]{silent}{% +\newbiboolkeys[KV]{skeycommand}[SKC@]{verbose}[true]{silent}{% \setkeys[KV]{skeyval}{verbose=true}}% {\setkeys[KV]{skeyval}{verbose=false}} \DeclareOptionX*{\SKC@warn{Unknown option '\CurrentOption' ignored}} -\ExecuteOptionsX[KV]<skeycmd>{verbose=false} -\ProcessOptionsX*[KV]<skeycmd>\relax -\robustdef\skeycommand#1{\setkeys[KV]{skeycmd}{#1}} +\ExecuteOptionsX[KV]<skeycommand>{verbose=false} +\ProcessOptionsX*[KV]<skeycommand>\relax +\robustdef*\skeycommand#1{\setkeys[KV]{skeycommand}{#1}} \newdef*\SKC@fdigit#1{% \let\SKC@resvda\@empty \SKV@tfor{#1}\SKC@resvdb{% @@ -120,15 +123,22 @@ }% } \let\SKC@rskey\SKV@resolvekey +\newdef*\SKV@everyeoehook{} +\robustdef*\everyeoe#1{% + \SKV@ifempty{#1}% + {\let\SKV@everyeoehook\@empty}% + {\SKV@prepto!\SKV@everyeoehook{#1}}% +} +\everyeoe{\@ignoretrue} \robustdef*\newkeycmd{\@star@or@long\SKC@keycmd@i} \robustdef*\csnewkeycmd{\SKV@aftercs\newkeycmd} \SKV@emptycmds{\SKC@keycmdlist,\SKC@k@ycmdlist} -\newdef\SKC@keycmd@i#1{% +\newdef*\SKC@keycmd@i#1{% \SKV@ensurescape{#1}% \def\SKC@keycmdname{#1}% \edef\SKC@tfam{\expandafter\@gobble\string#1}% - \edef\SKC@pref{\expandafter\expandafter\expandafter% - \SKV@carcube\expandafter\@gobble\string#1xxx\@nil}% + \edef\SKC@pref{\SKV@threexp\SKV@carcube + \expandafter\@gobble\string#1xxx\@nil}% \edef\SKC@pref{\SKC@pref @}% \SKV@scantoksa{\SKC@tfam,\SKC@pref}% \SKV@testopth\SKC@keycmd@ii\SKC@pref @@ -153,7 +163,7 @@ \SKV@testopt\SKC@keycmd@v{0}% } \newdef\SKC@keycmd@iv#1{% - \SKV@emptycmds?{\SKC@keycmdlist,\SKC@k@ycmdlist}% + \SKV@emptycmds!{\SKC@keycmdlist,\SKC@k@ycmdlist}% \XKV@checksanitizea{#1}\SKC@tempa \SKV@normalizea\SKC@tempa \SKV@for*[,]\SKC@tempa\SKC@tempa{% @@ -187,7 +197,6 @@ Use '\string\newkeycmd' instead.}% }% \let\SKV@ifdefinable\SKC@rc@ifdefinable - \let\@ifdefinable\@rc@ifdefinable \SKC@keycmd@i#1% } \robustdef*\newkeyenviron{\@star@or@long\SKC@keyenviron@i} @@ -195,8 +204,8 @@ \newdef\SKC@keyenviron@i#1{% \SKV@ensurenoscape{#1}% \SKV@ifcsdef{#1}{% - \SKV@err{You have submitted an existing macro '\string#1' as an\SKV@MB - environment name}{'\string#1' not allowed as environment name}% + \SKC@err{You have submitted an existing macro '\string#1' as an\SKV@MB + environment name}{'\string#1' not allowed as environment name.}% }{}% \edef\SKC@tfam{#1}% \edef\SKC@pref{\SKV@carcube#1xxx\@nil @}% @@ -237,7 +246,7 @@ \let\SKC@resvdb\SKV@csdef \let\SKC@resvdc\newtwooptcmd }% - \SKC@resvdb{end\SKC@tfam}{#4}% + \SKC@resvdb{end\SKC@tfam}{#4\SKV@everyeoehook}% \SKC@resvda{\expandafter\SKC@resvdc\SKC@keycmdname}{#3}% \let\SKC@tag\z@ } @@ -245,10 +254,10 @@ \robustdef*\csrenewkeyenviron{\SKV@aftercs\renewkeyenviron} \newdef*\SKC@renewkeyenviron@i#1{% \SKV@ifcsdef{#1}{}{% - \SKV@err{Environment '#1' undefined}% + \SKC@err{Environment '#1' undefined}% {Undefined environment '#1' can't be redefined.}% }% - \SKV@Undef+?{#1,end#1}% + \SKV@Undef+!{#1,end#1}% \SKC@keyenviron@i{#1}% } \newdef\SKC@getkeyname#1=#2=#3\@nil{% @@ -269,11 +278,11 @@ \SKV@checkchoice{#2}{true,on,false,off}{% \def\SKC@tempa{bool}}{\def\SKC@tempa{cmd}}% \SKV@oifblank{#1}{}{% - \edef\SKC@resvd##1{\SKV@addtolist?[;]##1{\SKC@tempa,% + \edef\SKC@resvd##1{\SKV@addtolist![;]##1{\SKC@tempa,% \SKV@expox{#1},\SKV@expox{#2},}}% \SKC@resvd\SKC@keycmdlist \SKV@expnext\SKC@fpointers#1% - \edef\SKC@resvd##1{\SKV@addtolist?[,]##1{\SKV@expox\SKC@resa + \edef\SKC@resvd##1{\SKV@addtolist![,]##1{\SKV@expox\SKC@resa =\SKV@expox{#2}}}% \SKC@resvd\SKC@k@ycmdlist }% @@ -358,7 +367,7 @@ }% \expandafter\SKC@resvda\SKC@resvdb\@nil }% - \SKV@iftest{num}{#1=0}{% + \SKV@ifnum{#1}=\z@{% \SKV@emptycmds{\SKC@tempa,\SKC@tempb,\SKC@tempc}% }{% \SKV@expnext\SKC@resvda{\the\numexpr#1-1}% @@ -417,10 +426,10 @@ \newdef*\renewtwooptenviron{\@star@or@long\SKC@renewenvironment@i} \newdef*\SKC@renewenvironment@i#1{% \SKV@ifcsdef{#1}{}{% - \SKV@err{Environment '#1' undefined}% - {Environment '#1' can't be redefined}% + \SKC@err{Environment '#1' undefined}% + {Undefined environment '#1' can't be redefined.}% }% - \SKV@Undef+?{#1,end#1}% + \SKV@Undef+!{#1,end#1}% \SKC@newenvironment@i{#1}% } \newdef\SKC@newenv#1#2#3#4{% @@ -430,15 +439,15 @@ } \robustdef*\SKC@nilprefix{% \SKC@err{% - No key-value prefix submitted.\SKV@MB - The prefix will be used to hold your values\SKV@MB - for the declared keys + No macro prefix submitted. The prefix will\SKV@MB + be used to hold your values for the declared keys\SKV@MB }{% - Keycommand requires key-value prefix.\SKV@MB - I guess you submitted an empty prefix using '<>'.\SKV@MB - I can use the default key-value prefix 'skv' if\SKV@MB - you don't submit any prefix. In that case\SKV@MB - leave out '<>' from your command. + Keycommand requires macro prefix. I guess you\SKV@MB + submitted an empty prefix using '<>'. I can use\SKV@MB + the default macro prefix (the first three\SKV@MB + letters of your key command) if you don't submit\SKV@MB + any prefix. In that case leave out '<>' from your\SKV@MB + command. }% } \robustdef*\SKC@badprefix#1{% @@ -448,9 +457,9 @@ '\string#1' is likely a wrong macro prefix }{% I expected letters here, not digits.\SKV@MB - OK, digits are actually acceptable as prefix\SKV@MB - but you need to be wary of them if they appear\SKV@MB - in your control sequences. Also, I fear\SKV@MB + OK, digits are actually acceptable as macro\SKV@MB + prefix but you need to be wary of them if they\SKV@MB + appear in your control sequences. Also, I fear\SKV@MB you may have wrongly entered the number of\SKV@MB arguments of your key command here, instead\SKV@MB of putting it in the right place (in square brackets). @@ -462,14 +471,13 @@ No key list submitted or wrong command syntax.\SKV@MB Please see the user guide. }{% - Keycommand requires keys.\SKV@MB - Perhaps you submitted an empty key list,\SKV@MB - or your arguments to command are inconsistent.\SKV@MB - Please see the user guide. + Keycommand requires keys. Perhaps you submitted\SKV@MB + an empty key list, or your arguments to command\SKV@MB + are inconsistent. Please see the user guide.\SKV@MB }% } \newdef*\SKC@paramerr#1{% - \SKV@uniftest{num}{#1>8}{}{% + \SKV@ifnum{#1}<9{}{% \SKC@err{% Number '\string#1' of parameters too large }{% |