summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pgfkeyx/pgfkeyx-test1.tex
blob: 70915744aaea3d01d49f6852f6b790e4d11a8e17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
\documentclass{article}
\usepackage{pgfkeys}
\usepackage{pgfkeyx}
\makeatletter

\begingroup
\def\iden#1{#1}
\catcode`\/=13
\catcode`\,=13
\catcode`\==13
\iden{\endgroup
  \pgfkeys{%
    / my family / .is family,
    /my family/my keys/.cd,
    keya / .code = \def\keyavalue{#1},
    keya/.default = {keya-default},
    keyb / .code = \def\myvalueb{#1},
    keyb /.default=keyb-default,
    .normal code=\def\x#1{#1},
    keyc/.code=\pgfqkeysalso\pgfkeyscurrentpath{#1},
    keyc/.value required,
    keyd/.is if with no callback = true,
    keye/.is if with 1 callback = {true}{\def\x##1{##1-True-#1}},
    keyf/.is if with 2 callbacks =
      {true}{\def\x##1{##1-True-#1}}{\def\x##1{##1-False-#1}},
  }%
}

\pgfkeys{%
  /my family/my keys/.cd,
  keya={x},
  keyb=aa,
  keyc = {keya=aa, keyb=bb},
}

\pgfkeys{%
  /my family/my keys/.cd,
  keya/.restore default,
  .restore key defaults={keya,keyb}
}

\makeatother

\begin{document}
\pgfkeys{%
  /my family/my keys/keyf=true,
}
\ifkeyf
  \texttt{`keyf'} is \textsf{true}.
\fi
%\show\x
\end{document}