diff options
author | Karl Berry <karl@freefriends.org> | 2010-05-01 23:10:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-05-01 23:10:04 +0000 |
commit | 8c9a52b7b8592707848504ed69b7ba02f703ca8a (patch) | |
tree | 79c0ed934595643622fc91b2f43131df3e8bfe8d /Master/texmf-dist/tex/latex/pgfopts | |
parent | 905e4b59250e7a09de14faed63264e115ea93a8e (diff) |
pgfopts 2.0 (1may10)
git-svn-id: svn://tug.org/texlive/trunk@18072 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pgfopts')
-rw-r--r-- | Master/texmf-dist/tex/latex/pgfopts/pgfopts.sty | 243 |
1 files changed, 160 insertions, 83 deletions
diff --git a/Master/texmf-dist/tex/latex/pgfopts/pgfopts.sty b/Master/texmf-dist/tex/latex/pgfopts/pgfopts.sty index 54b1af2ad90..cd20c898a73 100644 --- a/Master/texmf-dist/tex/latex/pgfopts/pgfopts.sty +++ b/Master/texmf-dist/tex/latex/pgfopts/pgfopts.sty @@ -5,95 +5,172 @@ %% The original source files were: %% %% pgfopts.dtx (with options: `package') -%% -------------------------------------------------------------- -%% The pgfopts package --- LaTeX package options with pgfkeys -%% Maintained by Joseph Wright -%% E-mail: joseph.wright@morningstar2.co.uk -%% Released under the LaTeX Project Public License v1.3 or later -%% See http://www.latex-project.org/lppl.txt -%% -------------------------------------------------------------- +%% ---------------------------------------------------------------- +%% achemso --- LaTeX package options with pgfkeys +%% E-mail: joseph.wright@morningstar2.co.uk +%% Released under the LaTeX Project Public License v1.3c or later +%% See http://www.latex-project.org/lppl.txt +%% ---------------------------------------------------------------- %% -\NeedsTeXFormat{LaTeX2e} -\newcommand*{\pgfopts@id}{} -\def\pgfopts@id$#1: #2.#3 #4 #5-#6-#7 #8 #9${% - #5/#6/#7\space v1.0\space} -\ProvidesPackage{pgfopts} - [\pgfopts@id $Id: pgfopts.dtx 28 2008-06-26 11:59:34Z joseph $ - LaTeX package options with pgfkeys] +\ProvidesClass{pgfopts} + [2010/05/01 v2.0 LaTeX package options with pgfkeys] \RequirePackage{pgfkeys} -\edef\pgfopts@catcodes{% - \catcode\string`\string ` \the\catcode\string`\`\relax - \catcode\string`\string = \the\catcode\string`\=\relax - \catcode\string`\string : \the\catcode\string`\:\relax - \catcode\string`\string , \the\catcode\string`\,\relax - \catcode\string`\string / \the\catcode\string`\/\relax - \catcode\string`\string . \the\catcode\string`\.\relax} -\catcode\string`\` 12\relax -\catcode`\= 12\relax -\@makeother{\:} -\@makeother{\,} -\@makeother{\/} -\@makeother{\.} -\newcommand*{\ProcessPgfOptions}{% - \@ifstar - {\begingroup - \edef\@tempa{% - \endgroup - \noexpand\pgfopts@ProcessOptions - {/\@currname}}% - \@tempa}% - {\pgfopts@ProcessOptions}} -\@onlypreamble\ProcessPgfOptions -\newcommand*{\pgfopts@temp}{} -\newcommand*{\pgfopts@ProcessOptions}[1]{% - \def\pgfopts@temp{,}% +\newif\ifpgfopts@process@class +\newcommand*\pgfopts@options@clist{} +\newcommand*\pgfopts@options@execute{} +\newcommand*\pgfopts@key@path{} +\newcommand\pgfopts@process@options[1]{% + \def\pgfopts@options@clist{}% + \def\pgfopts@options@execute{}% + \def\pgfopts@key@path{#1/}% \ifx\@currext\@clsextension\else + \expandafter\pgfopts@check@class@options + \fi + \pgfopts@process@local@options + \pgfopts@options@execute + \let\CurrentOption\@empty + \AtEndOfPackage{\let\@unprocessedoptions\relax}% +} +\newcommand*\pgfopts@current@option{} +\newcommand*\pgfopts@check@class@options{% + \ifpgfopts@process@class \ifx\@classoptionslist\relax\else - \@for\pgfopts@CurrentOption:=\@classoptionslist\do{% - \pgfkeysifdefined{#1/\expandafter\pgfopts@sepkeyval% - \pgfopts@CurrentOption=\@nil/.@cmd} - {\edef\pgfopts@temp{% - \pgfopts@temp\pgfopts@CurrentOption,}% - \@expandtwoargs\@removeelement\pgfopts@CurrentOption - \@unusedoptionlist\@unusedoptionlist}% - {}}% + \expandafter\expandafter\expandafter + \pgfopts@check@class@options@aux \fi \fi +} +\newcommand*\pgfopts@check@class@options@aux{% + \@for\pgfopts@current@option:=\@classoptionslist\do + {% + \pgfkeysifdefined + {% + \pgfopts@key@path + \pgfopts@get@key@name\pgfopts@current@option + /.@cmd% + }% + {% + \pgfopts@list@add\pgfopts@options@clist\pgfopts@current@option + \@expandtwoargs\@removeelement\pgfopts@current@option + \@unusedoptionlist\@unusedoptionlist + }% + {}% + }% +} +\newcommand*\pgfopts@local@options{} +\newcommand*\pgfopts@process@local@options{% \begingroup - \@ifundefined{opt@\@currname.\@currext} - {\toks@\expandafter{\pgfopts@temp}} - {\toks@\expandafter\expandafter\expandafter{% - \csname opt@\@currname.\@currext\endcsname}% - \ifx\@currext\@clsextension - \edef\@tempa{\the\toks@}% - \toks@\expandafter{\pgfopts@temp}% - \@for\CurrentOption:=\@tempa\do{% - \pgfkeysifdefined{#1/\expandafter% - \pgfopts@sepkeyval\CurrentOption=\@nil/.@cmd} - {\toks@\expandafter{\the\expandafter\toks@ - \expandafter,\CurrentOption}} - {\ifx\@empty\@unusedoptionlist\@empty - \global\let\@unusedoptionlist\CurrentOption - \else - \expandafter\expandafter\expandafter\gdef - \expandafter\expandafter\expandafter - \@unusedoptionlist\expandafter\expandafter - \expandafter{% - \expandafter\@unusedoptionlist - \expandafter,\CurrentOption}% - \fi}}% - \else - \toks@\expandafter\expandafter\expandafter{% - \expandafter\pgfopts@temp\the\toks@}% - \fi}% - \edef\pgfopts@temp{\endgroup - \noexpand\pgfkeys{#1/.cd,\the\toks@}}% - \pgfopts@temp - \let\CurrentOption\@empty - \AtEndOfPackage{\let\@unprocessedoptions\relax}} -\newcommand*{\pgfopts@sepkeyval}{} -\def\pgfopts@sepkeyval#1=#2\@nil{#1} -\pgfopts@catcodes -\endinput + \@ifundefined{opt@\@currname.\@currext}% + {\endgroup}% + {% + \toks@\expandafter\expandafter\expandafter + {\csname opt@\@currname.\@currext\endcsname}% + \expandafter\endgroup + \expandafter\def\expandafter\pgfopts@local@options + \expandafter{\the\toks@}% + \pgfopts@process@local@options@aux@i + }% +} +\newcommand*\pgfopts@process@local@options@aux@i{% + \ifx\@currext\@clsextension + \expandafter\pgfopts@process@local@options@class + \else + \expandafter\pgfopts@process@local@options@package + \fi + \ifx\pgfopts@options@clist\@empty\else + \expandafter\pgfopts@process@local@options@aux@ii + \fi +} +\newcommand*\pgfopts@process@local@options@aux@ii{% + \begingroup + \toks@\expandafter{\pgfopts@options@clist}% + \edef\pgfopts@options@execute + {% + \noexpand\pgfkeys + {% + \pgfopts@key@path .cd,% + \the\toks@ + }% + }% + \expandafter\endgroup + \expandafter\def\expandafter\pgfopts@options@execute + \expandafter{\pgfopts@options@execute}% +} +\newcommand*\pgfopts@process@local@options@class{% + \@for\pgfopts@current@option:=\pgfopts@local@options\do{% + \pgfkeysifdefined + {% + \pgfopts@key@path + \pgfopts@get@key@name\pgfopts@current@option + /.@cmd% + }% + {\pgfopts@list@add\pgfopts@options@clist\pgfopts@current@option}% + {\pgfopts@list@add\@unusedoptionlist\pgfopts@current@option}% + }% +} +\newcommand*\pgfopts@process@local@options@package{% + \pgfopts@list@add\pgfopts@options@clist\pgfopts@local@options +} +\newcommand\pgfopts@get@key@name[1]{% + \expandafter\pgfopts@get@key@name@aux#1=\@nil +} +\def\pgfopts@get@key@name@aux#1=#2\@nil{#1} +\newtoks\pgfopts@list@add@a@toks +\newtoks\pgfopts@list@add@b@toks +\newcommand*\pgfopts@list@add@temp{} +\newcommand\pgfopts@list@add[2]{% + \pgfopts@list@add@a@toks\expandafter{#2}% + \def\pgfopts@list@add@temp{#2}% + \pgfopts@list@add@b@toks\expandafter{#1}% + \ifx\pgfopts@options@clist\@empty + \edef#1{\the\pgfopts@list@add@a@toks}% + \else + \ifx\pgfopts@list@add@temp\@empty\else + \edef#1% + {\the\pgfopts@list@add@b@toks,\the\pgfopts@list@add@a@toks}% + \fi + \fi +} +\newcommand*\ProcessPgfOptions{% + \pgfopts@process@classtrue + \pgfopts@star@check +} +\newcommand*\ProcessPgfPackageOptions{% + \pgfopts@process@classfalse + \pgfopts@star@check +} +\newcommand*\pgfopts@star@check{% + \@ifstar + {% + \begingroup + \edef\@tempa + {% + \endgroup + \noexpand\pgfopts@process@options{/\@currname}% + }% + \@tempa + }% + {\pgfopts@process@options}% +} +\@onlypreamble\ProcessPgfOptions +\@onlypreamble\ProcessPgfPackageOptions +%% +%% Copyright (C) 2008,2010 by +%% Joseph Wright <joseph.wright@morningstar2.co.uk> +%% +%% It may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License (LPPL), either version 1.3c of +%% this license or (at your option) any later version. The latest +%% version of this license is in the file: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This work is "maintained" (as per LPPL maintenance status) by +%% Joseph Wright. +%% +%% This work consists of the file pgfopts.dtx +%% and the derived files pgfopts.ins and +%% pgfopts.pdf. +%% %% %% End of file `pgfopts.sty'. |