diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-pgfkeys.tex')
-rw-r--r-- | Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-pgfkeys.tex | 77 |
1 files changed, 47 insertions, 30 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-pgfkeys.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-pgfkeys.tex index fdac5a31c42..2c22c1a952a 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-pgfkeys.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-pgfkeys.tex @@ -1,4 +1,4 @@ -% Copyright 2006 by Till Tantau +% Copyright 2019 by Till Tantau % % This file may be distributed and/or modified % @@ -217,6 +217,10 @@ continue with the next subsection. The setting of a key is always local to the current \TeX\ group. \end{command} +\begin{command}{\pgfkeyssetevalue\marg{full key}\marg{token text}} + The |\edef| version of |\pgfkeyssetvalue|. +\end{command} + \begin{command}{\pgfkeyslet\marg{full key}\marg{macro}} Performs a |\let| statement so the \meta{full key} points to the contents of \meta{macro}. @@ -451,7 +455,7 @@ starting with |"| and one for strings starting with |<|. Naturally, in the above examples, the two handling macros did not do something particularly exciting. In the next example, we setup a more elaborate macro -that mimics a small part the behaviour of the |quotes| library, only for single +that mimics a small part the behavior of the |quotes| library, only for single quotes: % \begin{codeexample}[] @@ -576,7 +580,7 @@ Section~\ref{section-code-handlers}. net effect of all this is that you have then set up code for the key \meta{key} so that when you write |\pgfkeys{|\meta{key}|=|\meta{value}|}|, then the \meta{code} is executed with all occurrences of |#1| in - \meta{code} being replaced by \meta{value}. (This behaviour is quite + \meta{code} being replaced by \meta{value}. (This behavior is quite similar to the |\define@key| command of |keyval| and |xkeyval|). % \begin{codeexample}[] @@ -1171,14 +1175,6 @@ For styles the corresponding handlers as for normal code exist: than a |\def| to define the macro. \end{handler} -\begin{handler}{{.style args}|=|\marg{argument pattern}\marg{key list}} - This handler works like |/.code args|, only for styles. -\end{handler} - -\begin{handler}{{.estyle args}|=|\marg{argument pattern}\marg{code}} - This handler works like |/.ecode args|, only for styles. -\end{handler} - \begin{handler}{{.style n args}|=|\marg{argument count}\meta{key list}} This handler works like |/.code n args|, only for styles. Here, \meta{key list} may depend on all \meta{argument count} parameters. @@ -1205,6 +1201,14 @@ For styles the corresponding handlers as for normal code exist: % \end{handler} +\begin{handler}{{.style args}|=|\marg{argument pattern}\marg{key list}} + This handler works like |/.code args|, only for styles. +\end{handler} + +\begin{handler}{{.estyle args}|=|\marg{argument pattern}\marg{code}} + This handler works like |/.ecode args|, only for styles. +\end{handler} + \begin{handler}{{.prefix style}|=|\meta{prefix key list}} Works like |/.add style|, but only for the prefix key list. \end{handler} @@ -1350,9 +1354,9 @@ situation the following handler is useful. % \begin{codeexample}[code only] \pgfkeys{/line cap/.is choice} -\pgfkeys{/line cap/round/.style={\pgfsetbuttcap}} -\pgfkeys{/line cap/butt/.style={\pgfsetroundcap}} -\pgfkeys{/line cap/rect/.style={\pgfsetrectcap}} +\pgfkeys{/line cap/round/.code={\pgfsetbuttcap}} +\pgfkeys{/line cap/butt/.code={\pgfsetroundcap}} +\pgfkeys{/line cap/rect/.code={\pgfsetrectcap}} \pgfkeys{/line cap/rectangle/.style={/line cap=rect}} ... \draw [/line cap=butt] ... @@ -1490,9 +1494,9 @@ Key 4:& \pgfkeys{/key4} % \begin{enumerate} \item If a user provides a fully qualified key which could not be - found, for example the full string |/main path/option|, it assume + found, for example the full string |/main path/option|, it assumes that the user knew what she is doing -- and does \emph{not} - continue searching for |an option| in \marg{path list}. + continue searching for |option| in \marg{path list}. \item If a user provides only the key's name, for example |option| and |option| cannot be found in the current default path (which is |/main path| in our example above), the current default path is set @@ -1500,7 +1504,8 @@ Key 4:& \pgfkeys{/key4} here) and |\pgfkeys| will be restarted. This will be iterated until either a match has been found or all - elements in \marg{path list} have been tested. \item If all + elements in \marg{path list} have been tested. + \item If all elements in \marg{path list} have been checked and the key is still unknown, the fall-back handler |/handlers/.unknown| will be invoked. @@ -1537,20 +1542,26 @@ Key 4:& \pgfkeys{/key4} % \begin{codeexample}[code only] \pgfkeys{/path/.unknown/.code={% + \def\pgfkeys@searchalso@temp@value{#1}% \ifpgfkeysaddeddefaultpath + \expandafter\pgfkeys@firstoftwo + \else + \expandafter\pgfkeys@secondoftwo + \fi{% % only process keys for which no full path has been % provided: \pgfkeyssuccessfalse - \let\pgfkeys@searchalso@name =\pgfkeyscurrentkeyRAW + \let\pgfkeys@searchalso@name=\pgfkeyscurrentkeyRAW \ifpgfkeyssuccess \else % search with /tikz as default path: - \pgfqkeys{/tikz}{\pgfkeys@searchalso@name={#1}}% + \pgfqkeys{/tikz}{\pgfkeys@searchalso@name/.expand once=% + \pgfkeys@searchalso@temp@value}% \fi - \else - \def\pgfutilnext{\pgfkeysvalueof {/handlers/.unknown/.@cmd}#1\pgfeov}% - \pgfutilnext - \fi + }{% + \pgfkeysgetvalue{/handlers/.unknown/.@cmd}{\pgfkeys@code}% + \expandafter\pgfkeys@code\pgfkeys@searchalso@temp@value\pgfeov + }% } } \end{codeexample} @@ -1559,23 +1570,29 @@ Key 4:& \pgfkeys{/key4} % \begin{codeexample}[code only] \pgfkeys{/path/.unknown/.code={% + \def\pgfkeys@searchalso@temp@value{#1}% \ifpgfkeysaddeddefaultpath + \expandafter\pgfkeys@firstoftwo + \else + \expandafter\pgfkeys@secondoftwo + \fi{% \pgfkeyssuccessfalse \let\pgfkeys@searchalso@name=\pgfkeyscurrentkeyRAW \ifpgfkeyssuccess \else % step 1: search in /tikz with .try: - \pgfqkeys{/tikz}{\pgfkeys@searchalso@name/.try={#1}}% + \pgfqkeys{/tikz}{\pgfkeys@searchalso@name/.try/.expand once=% + \pgfkeys@searchalso@temp@value}% \fi \ifpgfkeyssuccess \else % step 2: search in /pgf (without .try!): - \pgfqkeys{/pgf}{\pgfkeys@searchalso@name={#1}}% + \pgfqkeys{/pgf}{\pgfkeys@searchalso@name/.expand once=\pgfkeys@searchalso@}% \fi - \else - \def\pgfutilnext{\pgfkeysvalueof {/handlers/.unknown/.@cmd}#1\pgfeov}% - \pgfutilnext - \fi + }{% + \pgfkeysgetvalue{/handlers/.unknown/.@cmd}{\pgfkeys@code}% + \expandafter\pgfkeys@code\pgfkeys@searchalso@temp@value\pgfeov + }% } } \end{codeexample} @@ -1583,7 +1600,7 @@ Key 4:& \pgfkeys{/key4} To also enable searching for styles (or other handled keys), consider changing the configuration for handled keys to - |/hander config=full or existing| when you use |/.search also|, that is, + |/handler config=full or existing| when you use |/.search also|, that is, use % \begin{codeexample}[code only] |