diff options
author | Karl Berry <karl@freefriends.org> | 2008-08-12 16:56:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-08-12 16:56:06 +0000 |
commit | 8c066540a7bd83ff7638b25ad92dad4d026ab475 (patch) | |
tree | a9a2b8e38bcad90b98554e479928c5475e1c21d4 /Master/texmf-dist/source | |
parent | a99c4e8395a5b21d490715a1bf0f86eac4a679ff (diff) |
xkeyval 2.6 (11aug08)
git-svn-id: svn://tug.org/texlive/trunk@10273 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/xkeyval/xkeyval.dtx | 92 |
1 files changed, 59 insertions, 33 deletions
diff --git a/Master/texmf-dist/source/latex/xkeyval/xkeyval.dtx b/Master/texmf-dist/source/latex/xkeyval/xkeyval.dtx index 20daa13d6a9..985f46dd065 100644 --- a/Master/texmf-dist/source/latex/xkeyval/xkeyval.dtx +++ b/Master/texmf-dist/source/latex/xkeyval/xkeyval.dtx @@ -25,7 +25,7 @@ % pst-xkey.sty % %% --------------------------------------- -%% Copyright (C) 2004-2006 Hendri Adriaens +%% Copyright (C) 2004-2008 Hendri Adriaens %% --------------------------------------- %% %% This work may be distributed and/or modified under the @@ -93,14 +93,16 @@ \bibliographystyle{plain} \bibliography{xkeyval} \section*{Acknowledgements} -The author is grateful to Josselin Noirel, Till Tantau, Herbert -Vo\ss, Carsten Heinz and Heiko Oberdiek for help and suggestions. Thanks go to -Donald Arseneau for contributing the robust |\@ifnextcharacter| macro and -to Morten H\o gholm for contributing a fast for-loop macro. Special -thanks go to Uwe Kern for his ideas for improving the functionality -of this package, a lot of useful comments on the package and the -documentation and for contributing the |\@selective@sanitize| macro. -\PrintChangesX\PrintIndexX +The author is grateful to Carsten Heinz, Morten H\o gholm, +Josselin Noirel, Heiko Oberdiek, Will Robertson, Till Tantau, +Herbert Vo\ss and Joseph Wright for help and suggestions. +Thanks go to Donald Arseneau for contributing the robust +|\@ifnextcharacter| macro and to Morten H\o gholm for +contributing a fast for-loop macro. Special thanks go to Uwe +Kern for his ideas for improving the functionality of this +package, a lot of useful comments on the package and the +documentation and for contributing the |\@selective@sanitize| +macro. \PrintChangesX\PrintIndexX \end{document} %</driver> % \fi @@ -173,10 +175,13 @@ documentation and for contributing the |\@selective@sanitize| macro. % \changes{v2.5d}{2005/08/12}{Added missing \cs{filename@area} in % document class retrieval in \texttt{xkeyval.sty}} % \changes{v2.5e}{2005/11/25}{Updated docs} +% \changes{v2.5g}{2006/12/19}{Altered policy for handling \cs{XKV@rm} +% in nested \cs{setkeys*} commands: all unknown keys will be recorded, +% not only the once from the outermost \cs{setkeys*}} % % \GetFileInfo{xkeyval.sty} % -% \CheckSum{2967} +% \CheckSum{2999} % %\DoNotIndex{\:,\@,\@@,\@backslashchar,\@ehc,\@empty,\@expandtwoargs, %\@for,\@forloop,\@fornoop,\@fortmp,\@gobble,\@gobbletwo,\@if,\@ifnch, @@ -800,8 +805,10 @@ documentation and for contributing the |\@selective@sanitize| macro. %the given families and will not produce errors when it cannot find a %key. Instead, these keys and their values will be appended to a list %of remaining keys in the macro |\XKV@rm| after the use of -%|\setkeys*|. Keys listed in \meta{na} will be ignored fully and -%will not be appended to the |\XKV@rm| list. +%|\setkeys*|. This list will also contain keys and values coming from +%nested |\setkeys*| commands in the order as they have been +%submitted. Keys listed in \meta{na} will be ignored fully and will +%not be appended to the |\XKV@rm| list. %\begin{example} % \setkeys*[my]{familyb}{keya=test} %\end{example} @@ -2046,10 +2053,10 @@ documentation and for contributing the |\@selective@sanitize| macro. % Load \LaTeX\ primitives if necessary and provide information. % \begin{macrocode} \ifx\ProvidesFile\@undefined - \message{2006/11/18 v2.5f key=value parser (HA)} + \message{2008/08/10 v2.6 key=value parser (HA)} \input xkvtxhdr \else - \ProvidesFile{xkeyval.tex}[2006/11/18 v2.5f key=value parser (HA)] + \ProvidesFile{xkeyval.tex}[2008/08/10 v2.6 key=value parser (HA)] \@addtofilelist{xkeyval.tex} \fi % \end{macrocode} @@ -2148,6 +2155,7 @@ documentation and for contributing the |\@selective@sanitize| macro. % \end{macro} % \end{macro} % \begin{macro}{\XKV@for@n} +% \changes{v2.6 }{2008/08/10}{protecting assignments from \#} % \marg{list}\meta{cmd}\marg{function}\\ % Fast for-loop. \meta{list} is not expanded. Entries of \meta{list} % will be stored in \meta{cmd} and at every iteration \meta{function} @@ -2155,7 +2163,7 @@ documentation and for contributing the |\@selective@sanitize| macro. % Contributed by Morten H\o gholm. % \begin{macrocode} \long\def\XKV@for@n#1#2#3{% - \def#2{#1}% + \toks@{#1}\edef#2{\the\toks@}% \ifx#2\@empty \XKV@for@break \else @@ -2166,11 +2174,12 @@ documentation and for contributing the |\@selective@sanitize| macro. % \end{macrocode} % \end{macro} % \begin{macro}{\XKV@f@r} +% \changes{v2.6 }{2008/08/10}{protecting assignments from \#} % \meta{cmd}\marg{function}\meta{entry}|,|\\ % Looping macro. % \begin{macrocode} \long\def\XKV@f@r#1#2#3,{% - \def#1{#3}% + \toks@{#3}\edef#1{\the\toks@}% \ifx#1\@nnil \expandafter\@gobbletwo \else @@ -2276,24 +2285,25 @@ documentation and for contributing the |\@selective@sanitize| macro. % \end{macrocode} % \end{macro} % \begin{macro}{\XKV@addtomacro@n} +% \changes{v2.6 }{2008/08/10}{protecting assignments from \#} % \meta{macro}\marg{content}\\ % Adds \meta{content} to \meta{macro} without expanding it. % \begin{macrocode} \def\XKV@addtomacro@n#1#2{% - \expandafter\def\expandafter#1\expandafter{#1#2}% + \toks@\expandafter{#1#2}% + \edef#1{\the\toks@}% } % \end{macrocode} % \end{macro} % \begin{macro}{\XKV@addtomacro@o} +% \changes{v2.6 }{2008/08/10}{protecting assignments from \#} % \meta{macro}\marg{content}\\ % Adds \meta{content} to \meta{macro} after expanding the first token % of \meta{content} once. Often used to add the content of a macro % to another macro. % \begin{macrocode} \def\XKV@addtomacro@o#1#2{% - \expandafter\expandafter\expandafter\def - \expandafter\expandafter\expandafter#1\expandafter - \expandafter\expandafter{\expandafter#1#2}% + \expandafter\XKV@addtomacro@n\expandafter#1\expandafter{#2}% } % \end{macrocode} % \end{macro} @@ -2339,6 +2349,7 @@ documentation and for contributing the |\@selective@sanitize| macro. % \begin{macro}{\@selective@sanitize} % \begin{macro}{\@s@lective@sanitize} % \changes{v2.5a}{2005/05/31}{Added missing `\%'} +% \changes{v2.6 }{2008/08/10}{protecting assignments from \#} % \oarg{level}\marg{character string}\marg{cmd}\\ % Converts selected characters, given by \meta{character string}, % within the first-level expansion of \meta{cmd} to category code~12, @@ -2366,7 +2377,9 @@ documentation and for contributing the |\@selective@sanitize| macro. \def#3{#2}\@onelevel@sanitize#3% \edef#3{{#3}{\the\XKV@toks}}% \expandafter\@s@l@ctive@sanitize\expandafter#3#3% - \expandafter\endgroup\expandafter\def\expandafter#3\expandafter{#3}% + \expandafter\toks@\expandafter{#3}% + \expandafter\endgroup\expandafter\toks@\expandafter{\the\toks@}% + \edef#3{\the\toks@}% } % \end{macrocode} % \end{macro} @@ -2462,6 +2475,7 @@ documentation and for contributing the |\@selective@sanitize| macro. % \end{macro} % \begin{macro}{\XKV@ch@cksanitize} % \changes{v1.8b}{2004/12/22}{Fixed bug for key value \cs{@empty}} +% \changes{v2.6 }{2008/08/10}{protecting assignments from \#} % \marg{character string}\meta{cmd}\meta{token}\\ % This macro first checks whether at least one \meta{token} is in \meta{character string}. % If that is the case, it checks whether the character has catcode 12. @@ -2476,7 +2490,7 @@ documentation and for contributing the |\@selective@sanitize| macro. % end of the macro. % \begin{macrocode} \def\XKV@ch@cksanitize#1#2#3{% - \def#2{#1}% + \toks@{#1}\edef#2{\the\toks@}% \@onelevel@sanitize#2% % \end{macrocode} % Check whether there is at least one |=| present. @@ -2490,12 +2504,12 @@ documentation and for contributing the |\@selective@sanitize| macro. % before (and for instance stored in a macro or token register). % \begin{macrocode} \def#2##1#3##2\@nil{% - \def#2{##2}% + \toks@{##2}\edef#2{\the\toks@}% \ifx#2\@empty\else\in@false\fi }% #2#1#3\@nil \fi - \def#2{#1}% + \toks@{#1}\edef#2{\the\toks@}% } % \end{macrocode} % \end{macro} @@ -2696,6 +2710,7 @@ documentation and for contributing the |\@selective@sanitize| macro. % \end{macro} % \begin{macro}{\XKV@srstate} % \changes{v2.5f}{2006/11/18}{Added \texttt{XKV@tkey} and \texttt{XKV@rm} to solve bugs} +% \changes{v2.5g}{2006/12/19}{Removed \texttt{XKV@rm} again on user request} % \marg{postfix1}\marg{postfix2}\\ % Macro to save and restore \pf{xkeyval} internals to allow for % nesting |\setkeys| commands. It executes a for loop over a set of @@ -2709,7 +2724,7 @@ documentation and for contributing the |\@selective@sanitize| macro. \def\XKV@srstate#1#2{% \ifx\@empty#2\@empty\advance\XKV@depth\@ne\fi \XKV@for@n{XKV@prefix,XKV@fams,XKV@tkey,XKV@na,% - XKV@rm,ifXKV@st,ifXKV@pl,ifXKV@knf}\XKV@resa{% + ifXKV@st,ifXKV@pl,ifXKV@knf}\XKV@resa{% \expandafter\let\csname\XKV@resa#1\expandafter \endcsname\csname\XKV@resa#2\endcsname }% @@ -3588,6 +3603,7 @@ documentation and for contributing the |\@selective@sanitize| macro. % \oarg{na}\marg{key=value list}\\ % \changes{v1.8a}{2004/12/20}{Solved small bug} % \changes{v2.5f}{2006/11/18}{Added reset of \cs{CurrentOption}} +% \changes{v2.5g}{2006/12/19}{Avoid reset of \cs{XKV@rm} in nested \cs{setkeys} commands} % Workhorse for |\setkeys|. % \begin{macrocode} \def\XKV@setkeys[#1]#2{% @@ -3601,9 +3617,10 @@ documentation and for contributing the |\@selective@sanitize| macro. \XKV@addtolist@x\XKV@naa\XKV@tempa }% % \end{macrocode} -% Initialize the remaining keys. +% Initialize the remaining keys, but only for the outermost level of +% |\setkeys|. % \begin{macrocode} - \let\XKV@rm\@empty + \ifnum\XKV@depth=\z@\let\XKV@rm\@empty\fi % \end{macrocode} % Now scan the list of families for preset keys and set user input keys. % \begin{macrocode} @@ -3661,6 +3678,8 @@ documentation and for contributing the |\@selective@sanitize| macro. % \changes{v1.4}{2004/08/24}{Made macro more efficient} % \changes{v2.4}{2005/03/31}{Added \cs{global} to make \cs{XKV@rm} % survive when \cs{setkeys} executed in a group.} +% \changes{v2.5g}{2006/12/19}{Removed \cs{global} again for consistent +% approach of \cs{XKV@rm} and to allow groups to keep \cs{XKV@rm} local} % \meta{key}|=|\meta{value}|=#3\@nil|\\ % Split key name and value (if present). If |#3| non-empty, there was % no |=|\meta{value}. @@ -3732,7 +3751,7 @@ documentation and for contributing the |\@selective@sanitize| macro. % list in |\XKV@rm| when |\setkeys*| has been used. % \begin{macrocode} \ifXKV@st - \global\XKV@addtolist@o\XKV@rm\CurrentOption + \XKV@addtolist@o\XKV@rm\CurrentOption \else \XKV@err{`\XKV@tkey' undefined in families `\XKV@fams'}% \fi @@ -3998,7 +4017,7 @@ documentation and for contributing the |\@selective@sanitize| macro. %<*xkvlatex> \NeedsTeXFormat{LaTeX2e}[1995/12/01] \ProvidesPackage{xkeyval} - [2006/11/18 v2.5f package option processing (HA)] + [2008/08/10 v2.6 package option processing (HA)] % \end{macrocode} % Initializations. Load |xkeyval.tex|, adjust some catcodes to define % internal macros and initialize the |\DeclareOptionX*| working macro. @@ -4271,6 +4290,8 @@ documentation and for contributing the |\@selective@sanitize| macro. % \end{macrocode} % \subsection{\texttt{keyval.tex}} % \changes{v1.4}{2004/08/24}{Added \pf{keyval} primitives} +% \changes{v2.6 }{2008/08/10}{Added \cs{KV@def} to \texttt{keyval.tex} +% as it is used by some packages} % Since the \pf{xkeyval} macros handle input in a very different way % than \pf{keyval} macros, it is not wise to redefine \pf{keyval} % primitives (like |\KV@do| and |\KV@split|) used by other packages @@ -4325,6 +4346,10 @@ documentation and for contributing the |\@selective@sanitize| macro. \else \XKV@tempb\relax \fi} +\def\KV@def#1#2[#3]{% + \@namedef{KV@#1@#2@default\expandafter}\expandafter + {\csname KV@#1@#2\endcsname{#3}}% + \@namedef{KV@#1@#2}##1} %</xkvkeyval> % \end{macrocode} % \subsection{\texttt{xkvtxhdr.tex}} @@ -4399,7 +4424,7 @@ documentation and for contributing the |\@selective@sanitize| macro. %<*xkvview> \NeedsTeXFormat{LaTeX2e}[1995/12/01] \ProvidesPackage{xkvview}% - [2005/07/10 v1.4a viewer utility for xkeyval (HA)] + [2008/08/10 v1.5 viewer utility for xkeyval (HA)] \RequirePackage{xkeyval} \RequirePackage{longtable} \DeclareOptionX*{% @@ -4427,14 +4452,15 @@ documentation and for contributing the |\@selective@sanitize| macro. % \end{macrocode} % \begin{macro}{\XKVV@tabulate} % \begin{macro}{\XKVV@t@bulate} +% \changes{v2.6 }{2008/08/10}{Solved bug occurring with empty prefix} % \marg{key}\marg{type}\marg{default}\\ % Adds the input information to the main database in |\XKVV@db|. % \begin{macrocode} \def\XKVV@tabulate#1#2#3{% \def\XKV@tempa{#3}% \@onelevel@sanitize\XKV@tempa - \XKV@addtolist@x\XKVV@db{#1=\expandafter - \XKVV@t@bulate\XKV@prefix=\XKV@tfam=#2=\XKV@tempa}% + \XKV@addtolist@x\XKVV@db{#1=\ifx\XKV@prefix\@empty\else\expandafter + \XKVV@t@bulate\XKV@prefix\fi=\XKV@tfam=#2=\XKV@tempa}% } \def\XKVV@t@bulate#1@{#1} % \end{macrocode} @@ -5470,7 +5496,7 @@ actually used. They are not expanded during option processing.\\ \usepackage{fourier} \usepackage{xcolor} \usepackage[multiple]{footmisc} -\usepackage{pst-char} +\usepackage{pst-text} \usepackage{listings} \lstnewenvironment{command}{% \lstset{columns=flexible,frame=single,backgroundcolor=\color{blue!20},% |