% \iffalse meta-comment
%
% pst-xkey package by Hendri Adriaens.
%
% Extract package files and create documentation:
%    latex pst-xkey.dtx
%    latex pst-xkey.dtx
%    makeindex -s gglo.ist -o pst-xkey.gls pst-xkey.glo
%    makeindex -s gind.ist -o pst-xkey.ind pst-xkey.idx
%    latex pst-xkey.dtx
%    latex pst-xkey.dtx
%
% To finish the installation you have to move the following
% file into a directory searched by TeX:
%    pst-xkey.tex
% Additional to this file, LaTeX should be able to locate
% the following file:
%    pst-xkey.sty
%
%% ---------------------------------------
%% Copyright (C) 2004-2005 Hendri Adriaens
%% ---------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% 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.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% This Current Maintainer of this work is Hendri Adriaens.
%%
%% This work consists of the files xkeyval.dtx and pst-xkey.dtx and
%% the from xkeyval.dtx derived files keyval.tex, xkvtxhdr.tex,
%% xkeyval.sty, xkeyval.tex, xkvltxp.sty, xkveca.cls, xkvecb.cls,
%% xkvesa.sty, xkvesb.sty, xkvesc.sty, xkvex1.tex, xkvex2.tex,
%% xkvex3.tex and xkvex4.tex and the from pst-xkey.dtx derived
%% files pst-xkey.sty and pst-xkey.tex.
%%
%% The following files constitute the xkeyval bundle and must be
%% distributed as a whole: readme, pst-xkey.pdf, xkeyval.pdf, keyval.tex,
%% pst-xkey.sty, pst-xkey.tex, xkeyval.sty, xkeyval.tex, xkvltxp.sty,
%% xkvtxhdr.tex, pst-xkey.dtx and xkeyval.dtx.
%%
% \fi
%
% \iffalse
%<*batchfile>
\begingroup
\input docstrip
\keepsilent
\preamble
\endpreamble
\askforoverwritefalse
\generate{
  \file{pst-xkey.tex}{\from{pst-xkey.dtx}{tex}}
  \file{pst-xkey.sty}{\from{pst-xkey.dtx}{latex}}
  \file{pxkpream.ble}{\from{pst-xkey.dtx}{preamble}}
  \file{pst-xkey.bib}{\from{pst-xkey.dtx}{bib}}
}
\endgroup
%</batchfile>
%<*driver>
\documentclass{ltxdoc}
\input{pxkpream.ble}
\begin{document}
\DocInput{pst-xkey.dtx}
\let\Section\section\def\section*#1{\Section*{#1}\addcontentsline{toc}{section}{#1}}
\bibliographystyle{plain}
\bibliography{pst-xkey}
\PrintChangesX
\PrintIndex
\end{document}
%</driver>
% \fi
%
% \changes{v1.0}{2004/09/27}{Initial release}
% \changes{v1.1}{2004/10/05}{Changed loading preventions}
% \changes{v1.2 }{2004/11/25}{Updated docs and code to \pf{xkeyval} v1.7}
% \changes{v1.2 }{2004/11/25}{Updated license information}
% \changes{v1.3}{2005/01/16}{Updated license information}
%
% \GetFileInfo{pst-xkey.sty}
%
% \CheckSum{82}
%
% \DoNotIndex{\@,\@nil,\catcode,\csname,\noexpand,\relax,\expandafter,
% \CurrentOption,\DeclareOptionX,\def,\edef,\endcsname,\fi,\input,
% \message,\PackageWarning,\XKV@tempa,\ifx,\ProcessOptionsX,\ProvidesPackage,
% \PSTXKEYcatcodes,\RequirePackage,\the,\in@,\ifin@,\@expandtwoargs,\else,
% \@for,\do,\@testopt,\ProvidesFile,\endinput,\let,\@undefined,\@addtofilelist,
% \NeedsTeXFormat}
%
% \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         \~}
%
%\title{The \pf{pst-xkey} package
%\thanks{This package can be downloaded from the CTAN mirrors:
%\texttt{/macros/latex/contrib/xkeyval}. See \texttt{pst-xkey.dtx} for
%information on installing \pf{pst-xkey} into your \TeX\ or \LaTeX\
%distribution and for the license of this package. \TeX\ users do
%\ci{input pst-xkey}, \LaTeX\ users do
%\ci{RequirePackage\{pst-xkey\}} or \ci{usepackage\{pst-xkey\}}.}}
%\author{Hendri Adriaens\\\url{http://stuwww.uvt.nl/~hendri}}
%\date{\fileversion\ (\filedate)}
%\maketitle
%
%\begin{abstract}\noindent
%This package implements a specialized version of the options system
%of \pf{xkeyval} \cite{xkeyval} designed for \pf{PSTricks}
%\cite{PSTricksWeb,PSTricks}. This system gives additional freedom to
%\pf{PSTricks} package authors since they won't have to worry anymore
%about potentially redefining keys of one of the many other
%\pf{PSTricks} packages. The command |\psset| is redefined to set
%keys in multiple families. Reading the documentation of the
%\pf{xkeyval} package (specifically, the `Known issues' section)
%first is recommended.
%\end{abstract}
%
%\begin{multicols}{2}
%[\section*{Contents}
%\setlength{\columnseprule}{.4pt}
%\setlength{\columnsep}{18pt}]
%\tableofcontents
%\end{multicols}
%
%\section{Defining \pf{PSTricks} keys}
%Keys defined in the original distribution of \pf{PSTricks} have the
%form |\psset@somekey|. These can be (re)defined by
%\begin{example}
% \define@key[psset]{}{somekey}{function}
%\end{example}
%Notice especially that these keys are located in the so-called
%`empty family'. For more information about |\define@key|,
%\SpecialUsageIndex{\define@key}
%see the \pf{xkeyval} \cite{xkeyval} documentation.\\
%
%When writing a \pf{PSTricks} package, let's say \pf{pst-new}, you
%should locate keys in a family which contains the name of your
%package. If you only need one family, you should define keys using
%\begin{example}
% \define@key[psset]{pst-new}{somekey}{function}
%\end{example}
%If you want to use multiple families in your package, you can do
%\begin{example}
% \define@key[psset]{pst-new-a}{somekey}{function}
% \define@key[psset]{pst-new-b}{anotherkey}{function}
%\end{example}\bigskip
%
%It is important that you add all of the families that you use in
%your package to the list in |\pst@famlist|.
%\SpecialUsageIndex{\pst@famlist} This list of families will be used
%by |\psset| (see section~\ref{sec:psset}) to scan for keys to set
%user input. You can add your families to the list using
%\begin{command}
% `\ci{pst@addfams}\marg{families}'
%\end{command}
%\SpecialUsageIndex{\pst@addfams}For instance
%\begin{example}
% \pst@addfams{pst-new}
%\end{example}
%or
%\begin{example}
% \pst@addfams{pst-new-a,pst-new-b}
%\end{example}
%
%\section{Setting \pf{PSTricks} keys}\label{sec:psset}
%Only one command is needed to set \pf{PSTricks} keys.
%\begin{command}
% `\ci{psset}\oarg{families}\marg{keys}'
%\end{command}
%\SpecialUsageIndex{\psset}
%This command will set \meta{keys} in \meta{families} using
%|\setkeys+|. When \meta{families} is not specified, it will set
%\meta{keys} in all families in |\pst@famlist| (which includes the
%empty family for original \pf{PSTricks} keys).
%\begin{example}
% \psset{somekey=red,anotherkey}
% \psset[pst-new-b]{anotherkey=green}
%\end{example}
%
%\StopEventually{}
%
% \section{Implementation}\label{sec:imple}
% \subsection{\TeX\ program}
% Avoid loading |pst-xkey.tex| twice.
%    \begin{macrocode}
%<*tex>
\csname PSTXKeyLoaded\endcsname
\let\PSTXKeyLoaded\endinput
\edef\PSTXKEYcatcodes{%
  \catcode`\noexpand\@\the\catcode`\@\relax
  \let\noexpand\PSTXKEYcatcodes\relax
}
\catcode`\@=11\relax
%    \end{macrocode}
% Load \pf{xkeyval} when not already done by |pst-xkey.sty| and
% provide information.
%    \begin{macrocode}
\ifx\ProvidesFile\@undefined
  \message{2005/01/16 v1.3 PSTricks specialization of xkeyval (HA)}
  \input xkeyval
\else
  \ProvidesFile{pst-xkey.tex}[2005/01/16 v1.3 PSTricks specialization of xkeyval (HA)]
  \@addtofilelist{pst-xkey.tex}
  \RequirePackage{xkeyval}
\fi
%    \end{macrocode}
% \begin{macro}{\pst@famlist}
% Initialize the list of families.
%    \begin{macrocode}
\def\pst@famlist{}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\pst@addfams}
% Adds the family to |\pst@famlist| if it was not in yet.
%    \begin{macrocode}
\def\pst@addfams#1{%
  \@for\XKV@tempa:=#1\do{%
    \@expandtwoargs\in@{,\XKV@tempa,}{,\pst@famlist,}%
    \ifin@\else\edef\pst@famlist{\pst@famlist,\XKV@tempa}\fi
  }%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\psset}
% \changes{v1.2a}{2004/12/21}{Properly expand \ci{pst@famlist}}
% \begin{macro}{\pss@t}
% Set keys. Uses \pf{xkeyval}'s |\setkeys+|.
%    \begin{macrocode}
\def\psset{%
  \expandafter\@testopt\expandafter\pss@t\expandafter{\pst@famlist}%
}
\def\pss@t[#1]{\setkeys+[psset]{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\@psset}
% This macro defined by |pstricks.tex| is internally used as a
% shortcut. We have to redefine this as well to avoid problems.
%    \begin{macrocode}
\def\@psset#1,\@nil{%
  \edef\XKV@tempa{\noexpand\setkeys+[psset]{\pst@famlist}}%
  \XKV@tempa{#1}%
}
%    \end{macrocode}
% \end{macro}
% Finalize.
%    \begin{macrocode}
\PSTXKEYcatcodes
%</tex>
%    \end{macrocode}
% \subsection{\LaTeX\ wrapper}
% Initialize the package.
%    \begin{macrocode}
%<*latex>
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{pst-xkey}[2005/01/16 v1.3 package wrapper for pst-xkey.tex (HA)]
%    \end{macrocode}
% Load required package.
%    \begin{macrocode}
\ifx\PSTXKeyLoaded\endinput\else\input pst-xkey \fi
%    \end{macrocode}
% Ignore options.
%    \begin{macrocode}
\DeclareOptionX*{\PackageWarning{pst-xkey}{option `\CurrentOption' ignored}}
\ProcessOptionsX
%</latex>
%    \end{macrocode}
% \Finale
% \endinput
% \iffalse
%<*preamble>
\usepackage{url}
\usepackage{pst-xkey}
\usepackage{xcolor}
\usepackage{listings}
\lstnewenvironment{command}{%
  \lstset{columns=flexible,frame=single,backgroundcolor=\color{yellow},%
    xleftmargin=\fboxsep,xrightmargin=\fboxsep,escapeinside=`',gobble=1}}{}
\lstnewenvironment{example}{%
  \lstset{basicstyle=\footnotesize\ttfamily,columns=flexible,frame=single,%
    backgroundcolor=\color{yellow!20},xleftmargin=\fboxsep,%
    xrightmargin=\fboxsep,gobble=1}}{}
\makeatletter
\def\tableofcontents{\@starttoc{toc}}
\def\changes@#1#2#3{%
  \protected@edef\@tempa{%
    \noexpand\glossary{\textbf{#1}\hfill\emph{(#2)}%
      \levelchar
      \ifx\saved@macroname\@empty
        \space\actualchar\generalname
      \else
        \expandafter\@gobble\saved@macroname
        \actualchar\string\verb\quotechar*%
        \verbatimchar\saved@macroname\verbatimchar
      \fi
      :\levelchar #3}%
    }%
  \@tempa\endgroup\@esphack
}
\makeatother
\def\PrintChangesX{%
  \begingroup
  \let\efill\relax
  \setlength{\columnsep}{18pt}%
  \setlength{\columnseprule}{.4pt}%
  \PrintChanges
  \endgroup
}
\def\larg#1{{\ttfamily\char`\<}\meta{#1}{\ttfamily\char`\>}}
\def\pf#1{\textsf{#1}}
\def\bs{\symbol{'134}}
\def\ci#1{\texttt{\bs#1}}
\setlength{\parindent}{0pt}
\def\labelenumi{\theenumi)}
\EnableCrossrefs
\RecordChanges
\GlossaryPrologue{\section*{Version history}\addcontentsline{toc}{section}{Version history}}
\CodelineIndex
%</preamble>
%
%<*bib>
@MISC{xkeyval,
  author       = {Hendri Adriaens},
  title        = {\pf{xkeyval} package, v2.0, 2005/01/30},
  howpublished = {\url{CTAN:/macros/latex/contrib/xkeyval}}
}

@MISC{PSTricks,
  author       = {{Timothy Van} {Zandt et al.}},
  title        = {\pf{PSTricks} package, v1.04, 2004/06/22},
  howpublished = {\url{CTAN:/graphics/pstricks}}
}

@MISC{PSTricksWeb,
  author       = {Herbert Vo\ss},
  title        = {\pf{PSTricks} website},
  howpublished = {\url{http://www.pstricks.de}}
}
%</bib>
%
%\fi
