diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/skeyval/skeyval-ltxpatch.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/skeyval/skeyval-ltxpatch.sty | 437 |
1 files changed, 437 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/skeyval/skeyval-ltxpatch.sty b/Master/texmf-dist/tex/latex/skeyval/skeyval-ltxpatch.sty new file mode 100644 index 00000000000..e44d3b50f7b --- /dev/null +++ b/Master/texmf-dist/tex/latex/skeyval/skeyval-ltxpatch.sty @@ -0,0 +1,437 @@ +%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% +% This is file 'skeyval-ltxpatch.sty', version 1.1, 2012/10/15. % +% % +% The rationale for this package: the patch in 'xkvltxp' package isn't % +% strong enough. % +% % +% This package and accompanying files may be distributed and/or % +% modified under the conditions of the LaTeX Project Public License, % +% either version 1.3 of this license or any later version. The latest % +% version of this license is in http://www.latex-project.org/lppl.txt % +% and version 1.3 or later is part of all distributions of LaTeX % +% version 2005/12/01 or later. % +% % +% The LPPL maintenance status of this software is 'author-maintained'. % +% % +% This software is provided 'as it is', without warranty of any kind, % +% either expressed or implied, including, but not limited to, the % +% implied warranties of merchantability and fitness for a particular % +% purpose. % +% % +% The following files constitute the skeyval bundle and must be % +% distributed as a whole: % +% % +% readme, skeyval.sty, skeyval-core.tex, skeyval-for.tex, % +% skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, % +% skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.sty, % +% and skeyval-testpkg.sty. % +% % +% Copyright (c) 2010-2012 Ahmed Musa (amusa22@gmail.com). % +%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% + +\begingroup +\catcode035 06 % # +\catcode064 11 % @ +\catcode123 01 % { +\catcode125 02 % } +\catcode044 12 % , +\def\skv@prova{\endgroup + \def\do##1,{% + \ifx\do##1\else + \catcode##1\string=\the\catcode##1\relax + \expandafter\do + \fi + }% + \edef\skvltxp@restorecodes{\do035,064,123,125,061,059,\do,}% +} +\skv@prova +\catcode035 06 % # +\catcode064 11 % @ +\catcode123 01 % { +\catcode125 02 % } +\catcode061 12 % = +\catcode044 12 % , +\def\do#1=#2,{% + \ifx\do#1\else + \edef\skvltxp@restorecodes{% + \skvltxp@restorecodes + \catcode#1=\the\catcode#1\relax + }% + \catcode#1=#2\relax + \expandafter\do + \fi +} +\do 032=10,033=12,036=03,038=04,040=12,041=12,042=12,043=12,% + 059=12,045=12,047=12,058=12,063=12,091=12,093=12,126=13,\do=,% + +\NeedsTeXFormat{LaTeX2e}[2011/06/27] +\ProvidesPackage{skeyval-ltxpatch} + [2012/10/15 v1.1 Patches for LaTeX2e kernel options processing (AM)] + +\def\@space{ } +\protected\def\skvltxptracingall{% + \tracinggroups\@ne\tracingifs\@ne\loggingall\tracingassigns\@ne + \tracingonline\z@\tracingifs\z@ +} +\let\skvltxploggingall\skvltxptracingall + +\def\skvltxp@cmptwo#1#2\@@a#3#4\@@b#5{% + \csname @#5#1#3first\else second\fi oftwo\endcsname +} + +\begingroup +\lccode`\&=0 \catcode`\&=7 \lccode`\!=0 \catcode`\!=8 +\lowercase{\endgroup + \def\skvltxp@ifleadspace#1{\skvltxp@ifl@adspace!#1! &}% + \def\skvltxp@ifl@adspace#1! #2&{% + \skvltxp@ifnull{#2}\@secondoftwo\@firstoftwo + } + \def\skvltxp@ifnull#1{\skvltxp@cmptwo#1&\@@a&\@@b\ifx} + \def\skvltxp@ifx#1#2{\skvltxp@cmptwo#1&\@@a#2!\@@b\ifx} + \def\skvltxp@trimspace#1{\skvltxp@trimspace@a.#1& &} + \def\skvltxp@trimspace@a#1 &{\skvltxp@trimspace@b#1&} + \def\skvltxp@trimspace@b#1{% + \unexpanded\expandafter{% + \romannumeral0% + \expandafter\skvltxp@ifleadspace\expandafter{\@gobble#1}{% + \@gobble#1% + }{% + \expandafter\@space\@gobble#1% + }% + }% + } +} +\protected\def\skvltxp@despacecontent#1{% + \edef#1{\expandafter\skvltxp@trimspace\expandafter{#1}}% +} + +% \skvltxp@normalize isn't meant for normalizing keyval lists. +\protected\def\skvltxp@setupnormalizer#1{% + \begingroup + \lccode`\~=`#1\relax + \lowercase{\endgroup + \def\skvltxp@normalize##1{% + \unexpanded\expandafter + {\romannumeral\skvltxp@activeparser#1##1#1~\skv@nil}% + }% + \def\skvltxp@activeparser##1~##2\skv@nil{% + \skvltxp@ifnull{##2} + {\skvltxp@spaceparser##1 #1\skv@nil} + {\skvltxp@activeparser##1#1##2\skv@nil}% + }% + }% + \def\skvltxp@spaceparser##1 #1##2\skv@nil{% + \skvltxp@ifnull{##2} + {\skvltxp@parserspace##1#1 \skv@nil} + {\skvltxp@spaceparser##1#1##2\skv@nil}% + }% + \def\skvltxp@parserspace##1#1 ##2\skv@nil{% + \skvltxp@ifnull{##2} + {\skvltxp@doubleparser##1#1#1\skv@nil} + {\skvltxp@parserspace##1#1##2\skv@nil}% + }% + \def\skvltxp@doubleparser##1#1#1##2\skv@nil{% + \skvltxp@ifnull{##2}{% + \skvltxp@ifnull{##1}{0 }{0\expandafter\@space\@gobble##1}% + }{% + \skvltxp@doubleparser##1#1##2\skv@nil + }% + }% +} +\def\skvltxp@commanormalize#1{% + \skvltxp@setupnormalizer{,}% + \edef#1{\expandafter\skvltxp@normalize\expandafter{#1}}% +} + +\newif\ifbreakkerpaloop +\def\kerpaloopdepth{0} +% \kerpaloop{<parser>}{<list>}{<1.parameter.callback>} +% \kerpaloop*{<parser>}{<listcmd>}{<1.parameter.callback>} +\protected\def\kerpaloop{\@ifstar{\skv@kerpaloop1}{\skv@kerpaloop0}} +\def\skv@kerpaloop#1#2#3#4{% + \xdef\kerpaloopdepth{\the\numexpr\kerpaloopdepth+1}% + \def\skv@k@rpaloop{kerpaloop@\romannumeral\kerpaloopdepth}% + \breakkerpaloopfalse + \@namedef{\skv@k@rpaloop}##1#2{% + \skvltxp@ifx{##1}\kerpaloop{% + \breakkerpaloopfalse + }{% + #4\relax + \ifbreakkerpaloop + \breakkerpaloopfalse + \begingroup + \@namedef\skv@k@rpaloop####1\kerpaloop#2{\endgroup}% + \fi + \@nameuse\skv@k@rpaloop + }% + }% + \edef\reserved@a{% + \if0#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi + {\unexpanded{#3}}{\unexpanded\expandafter{#3}}% + }% + \ifx\reserved@a\@empty\expandafter\@gobble\else\expandafter\@iden\fi + {% + \csname\skv@k@rpaloop\expandafter\endcsname + \reserved@a#2\kerpaloop#2% + }% + \xdef\kerpaloopdepth{\the\numexpr\kerpaloopdepth-1}% +} +\def\skvltxp@getoptionnames#1#2{% + \def#2{}% + \skvltxp@commanormalize#1% + \def\do##1=##2\skv@nil{% + \edef#2{\ifx#2\@empty\else#2,\fi##1}% + }% + \kerpaloop*{,}#1{\do##1=\skv@nil}% +} +\def\@ptionlist#1{% + \@ifundefined{opt@#1}{}{\unexpanded\expandafter + \expandafter\expandafter{\csname opt@#1\endcsname}}% +} +\def\@if@ptions#1#2#3{% + \@expandtwoargs\@if@pti@ns{\@ptionlist{#2.#1}}{\unexpanded{#3}}% +} +\def\@if@pti@ns#1#2{% + \skvltxp@setupnormalizer{,}% + \edef\skv@options@i{\skvltxp@normalize{#1}}% + \edef\skv@options@ii{\skvltxp@normalize{#2}}% + \ifx\skv@options@i\skv@options@ii + \def\skv@tempa{\expandafter\@firstoftwo\@gobbletwo}% + \else + \ifx\skv@options@ii\@empty + \ifx\skv@options@i\@empty + \def\skv@tempa{\expandafter\@firstoftwo\@gobbletwo}% + \else + \def\skv@tempa{\expandafter\@secondoftwo\@gobbletwo}% + \fi + \else + \let\skv@tempa\@iden + \fi + \fi + \skv@tempa{% + \let\skv@tempa\@firstoftwo + \def\do##1{% + \@expandtwoargs\in@{,\detokenize{##1},}% + {,\detokenize\expandafter{\skv@options@i},}% + \ifin@\else\let\skv@tempa\@secondoftwo\breakkerpalooptrue\fi + }% + \kerpaloop*{,}\skv@options@ii{\do{##1}}% + }% + \skv@tempa +} +\def\@onefilewithoptions#1[#2][#3]#4{% + \@pushfilename + \xdef\@currname{#1}% + \global\let\@currext#4% + \expandafter\let\csname\@currname.\@currext-h@@k\endcsname\@empty + \let\CurrentOption\@empty + \@reset@ptions + \makeatletter + \@ifl@aded\@currext{#1}{% + \@if@ptions\@currext{#1}{#2}{}{% + % Merge the two options lists: + \let\skv@tempa\skv@options@i + \skvltxp@ifnull{#2}{}{% + \def\do##1{% + \@expandtwoargs\in@{,\detokenize{##1},}% + {,\detokenize\expandafter{\skv@tempa},}% + \ifin@\else + \edef\skv@tempa{% + \ifx\skv@tempa\@empty\else + \detokenize\expandafter{\skv@tempa},\fi + \detokenize{##1}% + }% + \fi + }% + \kerpaloop*{,}\skv@options@ii{\do{##1}}% + }% + \@onelevel@sanitize\skv@options@i + \@onelevel@sanitize\skv@options@ii + \@latex@error{Option clash for \@cls@pkg\@space #1}{% + The package '#1' has already been loaded + with \ifx\skv@options@i\@empty no options\MessageBreak\else + options:\MessageBreak\@space\@space[\skv@options@i]\fi. + \MessageBreak There has now been an attempt to load it with + \ifx\skv@options@ii\@empty no options\else options + \MessageBreak\@space\@space[\skv@options@ii]\fi. + \MessageBreak Adding the global options\MessageBreak + \@space\@space'\skv@tempa'\MessageBreak + to your \noexpand\documentclass declaration may fix this problem. + }% + }% + }{% + \@pass@ptions\@currext{#2}{#1}% + \global\expandafter + \let\csname ver@\@currname.\@currext\endcsname\@empty + \InputIfFileExists{\@currname.\@currext}{}{% + \@missingfileerror\@currname\@currext + }% + \let\@unprocessedoptions\@@unprocessedoptions + \csname\@currname.\@currext-h@@k\endcsname + \expandafter\let\csname\@currname.\@currext-h@@k\endcsname\@undefined + \@unprocessedoptions + }% + \def\skv@tempa##1 v##2 ##3\@nil##4{% + \edef##4{'##1\ifx\\##2\\\else\@space v##2\fi'}% + }% + \skv@tempa#3 v \@nil\skv@tempb + \expandafter\expandafter\expandafter\skv@tempa + \csname ver@#1.\@currext\expandafter\endcsname + \@space v \@nil\skv@tempc + \@ifl@ter\@currext{#1}{#3}{}{% + \@expandtwoargs\AtEndDocument{% + \noexpand\@latex@warning@no@line{% + You requested,\on@line, version\MessageBreak + \skv@tempb\@space of \@cls@pkg\@space #1,\MessageBreak + but only version \skv@tempc\MessageBreak is available + }% + }{}% + }% + \ifx\@currext\@clsextension + \let\LoadClass\@twoloadclasserror + \fi + \@popfilename + \@reset@ptions +} +\protected\def\ProcessOptions{% + \let\ds@\@empty + \edef\@curroptions{\@ptionlist{\@currname.\@currext}}% + \ifx\@classoptionslist\relax + \let\@classoptionslist@a\relax + \else + % LaTeX can't process options with values. So we filter out + % option values: + \skvltxp@getoptionnames\@classoptionslist\@classoptionslist@a + \fi + \skvltxp@getoptionnames\@curroptions\@curroptions@a + \@ifstar\@xprocess@ptions\@process@ptions +} +\def\@process@ptions{% + \@for\CurrentOption:=\@declaredoptions\do{% + \ifx\CurrentOption\@empty\else + \@expandtwoargs\in@{,\CurrentOption,}{% + ,\ifx\@currext\@clsextension\else + \ifx\@classoptionslist@a\relax\else\@classoptionslist@a,\fi\fi + \@curroptions@a,}% + \ifin@ + \@use@ption + \expandafter\let\csname ds@\CurrentOption\endcsname\@empty + \fi + \fi + }% + \@process@pti@ns +} +\def\@xprocess@ptions{% + \ifx\@currext\@clsextension\else + \@for\CurrentOption:=\@classoptionslist@a\do{% + \ifx\CurrentOption\@empty\else + \@expandtwoargs\in@{,\CurrentOption,}{,\@declaredoptions,}% + \ifin@ + \@use@ption + \expandafter\let\csname ds@\CurrentOption\endcsname\@empty + \fi + \fi + }% + \fi + \@process@pti@ns +} +\def\@process@pti@ns{% + \@for\CurrentOption:=\@curroptions@a\do{% + \@ifundefined{ds@\CurrentOption}{\@use@ption\default@ds}{\@use@ption}% + }% + \@for\CurrentOption:=\@declaredoptions\do{% + \expandafter\let\csname ds@\CurrentOption\endcsname\relax + }% + \let\CurrentOption\@empty + \let\@fileswith@pti@ns\@@fileswith@pti@ns + \AtEndOfPackage{\let\@unprocessedoptions\relax}% +} +\def\@pass@ptions#1#2#3{% + \def\reserved@a{#2}% + \def\reserved@b{\CurrentOption}% + \ifx\reserved@a\reserved@b + \@ifundefined{opt@#3.#1}{% + \@temptokena\expandafter{#2}% + }{% + \@temptokena\expandafter\expandafter\expandafter + {\csname opt@#3.#1\endcsname}% + \@temptokena\expandafter\expandafter\expandafter{% + \expandafter\the\expandafter\@temptokena\expandafter,#2}% + }% + \else + \@ifundefined{opt@#3.#1}{% + \@temptokena{#2}% + }{% + \@temptokena\expandafter\expandafter\expandafter + {\csname opt@#3.#1\endcsname}% + \@temptokena\expandafter{\the\@temptokena,#2}% + }% + \fi + \expandafter\xdef\csname opt@#3.#1\endcsname{\the\@temptokena}% +} +\def\OptionNotUsed{% + \ifx\@currext\@clsextension + \let\reserved@a\CurrentOption + \@onelevel@sanitize\reserved@a + \xdef\@unusedoptionlist{% + \@unusedoptionlist + \ifx\@unusedoptionlist\@empty\else,\fi + \reserved@a + }% + \fi +} + +\def\@use@ption{% + \begingroup + \skvltxp@despacecontent\CurrentOption + \@onelevel@sanitize\reserved@a + \@onelevel@sanitize\@unusedoptionlist + \def\skv@tempa{}% + \def\do##1=##2=##3\@nil{% + \edef\reserved@a{\skvltxp@trimspace{##1}}% + }% + \kerpaloop*{,}\@unusedoptionlist{% + \do##1==\@nil + \ifx\reserved@a\CurrentOption\else + \edef\skv@tempa{% + \skv@tempa\ifx\skv@tempa\@empty\else,\fi##1% + }% + \fi + }% + \global\let\@unusedoptionlist\skv@tempa + \endgroup + \csname ds@\CurrentOption\endcsname +} +\def\@fileswith@pti@ns#1[#2]#3[#4]{% + \ifx\@clsextension#1% + \ifx\@classoptionslist\relax + \@temptokena{#2}% + \xdef\@classoptionslist{\the\@temptokena}% + \def\reserved@a{% + \@onefilewithoptions#3[#2][#4]#1\@documentclasshook + }% + \else + \def\reserved@a{\@onefilewithoptions#3[#2][#4]#1}% + \fi + \else + \@temptokena{#2}% + \def\reserved@b##1,{% + \ifx\@nnil##1\relax\else + \ifx\relax##1\relax\else + \noexpand\@onefilewithoptions##1% + [\the\@temptokena][#4]\noexpand\@pkgextension + \fi + \expandafter\reserved@b + \fi + }% + \edef\reserved@a{\zap@space#3 \@empty}% + \edef\reserved@a{\expandafter\reserved@b\reserved@a,\@nnil,}% + \fi + \reserved@a +} +\let\@@fileswith@pti@ns\@fileswith@pti@ns + +\skvltxp@restorecodes +\endinput + +%% End of file `skeyval-ltxpatch.sty'. |