summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.tex
blob: b720169ebbe646b2dfc3d554182c36b2c49fbd1d (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
\documentclass[
  insertwatermark,watermarkcolor=blue!55,
  firstpagenumber=2,maketitlepage,unknown-option
]{skeyval-testclass}

\setupskvtestclass{%
  watermarktext={skeyval-test2\\[.25ex]Page~\thepage}
}

\usepackage{lipsum}
\usepackage{xcolor}

% If you try to load 'skeyval-testpkg' with options, the options
% will all be zapped, unless you load 'skeyval-ltxpatch' on top of
% \documentclass.

\setuptextemphasis{usecolour=true,usebold,useitalics=true}

\begin{document}

\title{%
  The \texttt{\textcolor{blue}{skeyval}} Package\\[2ex]
  Version 1.1a\\[1ex]
  \textsf{Test document 2}
  \footnote{Made by \texttt{skeyval-testclass, Version~1.1a.}}%
}
\author{Ahmed Musa\footnote{\texttt{amusa22@gmail.com}.}}

\maketitle

\lipsum[1]

\xem{\lipsum[1]}

\setuptextemphasis{color=blue}

\xem{\lipsum[1]}

\setuptextemphasis{usecolor=false, usebold=false, useitalic=false}

\xem{\lipsum[1]}

\lipsum[1]

\setuptextemphasis{make-textemphasis-inactive}

\xem{\lipsum[1]}

% This will raise an error: 'dummy-option' has been disabled
% at begin document:
% \setuptextemphasis{dummy-option}

\begin{tikzpicture}[shading=ball]
\newforeach \x/\cola in {0/red,1/green,2/blue,3/yellow} do {%
  \newforeach \y/\colb in {0/red,1/green,2/blue,3/yellow} {%
    \node[
      circle,double,draw=-\cola!50!\colb,fill=\cola!50!\colb,
      thick,inner sep=2pt,
      minimum size=10mm,font=\bfseries\color{white}
    ] at (\x*2,\y*2) {\x,\y};
  }%
}
\end{tikzpicture}

\bigskip
\parindent-20pt
\begin{tikzpicture}
\draw[step=.5cm,blue!65,very thin] (0,0) grid (13,6);
\newforeach \x in {1,2,...,5,7,8,...,12} {
  \newforeach \y in {1,...,5} do {
    \draw (\x,\y) +(-.5,-.5) rectangle ++(.5,.5);
    \draw (\x,\y) node{\x,\y};
  }
}
\end{tikzpicture}

\bigskip
\begingroup
\catcode`\,=13
\gdef\alist{1,2,...,5,7,8,...,12}
\endgroup
\parindent-20pt
\begin{tikzpicture}
\draw[step=.5cm,blue!65,very thin] (0,0) grid (13,6);
\newforeach* \x [
  count in=\xc all \x satisfying \ifnum\x>5\fi
] in \alist {
  \newforeach[
    parser={;}, subparser=:,
    evaluate=\y as \ye using \numexpr\y*10
  ]
    \y:\z in {1:red; 2:green; 3:blue; 4:brown; 5:purple} do {
    \draw [fill=\z\ifnum\x>5!\ye\fi](\x,\y) +(-.5,-.5) rectangle ++(.5,.5);
    \draw (\x,\y) node {\x,\y};
  }
}
\global\let\xc\xc
\end{tikzpicture}
%\show\xc


\end{document}


%++ Pokayoke for \skvsetdirectkeysparser and \skvsetdefinekeysparser ++%

\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\makeatletter
\skvsetdirectkeysparser{;}
\skvsetdefinekeysparser{;}
\directkeys*{
  .family=graph;
  .holder prefix=cvt@;
  .initialize keys after define;
  .define keys={
    .ord/num vertices,number of vertices,vertices/6/
      \skvensureinteger{vertices}{#1}
      \def\cvt@vertices{#1}
    ;
    .ord/radius,circle radius/2/\def\cvt@radius{#1};
    .cmd/x,y/0
  };
  .preset keys={vertices,radius,x,y}
}
\newcommand*\drawgraph[1][]{%
  \directkeys{
    .family=graph;
    .set keys={#1}
  }
  \pgfmathsetmacro\halfcircleradius{\cvt@radius/2}
  \draw[blue] (\cvt@x,\cvt@y) circle (\halfcircleradius cm)
    node [regular polygon, regular polygon sides=\cvt@vertices,
          minimum size=\cvt@radius cm, draw=none, name={vertex set}]{};
  \foreach \x in {1,...,\cvt@vertices}{
    \node[draw,circle,inner sep=1pt,blue,fill=blue] at (vertex set.corner \x){};
  }
  \foreach \x in {1,...,\cvt@vertices}{
    \foreach \y in {\x,...,\cvt@vertices}{
      \draw[ultra thin, red] (vertex set.corner \x)--(vertex set.corner \y);
    }
  }
}
\makeatother
\begin{document}
\begin{tikzpicture}
\drawgraph[number of vertices=6, circle radius=3, x=0, y=0]
\drawgraph[number of vertices=8, circle radius=3, x=4, y=0]
\end{tikzpicture}
\par\bigskip
\begin{tikzpicture}
% Use default values of positions:
\drawgraph[vertices=8, radius=3]
% Use default values of vertices and radius:
\drawgraph[x=4, y=0]
\end{tikzpicture}
\par\bigskip
\begin{tikzpicture}
% Use default values of all keys:
\drawgraph
\end{tikzpicture}
\end{document}

% End of file skeyval-pokayoke2.tex