summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/skeyval/doc/skeyval-view-pokayoke1.tex
blob: e67898e6a37821eff8b9d094c425668021170ced (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
% This is file 'skeyval-view-pokayoke1.tex', version 1.3, 2013/02/22.      %
%                                                                          %
% This package and accompanying files may be distributed and/or            %
% modified under the conditions of the LaTeX Project Public License,       %
% either version 1.3 of this license or 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 2005/12/01 or later.                                             %
%                                                                          %
% The LPPL maintenance status of this software is 'author-maintained'.     %
%                                                                          %
% This software is provided 'as it is', without warranty of any kind,      %
% either expressed or implied, including, but not limited to, the          %
% implied warranties of merchantability and fitness for a particular       %
% purpose.                                                                 %
%                                                                          %
% The following files constitute the skeyval bundle and must be            %
% distributed as a whole:                                                  %
%                                                                          %
%  README, skeyval.sty, skeyval-core.tex, skeyval-for.tex,                 %
%  skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex,            %
%  skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls,          %
%  skeyval-testpkg.sty, skeyval-pokayoke1, skeyval-pokayoke2,              %
%  skeyval-view-pokayoke1.                                                 %
%                                                                          %
% Copyright (c) 2010-2013 Ahmed Musa (amusa22@gmail.com).                  %
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%

\documentclass{skeyval-testclass}
\usepackage[tabulate,xcolor-options=dvipsnames]{skeyval-view}
\usetikzlibrary[topaths]

\makeatletter

\setupviewkeys{length of default=30}

\skvdefinekeys[KV]{fam1}[vhp@]{%
  .initialize keys after define,
  .ord/{keya,keya2}/default-a,
  .cmd/keyb,
  .zcmd/key c/\def\cmdc##1{##1}/
    \edef\y{\detokenize\expandafter{\vhp@keyc}}\def\x##1{#1*key c*##1},
  % No default for keyd:
  .choice/keyd/.na
    /{
      center.do=\def\x##1{#1*##1},
      left.do={\def\ans{#1}},
      right
    }
    /\def\z##1{#1*##1}
    /\@warning{Invalid value for keyd},
  .bool/show shadow/true,
  .zbool/show center/true/\edef\cmd{\ifvhp@showcenter Yes\else No\fi},
  .ord/keye,
  .cmd/keyf,
  .tog/keyg/true
}
\def\vald{left}
\skvaddslots[KV]{fam1}{stylekeya,stylekeyb}{keya=vala,keyb=valb}
  {key c=valc,keyd=.expanded{\vald}}[defaults-a&b]{\def\y##1{#1*##1}}

% Define some keys:
\directkeys*{
  .prefix=KV,
  .family=fam2,
  .holder prefix=hp@,
  .initialize keys after define,
  .define keys={%
    .ord/keya,
    .ord/galaxy/Messier 51a/\def\constellation{Canes Venatici},
    .choice/planet/Earth/{Earth.do=\def\x##1{#1*##1},Mars,Jupiter},
    .bool/space travel/true,
    .cmd/astronaut/Yuri Gagarin/
      \edef\x{\ifx\hp@astronaut\@empty Neil Armstrong\else\hp@astronaut\fi},
    .ord/space observatory/Hubble Space Telescope/
      \def\father{Lyman Spitzer~(1914--1997)},
  },
}

\makeatother

\begin{document}

\title{The \texttt{\textcolor{blue}{skeyval-view}} Package\\[.25ex]
  Version 1.1a\\[1ex]
  \textsf{Test document}}
\author{Ahmed Musa}
\maketitle

\skvviewkeys{%
  .show={
    family=fam1,
    color=blue
  },
  .show={
    families={fam1,fam2},
    only those with default=true,
    write to file=\jobname.skvv,
    show labels=true,
    show wlabels=true,
  },
  .show={
    family=fam1,
    only those with default=[none],
    show labels=true,
    color=cyan,
  },
  .show={
    families={fam1,fam2},
    only those without default=true,
    color=purple,
  },
  .show={
    family=fam2,
    columns={prefix,family,key type,default},
    color=teal
  },
  .show={
    only those in family=fam2,
    columns={family,type,default}
  },
  .show={
    only those in families={fam1,fam2},
    columns={prefix,family,type,default},
    color=magenta
  }
}

\newpage

\skvtestcnt0\relax
\skvrecurse
  \advance\skvtestcnt1\relax
  \vskip\baselineskip\noindent
  \textcolor{blue!\the\numexpr10*\skvtestcnt!red!%
  \the\numexpr100/\skvtestcnt}{%
    The play was a great success, but the audience was a disaster.
    \endgraf{\small Oscar Wilde, 1854--1900}
  }%
\while
  \ifnum\skvtestcnt<8\relax
\fi

% Credit: Quintin Jean-Noël
\newcount\mycount
\begin{center}
\begin{tikzpicture}[scale=.5,transform shape]
\newforeach \nr in {1,...,8}{
  \mycount=\numexpr(\nr-1)*45\relax
  \node[draw,circle,inner sep=0.25cm] (N-\nr) at (\the\mycount:5.4cm) {};
}
\newforeach \nr in {9,...,16}{
  \mycount=\numexpr(\nr-1)*45+22\relax
  \node[draw,circle,inner sep=0.25cm] (N-\nr) at (\the\mycount:5.4cm) {};
}
\newforeach \nr in {1,...,15}{
  \mycount=\numexpr\nr+1\relax
  \newforeach \nra in {\the\mycount,...,16}{
    \path (N-\nr) edge[->,bend right=3] (N-\nra) edge[<-,bend left=3]
      (N-\nra);
  }
}
\end{tikzpicture}
\end{center}


\bigskip
Find more information about the \textcolor{red}{\texttt{show shadow}} option on page~\pageref{KV/fam1/show shadow}.

\end{document}

% End of file skeyval-view-pokayoke1.tex