Debian Codegraph @

texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.tex

raw
1 %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
2 % This is file 'skeyval-pokayoke2.tex', version 1.3, 2013/05/15. %
3 % %
4 % This package and accompanying files may be distributed and/or %
5 % modified under the conditions of the LaTeX Project Public License, %
6 % either version 1.3 of this license or any later version. The latest %
7 % version of this license is in http://www.latex-project.org/lppl.txt %
8 % and version 1.3 or later is part of all distributions of LaTeX %
9 % version 2005/12/01 or later. %
10 % %
11 % The LPPL maintenance status of this software is 'author-maintained'. %
12 % %
13 % This software is provided 'as it is', without warranty of any kind, %
14 % either expressed or implied, including, but not limited to, the %
15 % implied warranties of merchantability and fitness for a particular %
16 % purpose. %
17 % %
18 % The following files constitute the skeyval bundle and must be %
19 % distributed as a whole: %
20 % %
21 % README, skeyval.sty, skeyval-core.tex, skeyval-for.tex, %
22 % skeyval-view.sty, skeyval-ltxpatch.sty, skeyval-ltxcmds.tex, %
23 % skeyval-pstkey.sty, skeyval-pstkey.tex, skeyval-testclass.cls, %
24 % skeyval-testpkg.sty, skeyval-pokayoke1, skeyval-pokayoke2, %
25 % skeyval-view-pokayoke1. %
26 % %
27 % Copyright (c) 2010-2013 Ahmed Musa ([email protected]). %
28 %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
29
30 % Check the log file for warning about unused global option 'unknown-option':
31 \documentclass[
32 insertwatermark,watermarkcolor=blue!55,
33 firstpagenumber=2,maketitlepage,unknown-option
34 ]{skeyval-testclass}
35
36 \setupskvtestclass{%
37 watermarktext={skeyval-test2\\[.25ex]Page~\thepage}
38 }
39
40 \usepackage{lipsum}
41 \usepackage{xcolor}
42
43 % If you try to load 'skeyval-testpkg' with options, the options
44 % will all be zapped, unless you load 'skeyval-ltxpatch' on top of
45 % \documentclass.
46
47 \setuptextemphasis{usecolour=true,usebold,useitalics=true}
48
49 \begin{document}
50
51 \title{%
52 The \texttt{\textcolor{blue}{skeyval}} Package\\[2ex]
53 Version 1.1a\\[1ex]
54 \textsf{Test document 2}
55 \footnote{Made by \texttt{skeyval-testclass, Version~1.1a.}}%
56 }
57 \author{Ahmed Musa\footnote{\texttt{[email protected]}.}}
58
59 \maketitle
60
61 \lipsum[1]
62
63 \xem{\lipsum[1]}
64
65 \setuptextemphasis{color=blue}
66
67 \xem{\lipsum[1]}
68
69 \setuptextemphasis{usecolor=false, usebold=false, useitalic=false}
70
71 \xem{\lipsum[1]}
72
73 \lipsum[1]
74
75 \setuptextemphasis{make-textemphasis-inactive}
76
77 \xem{\lipsum[1]}
78
79 % This will raise an error: 'dummy-option' has been disabled
80 % at begin document:
81 % \setuptextemphasis{dummy-option}
82
83 \begin{tikzpicture}[shading=ball]
84 \newforeach \x/\cola in {0/red,1/green,2/blue,3/yellow} do {%
85 \newforeach \y/\colb in {0/red,1/green,2/blue,3/yellow} {%
86 \node[
87 circle,double,draw=-\cola!50!\colb,fill=\cola!50!\colb,
88 thick,inner sep=2pt,
89 minimum size=10mm,font=\bfseries\color{white}
90 ] at (\x*2,\y*2) {\x,\y};
91 }%
92 }
93 \end{tikzpicture}
94
95 \bigskip
96 \parindent-20pt
97 \begin{tikzpicture}
98 \draw[step=.5cm,blue!65,very thin] (0,0) grid (13,6);
99 \newforeach \x in {1,2,...,5,7,8,...,12} {
100 \newforeach \y in {1,...,5} do {
101 \draw (\x,\y) +(-.5,-.5) rectangle ++(.5,.5);
102 \draw (\x,\y) node{\x,\y};
103 }
104 }
105 \end{tikzpicture}
106
107 \bigskip
108 \begingroup
109 \catcode`\,=13
110 \gdef\alist{1,2,...,5,7,8,...,12}
111 \endgroup
112 \parindent-20pt
113 \begin{tikzpicture}
114 \draw[step=.5cm,blue!65,very thin] (0,0) grid (13,6);
115 \newforeach* \x [
116 count in=\xc all \x satisfying \ifnum\x>5\fi
117 ] in \alist {
118 \newforeach[
119 parser={;}, subparser=:,
120 evaluate=\y as \ye using \numexpr\y*10
121 ]
122 \y:\z in {1:red; 2:green; 3:blue; 4:brown; 5:purple} do {
123 \draw [fill=\z\ifnum\x>5!\ye\fi](\x,\y) +(-.5,-.5) rectangle ++(.5,.5);
124 \draw (\x,\y) node {\x,\y};
125 }
126 }
127 \global\let\xc\xc
128 \end{tikzpicture}
129 %\show\xc
130
131
132 \end{document}
133
134
135 %++ Pokayoke for \skvsetdirectkeysparser and \skvsetdefinekeysparser ++%
136
137 \usepackage{tikz}
138 \usetikzlibrary{shapes.geometric}
139 \makeatletter
140 \skvsetdirectkeysparser{;}
141 \skvsetdefinekeysparser{;}
142 \directkeys*{
143 .family=graph;
144 .holder prefix=cvt@;
145 .initialize keys after define;
146 .define keys={
147 .ord/num vertices,number of vertices,vertices/6/
148 \skvensureinteger{vertices}{#1}
149 \def\cvt@vertices{#1}
150 ;
151 .ord/radius,circle radius/2/\def\cvt@radius{#1};
152 .cmd/x,y/0
153 };
154 .preset keys={vertices,radius,x,y}
155 }
156 \newcommand*\drawgraph[1][]{%
157 \directkeys{
158 .family=graph;
159 .set keys={#1}
160 }
161 \pgfmathsetmacro\halfcircleradius{\cvt@radius/2}
162 \draw[blue] (\cvt@x,\cvt@y) circle (\halfcircleradius cm)
163 node [regular polygon, regular polygon sides=\cvt@vertices,
164 minimum size=\cvt@radius cm, draw=none, name={vertex set}]{};
165 \foreach \x in {1,...,\cvt@vertices}{
166 \node[draw,circle,inner sep=1pt,blue,fill=blue] at (vertex set.corner \x){};
167 }
168 \foreach \x in {1,...,\cvt@vertices}{
169 \foreach \y in {\x,...,\cvt@vertices}{
170 \draw[ultra thin, red] (vertex set.corner \x)--(vertex set.corner \y);
171 }
172 }
173 }
174 \makeatother
175 \begin{document}
176 \begin{tikzpicture}
177 \drawgraph[number of vertices=6, circle radius=3, x=0, y=0]
178 \drawgraph[number of vertices=8, circle radius=3, x=4, y=0]
179 \end{tikzpicture}
180 \par\bigskip
181 \begin{tikzpicture}
182 % Use default values of positions:
183 \drawgraph[vertices=8, radius=3]
184 % Use default values of vertices and radius:
185 \drawgraph[x=4, y=0]
186 \end{tikzpicture}
187 \par\bigskip
188 \begin{tikzpicture}
189 % Use default values of all keys:
190 \drawgraph
191 \end{tikzpicture}
192 \end{document}
193
194 % End of file skeyval-pokayoke2.tex