diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.tex | 68 |
1 files changed, 63 insertions, 5 deletions
diff --git a/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.tex b/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.tex index 57195061611..b720169ebbe 100644 --- a/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.tex +++ b/Master/texmf-dist/doc/latex/skeyval/skeyval-pokayoke2.tex @@ -1,8 +1,6 @@ \documentclass[ insertwatermark,watermarkcolor=blue!55, - firstpagenumber=2, - maketitlepage, - unknown-key + firstpagenumber=2,maketitlepage,unknown-option ]{skeyval-testclass} \setupskvtestclass{% @@ -88,7 +86,7 @@ count in=\xc all \x satisfying \ifnum\x>5\fi ] in \alist { \newforeach[ - parser={;}, + parser={;}, subparser=:, evaluate=\y as \ye using \numexpr\y*10 ] \y:\z in {1:red; 2:green; 3:blue; 4:brown; 5:purple} do { @@ -103,4 +101,64 @@ \end{document} -% End of file skeyval-pokayoke2.tex
\ No newline at end of file + +%++ 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 |