summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/skeycommand/skeycommand.sty63
1 files changed, 42 insertions, 21 deletions
diff --git a/Master/texmf-dist/tex/latex/skeycommand/skeycommand.sty b/Master/texmf-dist/tex/latex/skeycommand/skeycommand.sty
index e9231f299e9..3123bb0a215 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.1. %
+% This is file 'skeycommand.sty', version 0.2. %
% %
% This package and accompanying files may be distributed and/or %
% modified under the conditions of the LaTeX Project Public License, %
@@ -25,7 +25,7 @@
\catcode123 01% {
\catcode125 02% }
\def\SKC@tempa{\endgroup
- \edef\SKC@reincodes{%
+ \edef\SKC@restorecodes{%
\catcode035 \the\catcode035% #
\catcode064 \the\catcode064% @
\catcode123 \the\catcode123% {
@@ -40,16 +40,16 @@
\catcode123 01% {
\catcode125 02% }
\def\SKC@catcode#1#2{%
- \edef\SKC@reincodes{%
- \SKC@reincodes
+ \edef\SKC@restorecodes{%
+ \SKC@restorecodes
\catcode#1 \the\catcode#1\relax
}%
\catcode#1 #2\relax
}
\AtEndOfPackage{%
\SKV@AfterPackageEnd{%
- \SKC@reincodes
- \SKV@Undef?{\SKC@catcode\SKC@reincodes}%
+ \SKC@restorecodes
+ \SKV@Undef?{\SKC@catcode\SKC@restorecodes}%
}%
}
\SKC@catcode{036}{03}% $
@@ -70,7 +70,7 @@
\def\SKC@rcsid$#1: #2 #3 #4 #5${#4 v#3}
\ProvidesPackage{skeycommand}[%
\SKC@rcsid
- $Id: skeycommand.sty,v 0.1 2010/05/05 09:00:00 Ahmed Musa $
+ $Id: skeycommand.sty,v 0.2 2010/05/20 09:00:00 Ahmed Musa $
Defining new commands and environments using keys (AM)
]
\NeedsTeXFormat{LaTeX2e}[1996/12/01]
@@ -96,6 +96,8 @@
\TestProvidedCommand\newdef{}{\let\newdef\SKV@def}
\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}}
@@ -106,7 +108,7 @@
\DeclareOptionX*{\SKC@warn{Unknown option '\CurrentOption' ignored}}
\ExecuteOptionsX[KV]<skeycmd>{verbose=false}
\ProcessOptionsX*[KV]<skeycmd>\relax
-\robustdef*\skeycommand#1{\setkeys[KV]{skeycmd}{#1}}
+\robustdef\skeycommand#1{\setkeys[KV]{skeycmd}{#1}}
\newdef*\SKC@fdigit#1{%
\let\SKC@resvda\@empty
\SKV@tfor{#1}\SKC@resvdb{%
@@ -123,7 +125,7 @@
\SKV@emptycmds{\SKC@keycmdlist,\SKC@k@ycmdlist}
\newdef\SKC@keycmd@i#1{%
\SKV@ensurescape{#1}%
- \gdef\SKC@keycmdname{#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}%
@@ -151,7 +153,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{%
@@ -163,7 +165,9 @@
\SKC@paramerr{#1}%
\SKV@testopt{\SKC@keycmd@vi[#1]}{}%
}
+\let\SKC@tag\z@
\newdef\SKC@keycmd@vi[#1][#2]#3{%
+ \let\SKC@tag\@ne
\edef\SKC@resvda##1##2{%
##1[\the\numexpr#1+1]\SKV@ifblank{#2}{}{[\unexpanded{#2}]}%
{\setkeys[KV]{\SKC@tfam}{####\the\numexpr#1+1}##2}%
@@ -172,6 +176,7 @@
{\def\SKC@resvdb{\newtwooptcmd*}}%
{\let\SKC@resvdb\newtwooptcmd}%
\SKC@resvda{\expandafter\SKC@resvdb\SKC@keycmdname}{#3}%
+ \let\SKC@tag\z@
}
\robustdef*\renewkeycmd{\@star@or@long\SKC@renewkeycmd@i}
\robustdef*\csrenewkeycmd{\SKV@aftercs\renewkeycmd}
@@ -195,7 +200,7 @@
}{}%
\edef\SKC@tfam{#1}%
\edef\SKC@pref{\SKV@carcube#1xxx\@nil @}%
- \xdef\SKC@keycmdname{\SKV@noexpcs{#1}}%
+ \edef\SKC@keycmdname{\SKV@noexpcs{#1}}%
\SKV@testopth\SKC@keyenviron@ii\SKC@pref
}
\newdef\SKC@keyenviron@ii<#1>{%
@@ -220,6 +225,7 @@
\SKV@testopt{\SKC@keyenviron@vi[#1]}{}%
}
\newdef\SKC@keyenviron@vi[#1][#2]#3#4{%
+ \let\SKC@tag\@ne
\edef\SKC@resvda##1##2{%
##1[\the\numexpr#1+1]\SKV@ifblank{#2}{}{[\unexpanded{#2}]}%
{\setkeys[KV]{\SKC@tfam}{####\the\numexpr#1+1}##2}%
@@ -233,6 +239,7 @@
}%
\SKC@resvdb{end\SKC@tfam}{#4}%
\SKC@resvda{\expandafter\SKC@resvdc\SKC@keycmdname}{#3}%
+ \let\SKC@tag\z@
}
\robustdef*\renewkeyenviron{\@star@or@long\SKC@renewkeyenviron@i}
\robustdef*\csrenewkeyenviron{\SKV@aftercs\renewkeyenviron}
@@ -297,9 +304,8 @@
}%
}
\newdef\SKC@protected@testopt#1{%
- \SKV@ifx\protect\@typeset@protect\SKV@testopt{\SKC@x@protect#1}%
+ \SKV@ifx\protect\@typeset@protect\SKV@testopt{\protect#1}%
}
-\newdef\SKC@x@protect#1#2#3{\protect#1}
\newdef\SKC@yargdef#1#2#3{%
\SKV@ifx{#2}\tw@
{\edef\SKC@shear##11{[\detokenize{####1}]}}%
@@ -361,20 +367,35 @@
\expandafter\SKC@resvda\SKC@resvdb\@nil
\SKV@scantoksa{\SKC@tempa,\SKC@tempb,\SKC@tempc}%
\edef\SKC@resvda{\expandafter\@gobble\string#2@SKC}%
- \edef\SKC@resvdb{\l@ngrel@x\def\noexpand#2\SKC@tempb
+ \def\SKC@resvdc{%
+ \edef\SKC@resvdb{\l@ngrel@x\def\SKV@noexpcs\SKC@resvda\SKC@tempc}%
+ \SKC@resvdb
+ }%
+ \edef\SKC@resvdb{%
\ifnum#1<\tw@
\ifx\SKC@shear\@gobble
- {\SKV@noexpcs\SKC@resvda{\SKC@tempa}}%
+ \ifx\SKC@tag\@ne
+ \l@ngrel@x\def\noexpand#2%
+ {\noexpand\SKV@testoptp\SKV@noexpcs\SKC@resvda{}}%
+ \unexpanded{\edef\SKC@resvdb{\l@ngrel@x\def\SKV@noexpcs
+ \SKC@resvda(\SKC@tempc)}\SKC@resvdb}%
+ \else
+ \l@ngrel@x\def\noexpand#2\SKC@tempb
+ {\SKV@noexpcs\SKC@resvda{\SKC@tempa}}%
+ \noexpand\SKC@resvdc
+ \fi
\else
- {\SKV@noexpcs\SKC@resvda\SKC@tempa}%
+ \l@ngrel@x\def\noexpand#2\SKC@tempb
+ {\SKV@noexpcs\SKC@resvda\SKC@tempa}%
+ \noexpand\SKC@resvdc
\fi
\else
- {\noexpand\SKV@testoptp{\SKV@noexpcs\SKC@resvda\SKC@tempa}{}}%
+ \l@ngrel@x\def\noexpand#2\SKC@tempb
+ {\noexpand\SKV@testoptp{\SKV@noexpcs\SKC@resvda\SKC@tempa}{}}%
+ \noexpand\SKC@resvdc
\fi
}%
\SKC@resvdb
- \edef\SKC@resvdb{\l@ngrel@x\def\SKV@noexpcs\SKC@resvda\SKC@tempc}%
- \SKC@resvdb
}
\newdef\SKC@reargdef#1[#2]{\SKC@yargdef#1\@ne{#2}}
\robustdef*\renewtwooptcmd{\@star@or@long\SKC@renewcommand@i}
@@ -438,8 +459,8 @@
}
\robustdef*\SKC@nilkeylist{%
\SKC@err{%
- No key list submitted.\SKV@MB
- Why use keycommand without keys?
+ 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