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/source | |
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/source')
-rw-r--r-- | Master/texmf-dist/source/latex/pgfopts/pgfopts.dtx | 1030 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/pgfopts/pgfopts.ins | 116 |
2 files changed, 562 insertions, 584 deletions
diff --git a/Master/texmf-dist/source/latex/pgfopts/pgfopts.dtx b/Master/texmf-dist/source/latex/pgfopts/pgfopts.dtx index f897c44f9d3..ec9eb644d77 100644 --- a/Master/texmf-dist/source/latex/pgfopts/pgfopts.dtx +++ b/Master/texmf-dist/source/latex/pgfopts/pgfopts.dtx @@ -1,115 +1,15 @@ % \iffalse meta-comment -% -% Copyright (C) 2008 by -% Joseph Wright <joseph.wright@morningstar2.co.uk> -% -% This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either -% version 1.3c of this license or (at your option) any later -% version. The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3c or later is part of all distributions of -% LaTeX version 2005/12/01 or later. -% -% This work has the LPPL maintenance status `maintained'. -% -% The current maintainer of this work is Joseph Wright. -% -% This work consists of the source file pgfopts.dtx -% and the derived files pgfopts.ins, -% pgfopts.sty, -% pgfopts.pdf, -% pgfopts-manual.pdf, -% jawltxdoc.sty and -% README -% -% TDS-ready files: -% The compressed file pgfopts.tds.zip contains an unpacked version -% of all of the files included here, and pre-compiled -% documentation in PDF format. Simply decompress pgfopts.tds.dtx -% in your local TeX directory, run your hash program (texhash, -% initexmf --update-fndb, etc.) and everything will be ready to -% go. The user documentation for the package is called -% pgfopts-manual.pdf; the file chemscheme.pdf includes the user -% manual and the fully-indexed source code. -% -% Unpacking: -% (a) If pgfopts.ins is present: -% tex pgfopts.ins -% (b) Without pgfopts.ins: -% tex chemscheme.dtx -% (c) If you use LaTeX to generate files: -% latex \let\install=y\input{pgfopts.dtx} -% -% Documentation: -% (a) Without write18 enabled: -% pdflatex pgfopts.dtx -% makeindex -s gind.ist chemscheme.idx -% makeindex -s gglo.ist -o chemscheme.gls chemscheme.glo -% pdflatex chemscheme.dtx -% pdflatex chemscheme.dtx -% (b) With write18 enabled: -% pdflatex chemscheme.dtx -% pdflatex chemscheme.dtx -% pdflatex chemscheme.dtx -% -% Installation: -% Copy pgfopts.sty to a location searched by TeX, and if required -% by your TeX installation, run the appropriate command to build -% a hash of files (texhash, initexmf --update-fndb, etc.) -% -% Note: -% The jawltxdoc.sty file is not needed for installation, -% only for building the documentation; it may be deleted -% after producing the documentation (if necessary). -% -%<*ignore> -% This is all taken verbatim from Heiko Oberdiek's packages -\begingroup - \def\x{LaTeX2e}% -\expandafter\endgroup -\ifcase 0\ifx\install y1\fi\expandafter - \ifx\csname processbatchFile\endcsname\relax\else1\fi - \ifx\fmtname\x\else 1\fi\relax -\else\csname fi\endcsname -%</ignore> -%<*install> -\input docstrip.tex -\keepsilent -\askforoverwritefalse -\preamble - -------------------------------------------------------------- - 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 - -------------------------------------------------------------- - -\endpreamble -\Msg{Generating pgfopts files:} -\generate{\file{jawltxdoc.sty}{\from{\jobname.dtx}{jawltxdoc}} -} -\usedir{tex/latex/pgfopts} -\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}} -} -\usedir{source/latex/pgfopts} -\generate{\file{\jobname.ins}{\from{\jobname.dtx}{install}} -} -\nopreamble\nopostamble -\usedir{doc/latex/pgfopts} -\generate{\file{README.txt}{\from{\jobname.dtx}{readme}} -} -\endbatchfile -%</install> +% !TeX program = pdfLaTeX +%<*internal> +\iffalse +%</internal> %<*readme> ---------------------------------------------------------------- -The pgfopts package --- LaTeX package options with pgfkeys -Maintained by Joseph Wright +---------------------------------------------------------------- +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 ---------------------------------------------------------------- +---------------------------------------------------------------- Using key-value options for packages and macros is a good way of handling large numbers of options with a clean interface. @@ -119,95 +19,209 @@ handling LaTeX class and package options. The pgfopts package adds this ability to pgfkeys, in the same way that kvoptions extends the keyval package. +Installation +------------ + +The package is supplied in dtx format and as a pre-extracted zip +file, pgfopts.tds.zip. The later is most convenient for most +users: simply unzip this in your local texmf directory and run +texhash to update the database of file locations. If you want to +unpack the dtx yourself, running 'tex pgfopts.dtx' will extract +the package whereas 'latex pgfopts.dtx will extract it and also +typeset the documentation. + +Typesetting the documentation requires a number of packages in +addition to those needed to use the package. This is mainly +because of the number of demonstration items included in the +text. To compile the documentation without error, you will +need the packages: + - csquotes + - helvet + - hypdoc + - listings + - lmodern + - mathpazo + - microtype %</readme> -%<*ignore> +%<*internal> \fi -% Will Robertson's trick -\immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx} -\immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo} -%</ignore> +\def\nameofplainTeX{plain} +\ifx\fmtname\nameofplainTeX\else + \expandafter\begingroup +\fi +%</internal> +%<*install> +\input docstrip.tex +\keepsilent +\askforoverwritefalse +\preamble +---------------------------------------------------------------- +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 +---------------------------------------------------------------- + +\endpreamble +\postamble + +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. + +\endpostamble +\usedir{tex/latex/pgfopts} +\generate{ + \file{\jobname.sty}{\from{\jobname.dtx}{package}} +} +%</install> +%<install>\endbatchfile +%<*internal> +\usedir{source/latex/pgfopts} +\generate{ + \file{\jobname.ins}{\from{\jobname.dtx}{install}} +} +\nopreamble\nopostamble +\usedir{doc/latex/pgfopts} +\generate{ + \file{README.txt}{\from{\jobname.dtx}{readme}} +} +\ifx\fmtname\nameofplainTeX + \expandafter\endbatchfile +\else + \expandafter\endgroup +\fi +%</internal> %<*driver> -\PassOptionsToClass{a4paper}{article} -\documentclass[german,english,UKenglish]{ltxdoc} +\documentclass[a4paper]{ltxdoc} +\usepackage[T1]{fontenc} +\usepackage{csquotes,lmodern,pgfopts} +\usepackage[osf]{mathpazo} +\usepackage[scaled=0.95]{helvet} +\usepackage[final]{listings,microtype} +\usepackage[numbered]{hypdoc} \EnableCrossrefs \CodelineIndex \RecordChanges -%\OnlyDescription -\usepackage{jawltxdoc} \begin{document} \DocInput{\jobname.dtx} \end{document} %</driver> % \fi % -%\CheckSum{220} -% -% \CharacterTable -% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z -% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z -% Digits \0\1\2\3\4\5\6\7\8\9 -% Exclamation \! Double quote \" Hash (number) \# -% Dollar \$ Percent \% Ampersand \& -% Acute accent \' Left paren \( Right paren \) -% Asterisk \* Plus \+ Comma \, -% Minus \- Point \. Solidus \/ -% Colon \: Semicolon \; Less than \< -% Equals \= Greater than \> Question mark \? -% Commercial at \@ Left bracket \[ Backslash \\ -% Right bracket \] Circumflex \^ Underscore \_ -% Grave accent \` Left brace \{ Vertical bar \| -% Right brace \} Tilde \~} -% -% \GetFileInfo{\jobname.sty} +%\GetFileInfo{\jobname.sty} +% +%\makeatletter +% +%^^A For creating examples with nice highlighting of code, and so +%^^A on; based on the system used in the listings source (lstsample). +%\lst@RequireAspects{writefile} +%\lstnewenvironment{LaTeXdemo}[1][code and example]^^A +% {^^A +% \global\let\lst@intname\@empty +% \expandafter\let\expandafter\LaTeXdemo@end +% \csname LaTeXdemo@#1@end\endcsname +% \@nameuse{LaTeXdemo@#1}^^A +% } +% {\LaTeXdemo@end} +%\newcommand*\LaTeXdemo@new[3]{^^A +% \expandafter\newcommand\expandafter*\expandafter +% {\csname LaTeXdemo@#1\endcsname}{#2}^^A +% \expandafter\newcommand\expandafter*\expandafter +% {\csname LaTeXdemo@#1@end\endcsname}{#3}^^A +%} +%\newcommand*\LaTeXdemo@common{^^A +% \setkeys{lst} +% { +% basicstyle = \small\ttfamily, +% basewidth = 0.51em, +% gobble = 3, +% keywordstyle = \color{blue}, +% language = [LaTeX]{TeX}, +% moretexcs = +% { +% pgfkeys , +% ProcessPgfOptions , +% ProcessPgfPackageOptions , +% } +% }^^A +%} +%\newcommand*\LaTeXdemo@input{^^A +% \MakePercentComment +% \catcode`\^^M=10\relax +% \small +% \begingroup +% \setkeys{lst}^^A +% {^^A +% SelectCharTable=\lst@ReplaceInput{\^\^I}{\lst@ProcessTabulator} +% }^^A +% \leavevmode +% \input{\jobname.tmp}^^A +% \endgroup +% \MakePercentIgnore +%} +%\LaTeXdemo@new{code only}{\LaTeXdemo@common}{} +% +%\MakeShortVerb\" +%\DeleteShortVerb\| +% +%\providecommand*\file{\texttt} +%\providecommand*\opt{\texttt} +%\providecommand*\pkg{\textsf} +% +%\makeatother +% +%\title{^^A +% \textsf{pgfopts} --- LaTeX package options with +% \pkg{pgfkeys}\thanks{^^A +% This file describes version \fileversion, last revised +% \filedate.^^A +% }^^A +%} +%\author{^^A +% Joseph Wright\thanks{E-mail: joseph.wright@morningstar2.co.uk}^^A +%} +%\date{Released \filedate} +% +%\maketitle % %\changes{v1.0}{2008/06/26}{First public release} -% -%\setkeys{lst}{language=[LaTeX]{TeX},moretexcs={pgfkeys, -% ProcessPgfOptions,pgfkeyscurrentname,pgfkeyscurrentvalue}} -% -%\DoNotIndex{\.,\/,\:,\=,\@classoptionslist,\@clsextension} -%\DoNotIndex{\@currext,\@currname,\@empty,\@expandtwoargs,\@for} -%\DoNotIndex{\@ifstar,\@ifundefined,\@makeother,\@nil,\@onlypreamble} -%\DoNotIndex{\@removeelement,\@tempa,\@unprocessedoptions} -%\DoNotIndex{\@unusedoptionlist,\AtEndOfPackage,\begingroup} -%\DoNotIndex{\catcode,\csname,\CurrentOption,\def,\do,\edef} -%\DoNotIndex{\else,\endcsname,\endgroup,\expandafter,\fi} -%\DoNotIndex{\gdef,\global,\ifx,\let,\newcommand,\noexpand} -%\DoNotIndex{\NeedsTeXFormat,\pgfkeys,\pgfkeysifdefined} -%\DoNotIndex{\ProvidesPackage,\relax,\RequirePackage,\space} -%\DoNotIndex{\string,\the,\toks@} -% -% \title{\currpkg\ --- \LaTeX\ package options with pgfkeys^^A -% \thanks{This file describes version \fileversion, last revised -% \filedate.}} -% \author{Joseph Wright^^A -% \thanks{E-mail: joseph.wright@morningstar2.co.uk}} -% \date{Released \filedate} -% -% \maketitle +%\changes{v2.0}{2009/04/30}{Complete internal rewrite} % %\begin{abstract} -% Using key--value options for packages and macros is a good way of -% handling large numbers of options with a clean interface. The -% \pkg{pgfkeys} package provides a very well designed system for -% defining and using keys, but does not make this available for -% handling \LaTeX\ class and package options. The \currpkg package -% adds this ability to \pkg{pgfkeys}, in the same way that -% \pkg{kvoptions} extends the \pkg{keyval} package. +% Using key--value options for packages and macros is a good way of +% handling large numbers of options with a clean interface. The +% \pkg{pgfkeys} package provides a very well designed system for +% defining and using keys, but does not make this available for +% handling LaTeX class and package options. The \pkg{pgfopts} package +% adds this ability to \pkg{pgfkeys}, in the same way that +% \pkg{kvoptions} extends the \pkg{keyval} package. %\end{abstract} % -%\begin{multicols}{2} %\tableofcontents -%\end{multicols} % %\section{Introduction} +% % The key--value method for optional arguments is very popular, as it % allows the class or package author to define a large number of % options with a simple interface. A number of packages can be used % to provide the key management system, most of which load or extent % the parent \pkg{keyval} package. On its own, \pkg{keyval} can only % be used for parsing the arguments of macros. However, a number of -% packages have extended the method to processing \LaTeX\ class and +% packages have extended the method to processing LaTeX class and % package options. This processing is made available as part of two % general-purpose packages \pkg{xkeyval} and \pkg{kvoptions}; both % allow the author of a class or package to process key--value @@ -216,432 +230,370 @@ extends the keyval package. % The \pkg{pgfkeys} package provides a somewhat different key--value % system to \pkg{keyval} and derivatives. This uses a completely % different model for defining and using keys, although for the -% end-user the result appears very similar. The \currpkg package +% end-user the result appears very similar. The \pkg{pgfopts} package % allows keys defined with \pkg{pgfkeys} to be used as class or % package options, in the same way that \pkg{kvoptions} extends % \pkg{keyval}. % -% Users of \currpkg should be familiar with the general methods used -% by \pkg{pgfkeys}. These are outlined in the manual for the +% Users of \pkg{pgfopts} should be familiar with the general methods +% used by \pkg{pgfkeys}. These are outlined in the manual for the % Ti\emph{k}z and \pkg{pgf} bundle. % +%\section{Installation} +% +% The package is supplied in \file{dtx} format and as a pre-extracted +% zip file, \file{\jobname.tds.zip}. The later is most convenient for +% most users: simply unzip this in your local texmf directory and +% run \texttt{texhash} to update the database of file locations. If +% you want to unpack the \file{dtx} yourself, running +% \texttt{tex \jobname.dtx} will extract the package whereas +% \texttt{latex \jobname.dtx} will extract it and also typeset the +% documentation. +% +% Typesetting the documentation requires a number of packages in +% addition to those needed to use the package. This is mainly +% because of the number of demonstration items included in the text. To +% compile the documentation without error, you will need the packages: +% \begin{itemize} +% \item \pkg{csquotes} +% \item \pkg{helvet} +% \item \pkg{hypdoc} +% \item \pkg{listings} +% \item \pkg{lmodern} +% \item \pkg{mathpazo} +% \item \pkg{microtype} +%\end{itemize} +% %\section{Using the package} +% %\subsection{Creating options} -% To create package or class options for use with \currpkg, it is +% +% To create package or class options for use with \pkg{pgfopts}, it is % only necessary to define the appropriate keys. Taking as an -% example a package ``\pkg{MyOwnPackage}'', which uses the prefix +% example a package \enquote{\pkg{MyOwnPackage}}, which uses the prefix % \texttt{MOP} on internal macros, creating keys would take the form: -%\begin{LaTeXexample}[noexample] -% \pgfkeys{/MOP/.cd, -% keyone/.code=\wlog{Value `#1' given}, -% keytwo/.store in=\MOP@store} -%\end{LaTeXexample} +%\begin{LaTeXdemo}[code only] +% \pgfkeys{ +% /MOP/.cd, +% keyone/.code=\wlog{Value '#1' given}, +% keytwo/.store in=\MOP@store +% } +%\end{LaTeXdemo} % Here, \opt{keyone} simply writes its argument to the log, while % \opt{keytwo} stores the value given in the \cs{MOP@store} macro. % % An important point to notice is that the key names \emph{do not} -% contain a space. This is because the \LaTeX\ kernel removes spaces +% contain a space. This is because the LaTeX kernel removes spaces % from options before they are passed to the class or package. Spaces % can occur in the path to the key, but not in the key name itself. % This restriction only applies to keys used as options. -% +% %\subsection{Processing options} +% %\DescribeMacro{\ProcessPgfOptions} -% Options should be processed using the \cs{ProcessPgfOptions} macro, -% which takes two forms. When invoked followed by a star, the system -% will use the name of the current file as the key path. Thus, for -% the example \pkg{MyOwnPackage.sty}, \currpkg would use the path -% \opt{/MyOwnPackage}. -%\begin{LaTeXexample}[noexample] -% \ProcessPgfOptions* -%\end{LaTeXexample} -% When the key path does not match the current file name, the second -% form of \cs{ProcessPgfOptions} should be used. The full path to be -% searched should be given as the argument to the macro. Continuing -% the example, for \pkg{MyOwnPackage.sty} using path \opt{/MOP}, the -% correct call is: -%\begin{LaTeXexample}[noexample] +% The \cs{ProcessPgfOptions} macro is used to process package or +% class options using \pkg{pgfkeys}. When used in a package, it +% will also examine the available class options, and use any which +% match declared package options. \cs{ProcessPgfOptions} requires +% the \pkg{pgfkeys} key \meta{path} to search for options. Thus +% for the example of \pkg{MyOwnPackage} given in the previous +% section, the appropriate call would be +%\begin{LaTeXdemo}[code only] % \ProcessPgfOptions{/MOP} -%\end{LaTeXexample} -% Notice that the \emph{full} path is given here, including the -% leading ``|/|''; this allows the advance user to alter the default -% path before calling \cs{ProcessPgfOptions}. -% -%\subsection{Specialised options} -% Users of \pkg{kvoptions} will be aware that there are two types of -% options which need specialised handling. First, there is the need -% to process options which should not be given a value. Using -% \pkg{pgfkeys}, this is achieved using the \opt{.value forbidden} -% handler. -%\begin{LaTeXexample}[noexample] -% \pgfkeys{/MOP/.cd, -% keythree/.code=\wlog{keythree set}, -% keythree/.value forbidden} -%\end{LaTeXexample} -% -% The second type of specialist option is the unknown option. -% Some packages accept arbitrary values in the options, which -% can then be used to load configuration files, \etc. Once -% again, this is handled using correctly-defined keys. -%\begin{LaTeXexample}[noexample] -% \pgfkeys{/MOP/.cd, -% .unknown/.code=\wlog{% -% The unknown key `\pgfkeyscurrentname' was given with -% value `\pgfkeyscurrentvalue'}} -%\end{LaTeXexample} -% -% The power of the \pkg{pgfkeys} system is demonstrated here: no -% additional macros are needed to handle the specialised option -% types. -% -% \StopEventually{^^A -% \PrintChanges -% \PrintIndex} -% -% \iffalse -%<*package> -% \fi +%\end{LaTeXdemo} +% Alternatively, \cs{ProcessPgfOptions} can be given with a +% star: +%\begin{LaTeXdemo}[code only] +% \ProcessPgfOptions* +%\end{LaTeXdemo} +% The macro will then use the current file name as the path. This will +% be the name of the current class or package, as appropriate. +% +%\DescribeMacro{\ProcessPgfPackageOptions} +%\changes{v2.0}{2010/05/01}{New \cs{ProcessPgfPackageOptions} +% macro} +% As a complement to \cs{ProcessPgfOptions}, the macro +% \cs{ProcessPgfPackageOptions} is also provided. As the name indicates, +% this is intended for use in packages. It does \emph{not} examine the +% list of global class options, processing only the list of options +% given for the class itself. If used in a class, the behaviour will +% be identical to \cs{ProcessPgfOptions}. +% +%\StopEventually{^^A +% \PrintChanges +% \PrintIndex +%} +% +%\section{Implementation} % -% \section{Implementation} % The code here is based heavily on \pkg{kvoptions}, which has a -% similar aim to \currpkg, but works with \pkg{keyval} and derived +% similar aim to \pkg{pgfopts}, but works with \pkg{keyval} and derived % packages. -% -%\begin{macro}{\pgfopts@id} -% Macro naming follows the scheme used by \pkg{pgfkeys}: the full -% package name is the prefix. +% % \begin{macrocode} -\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] -% \end{macrocode} -%\end{macro} -% The \pkg{pgfkeys} package is needed, unsurprisingly. +%<*package> +\ProvidesClass{pgfopts} + [2010/05/01 v2.0 LaTeX package options with pgfkeys] +% \end{macrocode} +% +% The only package requires is \pkg{pgfkeys} itself. % \begin{macrocode} \RequirePackage{pgfkeys} % \end{macrocode} -% -%\begin{macro}{\pgfopts@catcodes} -% A few category codes are set correctly, to prevent odd -% accidents. +% +%\begin{macro}{\ifpgfopts@process@class} +% The processing of options can apply to those which are given for +% a class, or can be limited to those of the package only. % \begin{macrocode} -\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{\.} +\newif\ifpgfopts@process@class % \end{macrocode} -%\end{macro} +%\end{macro} % -%\begin{macro}{\ProcessPgfOptions} -% The user macro for processing options may have a star. In that -% case, \cs{@currname} is used for setting keys. +%\begin{macro}{\pgfopts@options@clist} +% A comma-separated list of options to process. % \begin{macrocode} -\newcommand*{\ProcessPgfOptions}{% - \@ifstar - {\begingroup - \edef\@tempa{% - \endgroup - \noexpand\pgfopts@ProcessOptions - {/\@currname}}% - \@tempa}% - {\pgfopts@ProcessOptions}} -\@onlypreamble\ProcessPgfOptions +\newcommand*\pgfopts@options@clist{} % \end{macrocode} -%\end{macro} -%\begin{macro}{\pgfopts@temp} -% A private storage area is needed by the next macro. +%\end{macro} +% +%\begin{macro}{\pgfopts@options@execute} +% A storage macro which specifies the final list of options to +% actually execute. % \begin{macrocode} -\newcommand*{\pgfopts@temp}{} +\newcommand*\pgfopts@options@execute{} % \end{macrocode} %\end{macro} -%\begin{macro}{\pgfopts@ProcessOptions} -% \darg{path} -% The business end of the package. This is a modified copy of the -% macro \cs{KVO@ProcessOptions} from \pkg{kvoptions}. Some -% simplifications are made due to the differences in key system, and -% as patching the kernel is ignored. +% +%\begin{macro}{\pgfopts@key@path} +%\begin{macro}{\pgfopts@process@options} +% The main processing macro first clears the list of options to deal +% with, and stores the key path to use. Global and local options are +% then added to the \enquote{to do} list before executing the options. % \begin{macrocode} -\newcommand*{\pgfopts@ProcessOptions}[1]{% - \def\pgfopts@temp{,}% +\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 - \ifx\@classoptionslist\relax\else + \expandafter\pgfopts@check@class@options + \fi + \pgfopts@process@local@options + \pgfopts@options@execute + \let\CurrentOption\@empty + \AtEndOfPackage{\let\@unprocessedoptions\relax}% +} % \end{macrocode} -%\begin{macro}{\pgfopts@CurrentOption} -% For packages, the list of global (class) options needs to be -% checked. The assumption is made that only \emph{explicitly} -% declared keys will be accepted as options here. The strange -% argument to \cs{pgfkeysifdefined} is needed as checking for the key -% itself only works if it has already been used. +%\end{macro} +%\end{macro} +% +%\begin{macro}{\pgfopts@current@option} +%\begin{macro}{\pgfopts@check@class@options} +%\begin{macro}{\pgfopts@check@class@options@aux} +% First, a check to see if class options should be processed, and if so +% if there are any. If so, then each option needs to be examined. Any +% \texttt{=\meta{value}} is removed, and a test is made to see if +% the resulting \meta{key} was defined for the current \meta{path}. +% If so, the option is added to the list for processing later, and +% it is removed from the list of unused options. The syntax for the +% later process is rather complex, but LaTeX2e's function to +% achieve that is somewhat awkward. % \begin{macrocode} - \@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}% - {}}% +\newcommand*\pgfopts@current@option{} +\newcommand*\pgfopts@check@class@options{% + \ifpgfopts@process@class + \ifx\@classoptionslist\relax\else + \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 + }% + {}% + }% +} % \end{macrocode} %\end{macro} -% Now the local options have to be processed. If there are none, -% then the global list is simply copied. Otherwise, the local -% options are first added to the ``to do'' list stored in \cs{toks@}. +%\end{macro} +%\end{macro} +% +%\begin{macro}{\pgfopts@local@options} +%\begin{macro}{\pgfopts@process@local@options} +%\begin{macro}{\pgfopts@process@local@options@aux@i} +%\begin{macro}{\pgfopts@process@local@options@aux@ii} +%\begin{macro}{\pgfopts@process@local@options@class} +%\begin{macro}{\pgfopts@process@local@options@package} +% The first step in processing local options is to see if any exist. +% This is done inside a group to avoid polluting the hash table. If +% options are found, these are transferred into a storage macro and +% the auxiliary function is called. There is then a fork depending on +% whether a package or class is being processed. Once the list is +% finalised, the execution macro is set up appropriately. % \begin{macrocode} +\newcommand*\pgfopts@local@options{} +\newcommand*\pgfopts@process@local@options{% + \begingroup + \@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 - \@ifundefined{opt@\@currname.\@currext} - {\toks@\expandafter{\pgfopts@temp}} - {\toks@\expandafter\expandafter\expandafter{% - \csname opt@\@currname.\@currext\endcsname}% + \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}% +} % \end{macrocode} -% There is work to do if processing options of a class; unknown options -% from the global list have to be completely ignored. +% Options given for a class may not be applicable to the class itself, +% and so they have to be checked. The option is then added either to +% the list for processing now or two the list for packages to examine. % \begin{macrocode} - \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}}% +\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}% + }% +} % \end{macrocode} -% For packages, the two lists are simply combined. +% For packages, the local options are simply added to the list already +% set up from the global values. % \begin{macrocode} - \else - \toks@\expandafter\expandafter\expandafter{% - \expandafter\pgfopts@temp\the\toks@}% - \fi}% +\newcommand*\pgfopts@process@local@options@package{% + \pgfopts@list@add\pgfopts@options@clist\pgfopts@local@options +} % \end{macrocode} -% With everything done, the keys are sent to \pkg{pgfkeys} for -% processing. The default key system in \pkg{pgfkeys} is very -% different from that in \pkg{kvoptions}, and so the system here is -% much less complex. +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} +% +%\begin{macro}{\pgfopts@get@key@name} +%\begin{macro}{\pgfopts@get@key@name@aux} +% A simple function to leave only the key \meta{name} in the input +% stream, whether there is a \meta{value} or not. This needs to work +% with options which do not contain an equals sign at all. It is +% designed to work with a stored value. % \begin{macrocode} - \edef\pgfopts@temp{\endgroup - \noexpand\pgfkeys{#1/.cd,\the\toks@}}% - \pgfopts@temp - \let\CurrentOption\@empty - \AtEndOfPackage{\let\@unprocessedoptions\relax}} +\newcommand\pgfopts@get@key@name[1]{% + \expandafter\pgfopts@get@key@name@aux#1=\@nil +} +\def\pgfopts@get@key@name@aux#1=#2\@nil{#1} % \end{macrocode} %\end{macro} -%\begin{macro}{\pgfopts@sepkeyval} -% A very simply macro to separate a key from a potential value. +%\end{macro} +% +%\begin{macro}{\pgfopts@list@add@a@toks} +%\begin{macro}{\pgfopts@list@add@b@toks} +%\begin{macro}{\pgfopts@list@add@temp} +%\begin{macro}{\pgfopts@list@add} +% This function takes "#1" as the name of a comma-separated list and +% "#2" as the name of a macro containing content to add to the list. +% After the appropriate checks it adds the content of "#2" to the +% right hand end of variable "#1". % \begin{macrocode} -\newcommand*{\pgfopts@sepkeyval}{} -\def\pgfopts@sepkeyval#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 +} % \end{macrocode} %\end{macro} -% Tidying up. +%\end{macro} +%\end{macro} +%\end{macro} +% +%\begin{macro}{\ProcessPgfOptions} +%\begin{macro}{\ProcessPgfPackageOptions} +%\begin{macro}{\pgfopts@star@check} +% The two user functions set the flag for class option processing. +% A shared internal function then checks for a star, and either adds +% the current name or looks to pick one up from the input stream. % \begin{macrocode} -\pgfopts@catcodes +\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 +%</package> % \end{macrocode} -% +%\end{macro} +%\end{macro} +%\end{macro} +% %\Finale -% -%\iffalse -%</package> -%<*jawltxdoc> -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{jawltxdoc} -\usepackage[T1]{fontenc} -\usepackage{lmodern} -\usepackage[final]{listings,graphicx,microtype} -\usepackage[scaled=0.95]{helvet} -\usepackage[version=3]{mhchem} -\usepackage[osf]{mathpazo} -\usepackage{booktabs,array,url,courier,xspace,etoolbox,varioref} -\usepackage{upgreek,ifpdf,float,caption,longtable,babel} -\floatstyle{plaintop} -\restylefloat{table} -\labelformat{figure}{\figurename~#1} -\labelformat{table}{\tablename~#1} -\ifpdf - \usepackage{embedfile} - \embedfile[% - stringmethod=escape,% - mimetype=plain/text,% - desc={LaTeX docstrip source archive for package `\jobname'}% - ]{\jobname.dtx} -\fi -\IfFileExists{\jobname.sty} - {\usepackage{\jobname}}{} -\usepackage[numbered]{hypdoc} -\setcounter{IndexColumns}{2} -\newlength\LaTeXwidth -\newlength\LaTeXoutdent -\newlength\LaTeXgap -\setlength\LaTeXgap{1em} -\setlength\LaTeXoutdent{-0.15\textwidth} -\newbox\lst@samplebox -\edef\LaTeXexamplefile{\jobname.tmp} -\lst@RequireAspects{writefile} -\lstnewenvironment{LaTeXexample}[1][example]{% - \global\let\lst@intname\@empty - \ifcsname LaTeXcode#1\endcsname - \expandafter\let\expandafter\LaTeXcode - \csname LaTeXcode#1\endcsname - \expandafter\let\expandafter\LaTeXcodeend - \csname LaTeXcode#1end\endcsname - \else - \PackageError{jawltxdoc} - {Undefined example type `#1'} - \@ehd - \let\LaTeXcode\relax - \let\LaTeXcodeend\relax - \fi - \LaTeXcode} - {\lst@EndWriteFile - \LaTeXcodeend} -\newcommand*{\LaTeXcodeexample}{% - \setbox\lst@samplebox=\hbox\bgroup - \LaTeXcodefloat} -\let\LaTeXcoderesultonly\LaTeXcodeexample -\newcommand*{\LaTeXcodeexampleend}{% - \egroup - \setlength\LaTeXwidth{\wd\lst@samplebox}% - \begin{list}{}{% - \setlength\itemindent{0pt} - \setlength\leftmargin\LaTeXoutdent - \setlength\rightmargin{0pt}}% - \item - \setlength\LaTeXoutdent{-0.15\textwidth} - \begin{minipage}[c]{% - \textwidth-\LaTeXwidth-\LaTeXoutdent-\LaTeXgap} - \LaTeXcodefloatend - \end{minipage}% - \hfill - \begin{minipage}[c]{\LaTeXwidth}% - \hbox to\linewidth{\box\lst@samplebox\hss}% - \end{minipage}% - \end{list}} -\let\LaTeXcodenoexample\LaTeXcodeexample -\newcommand*{\LaTeXcodenoexampleend}{% - \egroup - \setlength\LaTeXwidth{\wd\lst@samplebox}% - \begin{list}{}{% - \setlength\itemindent{0pt} - \setlength\leftmargin{0pt} - \setlength\rightmargin{0pt}}% - \item - \begin{minipage}[c]{\LaTeXwidth} - \hbox to\linewidth{\box\lst@samplebox\hss}% - \end{minipage}% - \end{list}} -\newcommand*{\LaTeXcodefloat}{% - \setkeys{lst}{tabsize=4,gobble=3,breakindent=0pt, - basicstyle=\small\ttfamily,basewidth=0.51em, - keywordstyle=\color{blue}}% - \lst@BeginAlsoWriteFile{\LaTeXexamplefile}} -\newcommand*{\LaTeXcodefloatend}{% - \MakePercentComment\catcode`\^^M=10\relax - \small - {\setkeys{lst}{SelectCharTable=\lst@ReplaceInput{\^\^I}% - {\lst@ProcessTabulator}}% - \leavevmode \input{\LaTeXexamplefile}}% - \MakePercentIgnore} -\newcommand*{\LaTeXcoderesultonlyend}{\egroup\LaTeXcodefloatend} -\lstnewenvironment{BibTeXexample}{% - \global\let\lst@intname\@empty - \setbox\lst@samplebox=\hbox\bgroup - \setkeys{lst}{tabsize=4,gobble=3,breakindent=0pt, - basicstyle=\small\ttfamily,basewidth=0.51em, - keywordstyle=\color{black}} - \lst@BeginAlsoWriteFile{\LaTeXexamplefile}} - {\lst@EndWriteFile - \LaTeXcodeexampleend} -\newcommand*{\DescribeOption}{% - \leavevmode\@bsphack\begingroup\MakePrivateLetters - \Describe@Option} -\newcommand*{\Describe@Option}[1]{\endgroup - \marginpar{\raggedleft\PrintDescribeEnv{#1}}% - \SpecialOptionIndex{#1}\@esphack\ignorespaces} -\newcommand*{\SpecialOptionIndex}[1]{\@bsphack - \index{#1\actualchar{\protect\ttfamily#1} - (option)\encapchar usage}% - \index{options:\levelchar#1\actualchar{\protect\ttfamily#1}% - \encapchar usage}\@esphack} -\newcommand*{\indexopt}[1]{\DescribeOption{#1}\opt{#1}} -\newcommand*{\DescribeOptionInfo}[2]{% - \DescribeOption{#1}% - \opt{#1=\meta{#2}}\xspace} -\newcommand*{\ofixarg}[1]{% - {\ttfamily[}% - \ifmmode \expandafter \nfss@text \fi - {% - \meta@font@select - \edef\meta@hyphen@restore{% - \hyphenchar\the\font\the\hyphenchar\font}% - \hyphenchar\font\m@ne - \language\l@nohyphenation - #1\/% - \meta@hyphen@restore - }% - {\ttfamily]}} -\newcommand*{\pkg}[1]{\textsf{#1}} -\newcommand*{\currpkg}{\pkg{\jobname}\xspace} -\newcommand*{\opt}[1]{\texttt{#1}} -\newcommand*{\defaultopt}[1]{\opt{\textbf{#1}}} -\newcommand*{\file}[1]{\texttt{#1}} -\newcommand*{\ext}[1]{\file{.#1}} -\newcommand*{\latin}[1]{\emph{#1}} -\newcommand*{\etc}{% - \@ifnextchar. - {\latin{etc}} - {\latin{etc}.\xspace}} -\newcommand*{\eg}{% - \@ifnextchar. - {\latin{e.g}} - {\latin{e.g}.\xspace}} -\newcommand*{\ie}{% - \@ifnextchar. - {\latin{i.e}} - {\latin{i.e}.\xspace}} -\newcommand*{\etal}{% - \@ifnextchar. - {\latin{et~al.}} - {\latin{et~al}.\xspace}} -\newcommand*{\AMS}{{\protect\usefont{OMS}{cmsy}{m}{n}% - A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}} -\providecommand*{\eTeX}{\ensuremath{\varepsilon}-\TeX} -\DeclareRobustCommand*{\XeTeX} - {X\kern-.125em\lower.5ex\hbox{\reflectbox{E}}\kern-.1667em\TeX} -\providecommand*{\CTAN}{\textsc{ctan}} -\patchcmd{\@addmarginpar} - {\@latex@warning@no@line {Marginpar on page \thepage\space moved}} - {\relax}{}{} -\newcounter{argument} -\g@addto@macro\endmacro{\setcounter{argument}{0}} -\newcommand*\darg[1]{% - \stepcounter{argument}% - {\ttfamily\char`\#\theargument~:~}#1\par\noindent\ignorespaces} -\newcommand*\doarg[1]{% - \stepcounter{argument}% - {\ttfamily\makebox[0pt][r]{[}% - \char`\#\theargument]:~}#1\par\noindent\ignorespaces} -%</jawltxdoc> -%\fi diff --git a/Master/texmf-dist/source/latex/pgfopts/pgfopts.ins b/Master/texmf-dist/source/latex/pgfopts/pgfopts.ins index 1465fc4fc78..97028707835 100644 --- a/Master/texmf-dist/source/latex/pgfopts/pgfopts.ins +++ b/Master/texmf-dist/source/latex/pgfopts/pgfopts.ins @@ -1,45 +1,71 @@ -%%
-%% This is file `pgfopts.ins',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% pgfopts.dtx (with options: `install')
-%% --------------------------------------------------------------
-%% 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
-%% --------------------------------------------------------------
-%%
-\input docstrip.tex
-\keepsilent
-\askforoverwritefalse
-\preamble
- --------------------------------------------------------------
- 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
- --------------------------------------------------------------
-
-\endpreamble
-\Msg{Generating pgfopts files:}
-\generate{\file{jawltxdoc.sty}{\from{\jobname.dtx}{jawltxdoc}}
-}
-\usedir{tex/latex/pgfopts}
-\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}
-}
-\usedir{source/latex/pgfopts}
-\generate{\file{\jobname.ins}{\from{\jobname.dtx}{install}}
-}
-\nopreamble\nopostamble
-\usedir{doc/latex/pgfopts}
-\generate{\file{README.txt}{\from{\jobname.dtx}{readme}}
-}
-\endbatchfile
-\endinput
-%%
-%% End of file `pgfopts.ins'.
+%% +%% This is file `pgfopts.ins', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% pgfopts.dtx (with options: `install') +%% ---------------------------------------------------------------- +%% 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 +%% ---------------------------------------------------------------- +%% +\input docstrip.tex +\keepsilent +\askforoverwritefalse +\preamble +---------------------------------------------------------------- +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 +---------------------------------------------------------------- + +\endpreamble +\postamble + +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. + +\endpostamble +\usedir{tex/latex/pgfopts} +\generate{ + \file{\jobname.sty}{\from{\jobname.dtx}{package}} +} +\endbatchfile +%% +%% 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.ins'. |