summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/sa-tikz
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-01-03 23:31:37 +0000
committerKarl Berry <karl@freefriends.org>2013-01-03 23:31:37 +0000
commit2a36de362639f891b12a07cb15896525e42e1465 (patch)
tree3ca68be97555cbf117654b171c1419de448353aa /Master/texmf-dist/doc/latex/sa-tikz
parent906dc8b9a23c6b8dfb85e864ba51ee74ee6f6929 (diff)
sa-tikz (3jan13)
git-svn-id: svn://tug.org/texlive/trunk@28714 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/sa-tikz')
-rw-r--r--Master/texmf-dist/doc/latex/sa-tikz/README13
-rw-r--r--Master/texmf-dist/doc/latex/sa-tikz/pgfmanual-en-macros.tex1206
-rw-r--r--Master/texmf-dist/doc/latex/sa-tikz/sa-tikz-doc.pdfbin0 -> 767226 bytes
-rw-r--r--Master/texmf-dist/doc/latex/sa-tikz/sa-tikz-doc.tex951
4 files changed, 2170 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/sa-tikz/README b/Master/texmf-dist/doc/latex/sa-tikz/README
new file mode 100644
index 00000000000..8d82de442fb
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/sa-tikz/README
@@ -0,0 +1,13 @@
+% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+% Sa-TikZ: TikZ library to draw switching architectures
+%
+% Version v0.5 03/01/2013 - (C) Claudio Fiandrino
+%
+% E-mail: claudio dot fiandrino at gmail dot com
+%
+% Released under the LaTeX Project Public License v1.3c or later
+% See http://www.latex-project.org/lppl.txt
+% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+%
+% The library provides an easy way to draw switching architectures
+% and to customize their aspect.
diff --git a/Master/texmf-dist/doc/latex/sa-tikz/pgfmanual-en-macros.tex b/Master/texmf-dist/doc/latex/sa-tikz/pgfmanual-en-macros.tex
new file mode 100644
index 00000000000..116cde6d9bf
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/sa-tikz/pgfmanual-en-macros.tex
@@ -0,0 +1,1206 @@
+% Copyright 2006 by Till Tantau
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Free Documentation License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+% $Header: /cvsroot/pgf/pgf/doc/generic/pgf/macros/pgfmanual-en-macros.tex,v 1.45 2009/11/15 13:13:24 ludewich Exp $
+
+
+
+\providecommand\href[2]{\texttt{#1}}
+\providecommand\hypertarget[2]{\texttt{#1}}
+\providecommand\hyperlink[2]{\texttt{#1}}
+
+
+\colorlet{examplefill}{yellow!80!black}
+\definecolor{graphicbackground}{rgb}{0.96,0.96,0.8}
+\definecolor{codebackground}{rgb}{0.8,0.8,1}
+
+\newenvironment{pgfmanualentry}{\list{}{\leftmargin=2em\itemindent-\leftmargin\def\makelabel##1{\hss##1}}}{\endlist}
+\newcommand\pgfmanualentryheadline[1]{\itemsep=0pt\parskip=0pt\item\strut{#1}\par\topsep=0pt}
+\newcommand\pgfmanualbody{\parskip3pt}
+
+
+
+\newenvironment{pgflayout}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{\texttt{\string\pgfpagesuselayout\char`\{\declare{#1}\char`\}}\oarg{options}}
+ \index{#1@\protect\texttt{#1} layout}%
+ \index{Page layouts!#1@\protect\texttt{#1}}%
+ \pgfmanualpdflabel{#1}{}%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+
+\newenvironment{command}[1]{
+ \begin{pgfmanualentry}
+ \extractcommand#1\@@
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+\newenvironment{commandlist}[1]{%
+ \begin{pgfmanualentry}
+ \foreach \xx in {#1} {%
+ \expandafter\extractcommand\xx\@@
+ }%
+ \pgfmanualbody
+}{%
+ \end{pgfmanualentry}
+}%
+
+% \begin{internallist}[register]{\pgf@xa}
+% \end{internallist}
+%
+% \begin{internallist}[register]{\pgf@xa,\pgf@xb}
+% \end{internallist}
+\newenvironment{internallist}[2][register]{%
+ \begin{pgfmanualentry}
+ \foreach \xx in {#2} {%
+ \expandafter\extractinternalcommand\expandafter{\xx}{#1}%
+ }%
+ \pgfmanualbody
+}{%
+ \end{pgfmanualentry}
+}%
+\def\extractinternalcommand#1#2{%
+ \pgfmanualentryheadline{Internal #2 \declare{\texttt{\string#1}}}%
+ \removeats{#1}%
+ \index{Internals!\strippedat @\protect\myprintocmmand{\strippedat}}%
+ \index{\strippedat @\protect\myprintocmmand{\strippedat}}%
+ \pgfmanualpdflabel{\textbackslash\strippedat}{}%
+}
+
+%% MW: START MATH MACROS
+\def\mvar#1{{\ifmmode\textrm{\textit{#1}}\else\rmfamily\textit{#1}\fi}}
+
+\makeatletter
+
+\def\extractmathfunctionname#1{\extractmathfunctionname@#1(,)\tmpa\tmpb}
+\def\extractmathfunctionname@#1(#2)#3\tmpb{\def\mathname{#1}}
+
+\makeatother
+
+\newenvironment{math-function}[1]{
+ \def\mathdefaultname{#1}
+ \extractmathfunctionname{#1}
+ \edef\mathurl{{math:\mathname}}\expandafter\hypertarget\expandafter{\mathurl}{}%
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{\texttt{#1}}%
+ \index{\mathname @\protect\texttt{\mathname} math function}%
+ \index{Math functions!\mathname @\protect\texttt{\mathname}}%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+\def\pgfmanualemptytext{}
+\def\pgfmanualvbarvbar{\char`\|\char`\|}
+
+\newenvironment{math-operator}[4][]{%
+ \begin{pgfmanualentry}
+ \csname math#3operator\endcsname{#2}{#4}
+ \def\mathtest{#4}%
+ \ifx\mathtest\pgfmanualemptytext%
+ \def\mathtype{(#3 operator)}
+ \else%
+ \def\mathtype{(#3 operator; uses the \texttt{#4} function)}
+ \fi%
+ \pgfmanualentryheadline{\mathexample\hfill\mathtype}%
+ \def\mathtest{#1}%
+ \ifx\mathtest\pgfmanualemptytext%
+ \index{#2@\protect\texttt{#2} #3 math operator}%
+ \index{Math operators!#2@\protect\texttt{#2}}%
+ \fi%
+ \pgfmanualbody
+}
+{\end{pgfmanualentry}}
+
+\newenvironment{math-operators}[5][]{%
+ \begin{pgfmanualentry}
+ \csname math#4operator\endcsname{#2}{#3}
+ \def\mathtest{#5}%
+ \ifx\mathtest\pgfmanualemptytext%
+ \def\mathtype{(#4 operators)}
+ \else%
+ \def\mathtype{(#4 operators; use the \texttt{#5} function)}
+ \fi%
+ \pgfmanualentryheadline{\mathexample\hfill\mathtype}%
+ \def\mathtest{#1}%
+ \ifx\mathtest\pgfmanualemptytext%
+ \index{#2#3@\protect\texttt{#2\protect\ #3} #4 math operators}%
+ \index{Math operators!#2#3@\protect\texttt{#2\protect\ #3}}%
+ \fi%
+ \pgfmanualbody
+}
+{\end{pgfmanualentry}}
+
+\def\mathinfixoperator#1#2{%
+ \def\mathoperator{\texttt{#1}}%
+ \def\mathexample{\mvar{x}\space\texttt{#1}\space\mvar{y}}%
+}
+
+\def\mathprefixoperator#1#2{%
+ \def\mathoperator{\texttt{#1}}%
+ \def\mathexample{\texttt{#1}\mvar{x}}%
+}
+
+\def\mathpostfixoperator#1#2{%
+ \def\mathoperator{\texttt{#1}}
+ \def\mathexample{\mvar{x}\texttt{#1}}%
+}
+
+\def\mathgroupoperator#1#2{%
+ \def\mathoperator{\texttt{#1\ #2}}%
+ \def\mathexample{\texttt{#1}\mvar{x}\texttt{#2}}%
+}
+
+\expandafter\let\csname matharray accessoperator\endcsname=\mathgroupoperator
+\expandafter\let\csname matharrayoperator\endcsname=\mathgroupoperator
+
+\def\mathconditionaloperator#1#2{%
+ \def\mathoperator{#1\space#2}
+ \def\mathexample{\mvar{x}\ \texttt{#1}\ \mvar{y}\ {\texttt{#2}}\ \mvar{z}}
+}
+
+\newcommand\mathcommand[1][\mathdefaultname]{%
+ \expandafter\makemathcommand#1(\empty)\stop%
+ \expandafter\extractcommand\mathcommandname\@@%
+ \medskip
+}
+\makeatletter
+
+\def\makemathcommand#1(#2)#3\stop{%
+ \expandafter\def\expandafter\mathcommandname\expandafter{\csname pgfmath#1\endcsname}%
+ \ifx#2\empty%
+ \else%
+ \@makemathcommand#2,\stop,
+ \fi}
+\def\@makemathcommand#1,{%
+ \ifx#1\stop%
+ \else%
+ \expandafter\def\expandafter\mathcommandname\expandafter{\mathcommandname{\ttfamily\char`\{#1\char`\}}}%
+ \expandafter\@makemathcommand%
+ \fi}
+\makeatother
+
+\def\calcname{\textsc{calc}}
+%% MW: END MATH MACROS
+
+
+\def\extractcommand#1#2\@@{%
+ \pgfmanualentryheadline{\declare{\texttt{\string#1}}#2}%
+ \removeats{#1}%
+ \index{\strippedat @\protect\myprintocmmand{\strippedat}}
+ \pgfmanualpdflabel{\textbackslash\strippedat}{}%
+}
+
+
+% \begin{environment}{{name}\marg{arguments}}
+\renewenvironment{environment}[1]{
+ \begin{pgfmanualentry}
+ \extractenvironement#1\@@
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+\def\extractenvironement#1#2\@@{%
+ \pgfmanualentryheadline{{\ttfamily\char`\\begin\char`\{\declare{#1}\char`\}}#2}%
+ \pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}%
+ \pgfmanualentryheadline{{\ttfamily\char`\\end\char`\{\declare{#1}\char`\}}}%
+ \index{#1@\protect\texttt{#1} environment}%
+ \index{Environments!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
+}
+
+
+\newenvironment{plainenvironment}[1]{
+ \begin{pgfmanualentry}
+ \extractplainenvironement#1\@@
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+\def\extractplainenvironement#1#2\@@{%
+ \pgfmanualentryheadline{{\ttfamily\declare{\char`\\#1}}#2}%
+ \pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}%
+ \pgfmanualentryheadline{{\ttfamily\declare{\char`\\end#1}}}%
+ \index{#1@\protect\texttt{#1} environment}%
+ \index{Environments!#1@\protect\texttt{#1}}%
+}
+
+
+\newenvironment{contextenvironment}[1]{
+ \begin{pgfmanualentry}
+ \extractcontextenvironement#1\@@
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+\def\extractcontextenvironement#1#2\@@{%
+ \pgfmanualentryheadline{{\ttfamily\declare{\char`\\start#1}}#2}%
+ \pgfmanualentryheadline{{\ttfamily\ \ }\meta{environment contents}}%
+ \pgfmanualentryheadline{{\ttfamily\declare{\char`\\stop#1}}}%
+ \index{#1@\protect\texttt{#1} environment}%
+ \index{Environments!#1@\protect\texttt{#1}}}
+
+
+\newenvironment{shape}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{Shape {\ttfamily\declare{#1}}}%
+ \index{#1@\protect\texttt{#1} shape}%
+ \index{Shapes!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+\newenvironment{shading}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{Shading {\ttfamily\declare{#1}}}%
+ \index{#1@\protect\texttt{#1} shading}%
+ \index{Shadings!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+
+\newenvironment{dataformat}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{Format {\ttfamily\declare{#1}}}%
+ \index{#1@\protect\texttt{#1} format}%
+ \index{Formats!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+\newenvironment{handler}[1]{
+ \begin{pgfmanualentry}
+ \extracthandler#1\@nil%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+\def\gobble#1{}
+\def\extracthandler#1#2\@nil{%
+ \pgfmanualentryheadline{Key handler \meta{key}{\ttfamily/\declare{#1}}#2}%
+ \index{\gobble#1@\protect\texttt{#1} handler}%
+ \index{Key handlers!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{/handlers/#1}%
+}
+
+
+\makeatletter
+
+
+\newenvironment{stylekey}[1]{
+ \begin{pgfmanualentry}
+ \def\extrakeytext{style, }
+ \extractkey#1\@nil%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+\def\choicesep{$\vert$}%
+\def\choicearg#1{\texttt{#1}}
+
+\newif\iffirstchoice
+
+% \mchoice{choice1,choice2,choice3}
+\newcommand\mchoice[1]{%
+ \begingroup
+ \firstchoicetrue
+ \foreach \mchoice@ in {#1} {%
+ \iffirstchoice
+ \global\firstchoicefalse
+ \else
+ \choicesep
+ \fi
+ \choicearg{\mchoice@}%
+ }%
+ \endgroup
+}%
+
+% \begin{key}{/path/x=value}
+% \begin{key}{/path/x=value (initially XXX)}
+% \begin{key}{/path/x=value (default XXX)}
+\newenvironment{key}[1]{
+ \begin{pgfmanualentry}
+ \def\extrakeytext{}
+ %\def\altpath{\emph{\color{gray}or}}%
+ \extractkey#1\@nil%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+% \insertpathifneeded{a key}{/pgf} -> assign mykey={/pgf/a key}
+% \insertpathifneeded{/tikz/a key}{/pgf} -> assign mykey={/tikz/a key}
+%
+% #1: the key
+% #2: a default path (or empty)
+\def\insertpathifneeded#1#2{%
+ \def\insertpathifneeded@@{#2}%
+ \ifx\insertpathifneeded@@\empty
+ \def\mykey{#1}%
+ \else
+ \insertpathifneeded@#2\@nil
+ \ifpgfutil@in@
+ \def\mykey{#2/#1}%
+ \else
+ \def\mykey{#1}%
+ \fi
+ \fi
+}%
+\def\insertpathifneeded@#1#2\@nil{%
+ \def\insertpathifneeded@@{#1}%
+ \def\insertpathifneeded@@@{/}%
+ \ifx\insertpathifneeded@@\insertpathifneeded@@@
+ \pgfutil@in@true
+ \else
+ \pgfutil@in@false
+ \fi
+}%
+
+% \begin{keylist}[default path]
+% {/path/option 1=value,/path/option 2=value2}
+% \end{keylist}
+\newenvironment{keylist}[2][]{%
+ \begin{pgfmanualentry}
+ \def\extrakeytext{}%
+ \foreach \xx in {#2} {%
+ \expandafter\insertpathifneeded\expandafter{\xx}{#1}%
+ \expandafter\extractkey\mykey\@nil%
+ }%
+ \pgfmanualbody
+}{%
+ \end{pgfmanualentry}
+}%
+
+\def\extractkey#1\@nil{%
+ \pgfutil@in@={#1}%
+ \ifpgfutil@in@%
+ \extractkeyequal#1\@nil
+ \else%
+ \pgfutil@in@{(initial}{#1}%
+ \ifpgfutil@in@%
+ \extractequalinitial#1\@nil%
+ \else
+ \pgfmanualentryheadline{{\ttfamily\declare{#1}}\hfill(\extrakeytext no value)}%
+ \def\mykey{#1}%
+ \def\mypath{}%
+ \def\myname{}%
+ \firsttimetrue%
+ \decompose#1/\nil%
+ \fi
+ \fi%
+}
+
+\def\extractkeyequal#1=#2\@nil{%
+ \pgfutil@in@{(default}{#2}%
+ \ifpgfutil@in@%
+ \extractdefault{#1}#2\@nil%
+ \else%
+ \pgfutil@in@{(initial}{#2}%
+ \ifpgfutil@in@%
+ \extractinitial{#1}#2\@nil%
+ \else
+ \pgfmanualentryheadline{{\ttfamily\declare{#1}=}#2\hfill(\extrakeytext no default)}%
+ \fi%
+ \fi%
+ \def\mykey{#1}%
+ \def\mypath{}%
+ \def\myname{}%
+ \firsttimetrue%
+ \decompose#1/\nil%
+}
+
+\def\extractdefault#1#2(default #3)\@nil{%
+ \pgfmanualentryheadline{{\ttfamily\declare{#1}\opt{=}}\opt{#2}\hfill (\extrakeytext default {\ttfamily#3})}%
+}
+
+\def\extractinitial#1#2(initially #3)\@nil{%
+ \pgfmanualentryheadline{{\ttfamily\declare{#1}=}#2\hfill (\extrakeytext no default, initially {\ttfamily#3})}%
+}
+
+\def\extractequalinitial#1 (initially #2)\@nil{%
+ \pgfmanualentryheadline{{\ttfamily\declare{#1}}\hfill (\extrakeytext initially {\ttfamily#2})}%
+ \def\mykey{#1}%
+ \def\mypath{}%
+ \def\myname{}%
+ \firsttimetrue%
+ \decompose#1/\nil%
+}
+
+% Introduces a key alias '/#1/<name of current key>'
+% to be used inside of \begin{key} ... \end{key}
+\def\keyalias#1{\vspace{-3pt}\item{\small alias {\ttfamily/#1/\myname}}\vspace{-2pt}\par
+ \pgfmanualpdflabel{/#1/\myname}{}%
+}
+
+\newif\iffirsttime
+
+\makeatother
+
+\def\decompose/#1/#2\nil{%
+ \def\test{#2}%
+ \ifx\test\empty%
+ % aha.
+ \index{#1@\protect\texttt{#1} key}%
+ \index{\mypath#1@\protect\texttt{#1}}%
+ \def\myname{#1}%
+ \else%
+ \iffirsttime
+ \begingroup
+ % also make a pdf link anchor with full key path.
+ \def\hyperlabelwithoutslash##1/\nil{%
+ \pgfmanualpdflabel{##1}{}%
+ }%
+ \hyperlabelwithoutslash/#1/#2\nil
+ \endgroup
+ \def\mypath{#1@\protect\texttt{/#1/}!}%
+ \firsttimefalse
+ \else
+ \expandafter\def\expandafter\mypath\expandafter{\mypath#1@\protect\texttt{#1/}!}%
+ \fi
+ \def\firsttime{}
+ \decompose/#2\nil%
+ \fi%
+}
+
+\def\indexkey#1{%
+ \def\mypath{}%
+ \decompose#1/\nil%
+}
+
+\newenvironment{predefinedmethod}[1]{
+ \begin{pgfmanualentry}
+ \extractpredefinedmethod#1\@nil
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+\def\extractpredefinedmethod#1(#2)\@nil{%
+ \pgfmanualentryheadline{Method \declare{\ttfamily #1}\texttt(#2\texttt) \hfill(predefined for all classes)}
+ \index{#1@\protect\texttt{#1} method}%
+ \index{Methods!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
+}
+
+
+\newenvironment{ooclass}[1]{
+ \begin{pgfmanualentry}
+ \def\currentclass{#1}
+ \pgfmanualentryheadline{Class \declare{\texttt{#1}}}
+ \index{#1@\protect\texttt{#1} class}%
+ \index{Class #1@Class \protect\texttt{#1}}%
+ \index{Classes!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+\newenvironment{method}[1]{
+ \begin{pgfmanualentry}
+ \extractmethod#1\@nil
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+\def\extractmethod#1(#2)\@nil{%
+ \def\test{#1}
+ \ifx\test\currentclass
+ \pgfmanualentryheadline{Constructor \declare{\ttfamily #1}\texttt(#2\texttt)}
+ \else
+ \pgfmanualentryheadline{Method \declare{\ttfamily #1}\texttt(#2\texttt)}
+ \fi
+ \index{#1@\protect\texttt{#1} method}%
+ \index{Methods!#1@\protect\texttt{#1}}
+ \index{Class \currentclass!#1@\protect\texttt{#1}}%
+ \pgfmanualpdflabel{#1}{}%
+}
+
+\newenvironment{attribute}[1]{
+ \begin{pgfmanualentry}
+ \extractattribute#1\@nil
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+\def\extractattribute#1=#2;\@nil{%
+ \def\test{#2}%
+ \ifx\test\@empty
+ \pgfmanualentryheadline{Private attribute \declare{\ttfamily #1} \hfill (initially empty)}
+ \else
+ \pgfmanualentryheadline{Private attribute \declare{\ttfamily #1} \hfill (initially {\ttfamily #2})}
+ \fi
+ \index{#1@\protect\texttt{#1} attribute}%
+ \index{Attributes!#1@\protect\texttt{#1}}
+ \index{Class \currentclass!#1@\protect\texttt{#1}}%
+ \pgfmanualpdflabel{#1}{}%
+}
+
+
+
+\newenvironment{predefinednode}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{Predefined node {\ttfamily\declare{#1}}}%
+ \index{#1@\protect\texttt{#1} node}%
+ \index{Predefined node!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+\newenvironment{coordinatesystem}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{Coordinate system {\ttfamily\declare{#1}}}%
+ \index{#1@\protect\texttt{#1} coordinate system}%
+ \index{Coordinate systems!#1@\protect\texttt{#1}}
+ \pgfmanualpdflabel{#1}{}%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+\newenvironment{snake}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{Snake {\ttfamily\declare{#1}}}%
+ \index{#1@\protect\texttt{#1} snake}%
+ \index{Snakes!#1@\protect\texttt{#1}}
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+\newenvironment{decoration}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{Decoration {\ttfamily\declare{#1}}}%
+ \index{#1@\protect\texttt{#1} decoration}%
+ \index{Decorations!#1@\protect\texttt{#1}}
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+
+\def\pgfmanualbar{\char`\|}
+\makeatletter
+\newenvironment{pathoperation}[3][]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{\textcolor{gray}{{\ttfamily\char`\\path}\
+ \ \dots}
+ \declare{\texttt{#2}}#3\ \textcolor{gray}{\dots\texttt{;}}}%
+ \def\pgfmanualtest{#1}%
+ \ifx\pgfmanualtest\@empty%
+ \index{#2@\protect\texttt{#2} path operation}%
+ \index{Path operations!#2@\protect\texttt{#2}}%
+ \pgfmanualpdflabel{#2}{}%
+ \fi%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+\newenvironment{datavisualizationoperation}[3][]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{\textcolor{gray}{{\ttfamily\char`\\datavisualization}\
+ \ \dots}
+ \declare{\texttt{#2}}#3\ \textcolor{gray}{\dots\texttt{;}}}%
+ \def\pgfmanualtest{#1}%
+ \ifx\pgfmanualtest\@empty%
+ \index{#2@\protect\texttt{#2} (data visualization)}%
+ \index{Data visualization!#2@\protect\texttt{#2}}%
+ \pgfmanualpdflabel{#2}{}%
+ \fi%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+\makeatother
+
+\def\extractcommand#1#2\@@{%
+ \pgfmanualentryheadline{\declare{\texttt{\string#1}}#2}%
+ \removeats{#1}%
+ \index{\strippedat @\protect\myprintocmmand{\strippedat}}
+ \pgfmanualpdflabel{\textbackslash\strippedat}{}%
+}
+
+\def\doublebs{\texttt{\char`\\\char`\\}}
+
+
+\newenvironment{package}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{{\ttfamily\char`\\usepackage\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX}}
+ \index{#1@\protect\texttt{#1} package}%
+ \index{Packages and files!#1@\protect\texttt{#1}}%
+ \pgfmanualentryheadline{{\ttfamily\char`\\input \declare{#1}.tex\space\space\space \char`\%\space\space plain \TeX}}
+ \pgfmanualentryheadline{{\ttfamily\char`\\usemodule[\declare{#1}]\space\space \char`\%\space\space Con\TeX t}}
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+
+\newenvironment{pgfmodule}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{{\ttfamily\char`\\usepgfmodule\char`\{\declare{#1}\char`\}\space\space\space
+ \char`\%\space\space \LaTeX\space and plain \TeX\space and pure pgf}}
+ \index{#1@\protect\texttt{#1} module}%
+ \index{Modules!#1@\protect\texttt{#1}}%
+ \pgfmanualentryheadline{{\ttfamily\char`\\usepgfmodule[\declare{#1}]\space\space \char`\%\space\space Con\TeX t\space and pure pgf}}
+ \pgfmanualbody
+ \pgfmanualpdflabel{#1}{}%
+}
+{
+ \end{pgfmanualentry}
+}
+
+\newenvironment{pgflibrary}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{{\ttfamily\char`\\usepgflibrary\char`\{\declare{#1}\char`\}\space\space\space
+ \char`\%\space\space \LaTeX\space and plain \TeX\space and pure pgf}}
+ \index{#1@\protect\texttt{#1} library}%
+ \index{Libraries!#1@\protect\texttt{#1}}%
+ \pgfmanualentryheadline{{\ttfamily\char`\\usepgflibrary[\declare{#1}]\space\space \char`\%\space\space Con\TeX t\space and pure pgf}}
+ \pgfmanualentryheadline{{\ttfamily\char`\\usetikzlibrary\char`\{\declare{#1}\char`\}\space\space
+ \char`\%\space\space \LaTeX\space and plain \TeX\space when using \tikzname}}
+ \pgfmanualentryheadline{{\ttfamily\char`\\usetikzlibrary[\declare{#1}]\space
+ \char`\%\space\space Con\TeX t\space when using \tikzname}}
+ \pgfmanualbody
+ \pgfmanualpdflabel{#1}{}%
+}
+{
+ \end{pgfmanualentry}
+}
+
+\newenvironment{tikzlibrary}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{{\ttfamily\char`\\usetikzlibrary\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX\space and plain \TeX}}
+ \index{#1@\protect\texttt{#1} library}%
+ \index{Libraries!#1@\protect\texttt{#1}}%
+ \pgfmanualentryheadline{{\ttfamily\char`\\usetikzlibrary[\declare{#1}]\space \char`\%\space\space Con\TeX t}}
+ \pgfmanualbody
+ \pgfmanualpdflabel{#1}{}%
+}
+{
+ \end{pgfmanualentry}
+}
+
+
+
+\newenvironment{filedescription}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{File {\ttfamily\declare{#1}}}%
+ \index{#1@\protect\texttt{#1} file}%
+ \index{Packages and files!#1@\protect\texttt{#1}}%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+
+\newenvironment{packageoption}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{{\ttfamily\char`\\usepackage[\declare{#1}]\char`\{pgf\char`\}}}
+ \index{#1@\protect\texttt{#1} package option}%
+ \index{Package options for \textsc{pgf}!#1@\protect\texttt{#1}}%
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+
+
+
+\newcommand\opt[1]{{\color{black!50!green}#1}}
+\newcommand\ooarg[1]{{\ttfamily[}\meta{#1}{\ttfamily]}}
+
+\def\opt{\afterassignment\pgfmanualopt\let\next=}
+\def\pgfmanualopt{\ifx\next\bgroup\bgroup\color{black!50!green}\else{\color{black!50!green}\next}\fi}
+
+
+
+\def\beamer{\textsc{beamer}}
+\def\pdf{\textsc{pdf}}
+\def\eps{\texttt{eps}}
+\def\pgfname{\textsc{pgf}}
+\def\tikzname{Ti\emph{k}Z}
+\def\pstricks{\textsc{pstricks}}
+\def\prosper{\textsc{prosper}}
+\def\seminar{\textsc{seminar}}
+\def\texpower{\textsc{texpower}}
+\def\foils{\textsc{foils}}
+
+{
+ \makeatletter
+ \global\let\myempty=\@empty
+ \global\let\mygobble=\@gobble
+ \catcode`\@=12
+ \gdef\getridofats#1@#2\relax{%
+ \def\getridtest{#2}%
+ \ifx\getridtest\myempty%
+ \expandafter\def\expandafter\strippedat\expandafter{\strippedat#1}
+ \else%
+ \expandafter\def\expandafter\strippedat\expandafter{\strippedat#1\protect\printanat}
+ \getridofats#2\relax%
+ \fi%
+ }
+
+ \gdef\removeats#1{%
+ \let\strippedat\myempty%
+ \edef\strippedtext{\stripcommand#1}%
+ \expandafter\getridofats\strippedtext @\relax%
+ }
+
+ \gdef\stripcommand#1{\expandafter\mygobble\string#1}
+}
+
+\def\printanat{\char`\@}
+
+\def\declare{\afterassignment\pgfmanualdeclare\let\next=}
+\def\pgfmanualdeclare{\ifx\next\bgroup\bgroup\color{red!75!black}\else{\color{red!75!black}\next}\fi}
+
+
+\let\textoken=\command
+\let\endtextoken=\endcommand
+
+\def\myprintocmmand#1{\texttt{\char`\\#1}}
+
+\def\example{\par\smallskip\noindent\textit{Example: }}
+\def\themeauthor{\par\smallskip\noindent\textit{Theme author: }}
+
+
+\def\indexoption#1{%
+ \index{#1@\protect\texttt{#1} option}%
+ \index{Graphic options and styles!#1@\protect\texttt{#1}}%
+}
+
+\def\itemcalendaroption#1{\item \declare{\texttt{#1}}%
+ \index{#1@\protect\texttt{#1} date test}%
+ \index{Date tests!#1@\protect\texttt{#1}}%
+}
+
+
+
+\def\class#1{\list{}{\leftmargin=2em\itemindent-\leftmargin\def\makelabel##1{\hss##1}}%
+\extractclass#1@\par\topsep=0pt}
+\def\endclass{\endlist}
+\def\extractclass#1#2@{%
+\item{{{\ttfamily\char`\\documentclass}#2{\ttfamily\char`\{\declare{#1}\char`\}}}}%
+ \index{#1@\protect\texttt{#1} class}%
+ \index{Classes!#1@\protect\texttt{#1}}}
+
+\def\partname{Part}
+
+\makeatletter
+\def\index@prologue{\section*{Index}\addcontentsline{toc}{section}{Index}
+ This index only contains automatically generated entries. A good
+ index should also contain carefully selected keywords. This index is
+ not a good index.
+ \bigskip
+}
+\c@IndexColumns=2
+ \def\theindex{\@restonecoltrue
+ \columnseprule \z@ \columnsep 29\p@
+ \twocolumn[\index@prologue]%
+ \parindent -30pt
+ \columnsep 15pt
+ \parskip 0pt plus 1pt
+ \leftskip 30pt
+ \rightskip 0pt plus 2cm
+ \small
+ \def\@idxitem{\par}%
+ \let\item\@idxitem \ignorespaces}
+ \def\endtheindex{\onecolumn}
+\def\noindexing{\let\index=\@gobble}
+
+
+
+\newcommand\symarrow[1]{
+ \index{#1@\protect\texttt{#1} arrow tip}%
+ \index{Arrow tips!#1@\protect\texttt{#1}}
+ \texttt{#1}& yields thick
+ \begin{tikzpicture}[arrows={#1-#1},thick,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture} and thin
+ \begin{tikzpicture}[arrows={#1-#1},thin,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture}
+}
+\newcommand\symarrowdouble[1]{
+ \index{#1@\protect\texttt{#1} arrow tip}%
+ \index{Arrow tips!#1@\protect\texttt{#1}}
+ \texttt{#1}& yields thick
+ \begin{tikzpicture}[arrows={#1-#1},thick,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture}
+ and thin
+ \begin{tikzpicture}[arrows={#1-#1},thin,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture}, double
+ \begin{tikzpicture}[arrows={#1-#1},thick,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture} and
+ \begin{tikzpicture}[arrows={#1-#1},thin,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture}
+}
+
+\newcommand\sarrow[2]{
+ \index{#1@\protect\texttt{#1} arrow tip}%
+ \index{Arrow tips!#1@\protect\texttt{#1}}
+ \index{#2@\protect\texttt{#2} arrow tip}%
+ \index{Arrow tips!#2@\protect\texttt{#2}}
+ \texttt{#1-#2}& yields thick
+ \begin{tikzpicture}[arrows={#1-#2},thick,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture} and thin
+ \begin{tikzpicture}[arrows={#1-#2},thin,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture}
+}
+
+\newcommand\sarrowdouble[2]{
+ \index{#1@\protect\texttt{#1} arrow tip}%
+ \index{Arrow tips!#1@\protect\texttt{#1}}
+ \index{#2@\protect\texttt{#2} arrow tip}%
+ \index{Arrow tips!#2@\protect\texttt{#2}}
+ \texttt{#1-#2}& yields thick
+ \begin{tikzpicture}[arrows={#1-#2},thick,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture} and thin
+ \begin{tikzpicture}[arrows={#1-#2},thin,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture}, double
+ \begin{tikzpicture}[arrows={#1-#2},thick,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture} and
+ \begin{tikzpicture}[arrows={#1-#2},thin,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1cm,2ex);
+ \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex);
+ \end{tikzpicture}
+}
+
+\newcommand\carrow[1]{
+ \index{#1@\protect\texttt{#1} arrow tip}%
+ \index{Arrow tips!#1@\protect\texttt{#1}}
+ \texttt{#1}& yields for line width 1ex
+ \begin{tikzpicture}[arrows={#1-#1},line width=1ex,baseline]
+ \useasboundingbox (0pt,-0.5ex) rectangle (1.5cm,2ex);
+ \draw (0pt,.5ex) -- (1.5cm,.5ex);
+ \end{tikzpicture}
+}
+\def\myvbar{\char`\|}
+\newcommand\plotmarkentry[1]{%
+ \index{#1@\protect\texttt{#1} plot mark}%
+ \index{Plot marks!#1@\protect\texttt{#1}}
+ \texttt{\char`\\pgfuseplotmark\char`\{\declare{#1}\char`\}} &
+ \tikz\draw[color=black!25] plot[mark=#1,mark options={fill=examplefill,draw=black}] coordinates{(0,0) (.5,0.2) (1,0) (1.5,0.2)};\\
+}
+\newcommand\plotmarkentrytikz[1]{%
+ \index{#1@\protect\texttt{#1} plot mark}%
+ \index{Plot marks!#1@\protect\texttt{#1}}
+ \texttt{mark=\declare{#1}} & \tikz\draw[color=black!25]
+ plot[mark=#1,mark options={fill=examplefill,draw=black}]
+ coordinates {(0,0) (.5,0.2) (1,0) (1.5,0.2)};\\
+}
+
+
+
+\ifx\scantokens\@undefined
+ \PackageError{pgfmanual-macros}{You need to use extended latex
+ (elatex) or (pdfelatex) to process this document}{}
+\fi
+
+\begingroup
+\catcode`|=0
+\catcode`[= 1
+\catcode`]=2
+\catcode`\{=12
+\catcode `\}=12
+\catcode`\\=12 |gdef|find@example#1\end{codeexample}[|endofcodeexample[#1]]
+|endgroup
+
+% define \returntospace.
+%
+% It should define NEWLINE as {}, spaces and tabs as \space.
+\begingroup
+\catcode`\^=7
+\catcode`\^^M=13
+\catcode`\^^I=13
+\catcode`\ =13%
+\gdef\returntospace{\catcode`\ =13\def {\space}\catcode`\^^I=13\def^^I{\space}}
+\gdef\showreturn{\show^^M}
+\endgroup
+
+\begingroup
+\catcode`\%=13
+\catcode`\^^M=13
+\gdef\commenthandler{\catcode`\%=13\def%{\@gobble@till@return}}
+\gdef\@gobble@till@return#1^^M{}
+\gdef\@gobble@till@return@ignore#1^^M{\ignorespaces}
+\gdef\typesetcomment{\catcode`\%=13\def%{\@typeset@till@return}}
+\gdef\@typeset@till@return#1^^M{{\def%{\char`\%}\textsl{\char`\%#1}}\par}
+\endgroup
+
+% Define tab-implementation functions
+% \codeexample@tabinit@replacementchars@
+% and
+% \codeexample@tabinit@catcode@
+%
+% They should ONLY be used in case that tab replacement is active.
+%
+% This here is merely a preparation step.
+%
+% Idea:
+% \codeexample@tabinit@catcode@ will make TAB active
+% and
+% \codeexample@tabinit@replacementchars@ will insert as many spaces as
+% /codeexample/tabsize contains.
+{
+\catcode`\^^I=13
+% ATTENTION: do NOT use tabs in these definitions!!
+\gdef\codeexample@tabinit@replacementchars@{%
+ \begingroup
+ \count0=\pgfkeysvalueof{/codeexample/tabsize}\relax
+ \toks0={}%
+ \loop
+ \ifnum\count0>0
+ \advance\count0 by-1
+ \toks0=\expandafter{\the\toks0\ }%
+ \repeat
+ \xdef\codeexample@tabinit@replacementchars@@{\the\toks0}%
+ \endgroup
+ \let^^I=\codeexample@tabinit@replacementchars@@
+}%
+\gdef\codeexample@tabinit@catcode@{\catcode`\^^I=13}%
+}%
+
+% Called after any options have been set. It assigns
+% \codeexample@tabinit@catcode
+% and
+% \codeexample@tabinit@replacementchars
+% which are used inside of
+%\begin{codeexample}
+% ...
+%\end{codeexample}
+%
+% \codeexample@tabinit@catcode is either \relax or it makes tab
+% active.
+%
+% \codeexample@tabinit@replacementchars is either \relax or it inserts
+% a proper replacement sequence for tabs (as many spaces as
+% configured)
+\def\codeexample@tabinit{%
+ \ifnum\pgfkeysvalueof{/codeexample/tabsize}=0\relax
+ \let\codeexample@tabinit@replacementchars=\relax
+ \let\codeexample@tabinit@catcode=\relax
+ \else
+ \let\codeexample@tabinit@catcode=\codeexample@tabinit@catcode@
+ \let\codeexample@tabinit@replacementchars=\codeexample@tabinit@replacementchars@
+ \fi
+}
+
+\pgfqkeys{/codeexample}{%
+ width/.code= {\setlength\codeexamplewidth{#1}},
+ graphic/.code= {\colorlet{graphicbackground}{#1}},
+ code/.code= {\colorlet{codebackground}{#1}},
+ execute code/.is if=code@execute,
+ code only/.code= {\code@executefalse},
+ pre/.store in=\code@pre,
+ post/.store in=\code@post,
+ % #1 is the *complete* environment contents as it shall be
+ % typeset. In particular, the catcodes are NOT the normal ones.
+ typeset listing/.code= {#1},
+ render instead/.store in=\code@render,
+ vbox/.code= {\def\code@pre{\vbox\bgroup\setlength{\hsize}{\linewidth-6pt}}\def\code@post{\egroup}},
+ ignorespaces/.code= {\let\@gobble@till@return=\@gobble@till@return@ignore},
+ leave comments/.code= {\def\code@catcode@hook{\catcode`\%=12}\let\commenthandler=\relax\let\typesetcomment=\relax},
+ tabsize/.initial=0,% FIXME : this here is merely used for indentation. It is just a TAB REPLACEMENT.
+ every codeexample/.style={width=4cm+7pt},
+}
+
+\let\code@pre\pgfutil@empty
+\let\code@post\pgfutil@empty
+\let\code@render\pgfutil@empty
+\def\code@catcode@hook{}
+
+\newdimen\codeexamplewidth
+\newif\ifcode@execute
+\newbox\codeexamplebox
+\def\codeexample[#1]{%
+ \begingroup%
+ \code@executetrue
+ \pgfqkeys{/codeexample}{every codeexample,#1}%
+ \codeexample@tabinit% assigns \codeexample@tabinit@[catcode,replacementchars]
+ \parindent0pt
+ \begingroup%
+ \par%
+ \medskip%
+ \let\do\@makeother%
+ \dospecials%
+ \obeylines%
+ \@vobeyspaces%
+ \catcode`\%=13%
+ \catcode`\^^M=13%
+ \code@catcode@hook%
+ \codeexample@tabinit@catcode
+ \relax%
+ \find@example}
+\def\endofcodeexample#1{%
+ \endgroup%
+ \ifcode@execute%
+ \setbox\codeexamplebox=\hbox{%
+ \ifx\code@render\pgfutil@empty%
+ {%
+ {%
+ \returntospace%
+ \commenthandler%
+ \xdef\code@temp{#1}% removes returns and comments
+ }%
+ \catcode`\^^M=9%
+ \colorbox{graphicbackground}{\color{black}\ignorespaces%
+ \code@pre\expandafter\scantokens\expandafter{\code@temp\ignorespaces}\code@post\ignorespaces}%
+ }%
+ \else%
+ \colorbox{graphicbackground}{\color{black}\ignorespaces%
+ \code@render}%
+ \fi%
+ }%
+ \ifdim\wd\codeexamplebox>\codeexamplewidth%
+ \def\code@start{\par}%
+ \def\code@flushstart{}\def\code@flushend{}%
+ \def\code@mid{\parskip2pt\par\noindent}%
+ \def\code@width{\linewidth-6pt}%
+ \def\code@end{}%
+ \else%
+ \def\code@start{%
+ \linewidth=\textwidth%
+ \parshape \@ne 0pt \linewidth
+ \leavevmode%
+ \hbox\bgroup}%
+ \def\code@flushstart{\hfill}%
+ \def\code@flushend{\hbox{}}%
+ \def\code@mid{\hskip6pt}%
+ \def\code@width{\linewidth-12pt-\codeexamplewidth}%
+ \def\code@end{\egroup}%
+ \fi%
+ \code@start%
+ \noindent%
+ \begin{minipage}[t]{\codeexamplewidth}\raggedright
+ \hrule width0pt%
+ \footnotesize\vskip-1em%
+ \code@flushstart\box\codeexamplebox\code@flushend%
+ \vskip-1ex
+ \leavevmode%
+ \end{minipage}%
+ \else%
+ \def\code@mid{\par}
+ \def\code@width{\linewidth-6pt}
+ \def\code@end{}
+ \fi%
+ \code@mid%
+ \colorbox{codebackground}{%
+ \begin{minipage}[t]{\code@width}%
+ {%
+ \let\do\@makeother
+ \dospecials
+ \frenchspacing\@vobeyspaces
+ \normalfont\ttfamily\footnotesize
+ \typesetcomment%
+ \codeexample@tabinit@replacementchars
+ \@tempswafalse
+ \def\par{%
+ \if@tempswa
+ \leavevmode \null \@@par\penalty\interlinepenalty
+ \else
+ \@tempswatrue
+ \ifhmode\@@par\penalty\interlinepenalty\fi
+ \fi}%
+ \obeylines
+ \everypar \expandafter{\the\everypar \unpenalty}%
+ \pgfkeysvalueof{/codeexample/typeset listing/.@cmd}{#1}\pgfeov
+ }
+ \end{minipage}}%
+ \code@end%
+ \par%
+ \medskip
+ \end{codeexample}
+}
+
+\def\endcodeexample{\endgroup}
+
+
+\makeatother
+
+\usepackage{pgfmanual}
+
+\makeatletter
+% \pgfautoxrefs will be defined by 'make dist'
+\pgfutil@ifundefined{pgfautoxrefs}{%
+ \def\pgfmanualpdflabel#1#2{#2}% NO-OP
+ \def\pgfmanualpdfref#1#2{#2}%
+ \pgfkeys{
+ /pdflinks/codeexample links=false,% DISABLED.
+ }%
+}{}
+\makeatother
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: "beameruserguide"
+%%% End:
diff --git a/Master/texmf-dist/doc/latex/sa-tikz/sa-tikz-doc.pdf b/Master/texmf-dist/doc/latex/sa-tikz/sa-tikz-doc.pdf
new file mode 100644
index 00000000000..9a8b3359610
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/sa-tikz/sa-tikz-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/sa-tikz/sa-tikz-doc.tex b/Master/texmf-dist/doc/latex/sa-tikz/sa-tikz-doc.tex
new file mode 100644
index 00000000000..51901421f07
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/sa-tikz/sa-tikz-doc.tex
@@ -0,0 +1,951 @@
+\pdfminorversion=5
+\pdfobjcompresslevel=2
+\documentclass{ltxdoc}
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{amsmath}
+\usepackage{lmodern}
+\usepackage[ruled, lined,linesnumbered]{algorithm2e}
+
+%% Use the tikz package and loading the library
+\usepackage{tikz}
+\usetikzlibrary{switching-architectures}
+
+%% Loading only the package
+%\usepackage{sa-tikz}
+
+\usepackage{calc}
+\usepackage{imakeidx}
+
+\usepackage[naturalnames]{hyperref}
+ \hypersetup{%
+ colorlinks=true,
+ linkcolor=blue,
+ filecolor=blue,
+ urlcolor=blue,
+ citecolor=blue,
+ pdfborder=0 0 0,
+ }
+
+% dedicated commands:
+\newcommand\Tikz{Ti\textit kZ}
+\newcommand{\saTikZ}{S\textit{a}-\Tikz}
+
+\def\pgfautoxrefs{1}
+\input ./macros/pgfmanual-en-macros.tex
+
+\makeatletter
+\def\index@prologue{%
+\section*{Index}\addcontentsline{toc}{section}{Index}
+}
+\makeatother
+
+\usepackage{pgfmanual}
+
+\pgfkeys{
+ /pdflinks/search key prefixes in={/tikz/,/pgf/},
+ /pdflinks/internal link prefix=pgfp,
+ /pdflinks/codeexample links=true,
+ /pdflinks/warnings=false,
+ /pdflinks/show labels=false,
+}
+\makeindex
+\newcommand{\version}{0.5}
+\newcommand{\versiondate}{January 3, 2013}
+
+\title{\saTikZ\footnote{This package has version number \textit{v}\version\ of \versiondate; it is released under and subject to the \href{http://www.latex-project.org/lppl/}{\LaTeX\ Project Public License (LPPL)}.}}
+\author{Claudio Fiandrino \\ \small\href{mailto:claudio.fiandrino@gmail.com}{\texttt{claudio.fiandrino@gmail.com}}}
+\date{\versiondate}
+
+\begin{document}
+\maketitle
+\tableofcontents
+
+\section*{Introduction}
+\addcontentsline{toc}{section}{Introduction}
+The \saTikZ\ library helps in drawing \emph{switching-architectures}. In particular, one of its aims, is to help students to verify the correctness of their exercises, but it could also help teachers in preparing lecture notes. The repository of the library is \href{https://github.com/cfiandra/Sa-TikZ}{https://github.com/cfiandra/Sa-TikZ}.
+
+The \saTikZ\ library can be loaded in the preamble by means of:
+\begin{flushleft}
+\verb|\usetikzlibrary{|\bgroup\color{red!75!black}\verb|switching-architectures|\egroup\verb|}|
+\end{flushleft}
+and in this case you should also load manually:
+\begin{flushleft}
+\verb|\usepackage{|\bgroup\color{red!75!black}\verb|tikz|\egroup\verb|}|
+\end{flushleft}
+or by means of:
+\begin{flushleft}
+\verb|\usepackage{|\bgroup\color{red!75!black}\verb|sa-tikz|\egroup\verb|}|
+\end{flushleft}
+In both cases the libraries \bgroup\color{red!75!black}\verb|calc|\egroup{}, \bgroup\color{red!75!black}\verb|positioning|\egroup\ and \bgroup\color{red!75!black}\verb|decorations.pathreplacing|\egroup\ are loaded automatically and in the latter case also the \Tikz\ package is loaded.
+
+The version \textit{v}\version\ provides a way to draw Clos Networks Strictly-non-Blocking (snb) and Rearrangeable (rear) and Benes Networks; moreover, there is the possibility to fully customize the aspect of the network drawn starting from the dimensions of module, their distance and the font used. Finally, \saTikZ\ let the user to draw connections among the stages by accessing the single ports of the modules.
+
+\section{Basic usage}
+The simplest use of the package is to define a
+\begin{command}{{\node}}
+ Basic command definition.
+\end{command}
+with one of the following options
+\begin{key}{/tikz/clos snb}
+ Option for drawing a Clos Network Strictly-non-Blocking.
+\end{key}
+\begin{key}{/tikz/clos rear}
+ Option for drawing a Clos Network Rearrangeable.
+\end{key}
+\begin{key}{/tikz/benes}
+ Option for drawing a Benes Network.
+\end{key}
+\begin{key}{/tikz/benes complete}
+ Option for drawing a Benes Network with the lowest level of recursion.
+\end{key}
+inside a |tikzpicture| environment:
+\begin{environment}{{tikzpicture}\opt{\oarg{options}}}
+\end{environment}
+
+\subsection{Examples of Clos Networks}
+
+The following example shows a Rearrangeable Clos Network.
+
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[clos rear] {};
+\end{tikzpicture}
+\end{codeexample}
+
+The following example shows a Strictly-non-Blocking Clos Network.
+
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[clos snb] {};
+\end{tikzpicture}
+\end{codeexample}
+
+Notice from the examples that automatically the library is able to compute the constraints that define a Clos Network to be Strictly-non-Blocking or Rearrangeable. Moreover, the network drawn is characterized by:
+\begin{itemize}
+\item the first stage with:
+\begin{itemize}
+\item a number of modules equal to 5;
+\item each one with two input ports;
+\end{itemize}
+\item the last stage with:
+\begin{itemize}
+\item a number of modules equal to 5;
+\item each one with two output ports.
+\end{itemize}
+\end{itemize}
+Each module of the network is numbered according to the stage it belongs to.
+
+\subsection{Examples of Benes Networks}
+
+The simplest example of a Benes Network:
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[benes] {};
+\end{tikzpicture}
+\end{codeexample}
+is a Benes Network in which there are 8 input and output ports. To draw a Benes Network in which all modules are visible, the key |benes complete| should be used rather than the |benes| key. An example:
+
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[benes complete] {};
+\end{tikzpicture}
+\end{codeexample}
+
+The algorithm in which the internal connections of the |benes complete| networks are drawn is explained in detail in the appendix \ref{sec:benesconnalg}.
+
+\section{The options}
+\subsection{Designing choices}
+This subsection illustrates which are the parameters that could be customized to draw Clos and Benes Networks. In particular:
+\begin{itemize}
+\item Clos Networks are analysed in \ref{subsubsec:clos};
+\item Benes Networks are analysed in \ref{subsubsec:benes}.
+\end{itemize}
+In each part the keys will be presented and simple examples will be provided.
+
+\subsubsection{Clos Networks}
+\label{subsubsec:clos}
+The two first important design parameters are the total number of input ports of the first stage and the total number of output ports of the last stage. These two parameters could be modified by means of:
+
+\begin{key}{/tikz/N=\marg{value} (initially 10)}
+ This is the number of total input ports in the first stage.
+\end{key}
+
+\begin{key}{/tikz/M=\marg{value} (initially 10)}
+ This is the number of total output ports in the last stage.
+\end{key}
+
+Usually, a second design parameter is the number of modules present in the first and last stage. \saTikZ\ defines:
+
+\begin{key}{/tikz/r1=\marg{value} (initially 5)}
+ This is the number of modules in the first stage.
+\end{key}
+
+\begin{key}{/tikz/r3=\marg{value} (initially 5)}
+ This is the number of modules in the last stage.
+\end{key}
+
+The two design parameters provide the number of ports of each module:
+\[m_1=\dfrac{N}{r_1} \hspace*{2cm} m_3=\dfrac{M}{r_3} \]
+
+Some examples considering |N|=9, |r1|=3, |M|=9 and |r3|=3.
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[N=9,r1=3,M=9,r3=3,clos rear] {};
+\end{tikzpicture}
+\end{codeexample}
+
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[N=9,r1=3,M=9,r3=3,clos snb] {};
+\end{tikzpicture}
+\end{codeexample}
+
+Notice a very important thing: the type of the architecture should be loaded \emph{after} all the design choices in case they have been set in the \cs{node}; indeed, if you do not respect this constraint you will end up with an architecture with default values. For example:
+
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[clos rear,N=9,r1=3,M=9,r3=3] {};
+\end{tikzpicture}
+\end{codeexample}
+
+\subsubsection{Benes Networks}
+\label{subsubsec:benes}
+Benes Networks are Clos Rearrangeable Networks composed of $2 \times 2$ modules, so as design choice it just possible to select which is the number of input/output ports:
+
+\begin{key}{/tikz/P=\marg{value} (initially 8)}
+ This is the number of total input/output ports in the first/third stage.
+\end{key}
+
+Notice that |P| could assume values
+\[P=2^p \qquad p=2,3,4,\ldots\]
+and the user is responsible to correctly set this parameter.
+
+For low values of $p$ there are no problems in visualizing the network, but as $p$ increases the user should take care of the modules' dimension and the modules' separation (vertical and horizontal): they could be customized as explained in the subsection \ref{subsec:customization}. Actually, for |benes complete| networks, the number of $p$ is crucial: when it is above 7, thus for networks bigger than $128\times 128$, PGF can not properly work due to internal limitations.
+
+Notice that actually, for |P|=4 the |benes| network and the |benes complete| network are indistinguishable:
+\begin{codeexample}[]
+\begin{tikzpicture}
+\tikzset{module size=0.5cm,
+ pin length factor=0.5,
+ module ysep=1}
+ \node[P=4,benes] {};
+ \begin{scope}[xshift=6cm]
+ \node[module xsep=2.5,P=4,benes complete]{};
+ \end{scope}
+\end{tikzpicture}
+\end{codeexample}
+
+
+Here is an example of Benes Network with |P|=16:
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[P=16,benes] {};
+\end{tikzpicture}
+\end{codeexample}
+
+It holds the same concept already said for Clos Networks: set the parameter |P| before declaring the \cs{node} be a |Benes| Network.
+
+
+\subsection{Output customization}
+\label{subsec:customization}
+This subsection focuses on how to customize the aspect of the networks.
+
+\begin{key}{/tikz/module size=\marg{value} (initially 1cm)}
+ This option allows to set the module dimension.
+\end{key}
+
+\begin{key}{/tikz/module ysep=\marg{value} (initially 1.5)}
+ This option allows to set the vertical module distance factor.
+\end{key}
+
+\begin{key}{/tikz/module xsep=\marg{value} (initially 3)}
+ This option allows to set the horizontal module distance factor.
+\end{key}
+
+\begin{key}{/tikz/module label opacity=\marg{value} (initially 1)}
+ This option allows to mask the module label when the \meta{value} is set to 0.
+\end{key}
+
+\begin{key}{/tikz/pin length factor=\marg{value} (initially 1)}
+ This option allows to reduce/increase the length of the pins drawn in input/output. Use a \meta{value} [0,1] to reduce the length or, viceversa, a \meta{value} greater than 1 to increase the length.
+\end{key}
+
+\begin{key}{/tikz/module font=\marg{font commands} (default \cs{normalfont})}
+ This option sets the font used for module labels. The \meta{font commands} that could be used are those ones related to the font size (i.e. \cs{Large}) and font shape (i.e \cs{itshape}).
+\end{key}
+
+\begin{key}{/tikz/connections disabled=\mchoice{true,false} (default false)}
+ This option, not active by default |connections disabled/.default=false|, allows to remove the connections between the stages when it is set to \opt{true}. Beware: this option is valid only for |clos snb|, |clos rear|, |benes| and |benes complete| networks, but it does not holds for the architectures explained in section \ref{sec:dida}.
+\end{key}
+
+The following example shows a Rearrangeable Clos Network with some options customized. Notice that the |module label opacity| should be given as parameter of the desired network.
+
+\begin{codeexample}[]
+\begin{tikzpicture}[N=9,r1=3,M=9,r3=3]
+ \node[module size=0.5cm,pin length factor=0.5,
+ module ysep=1, module xsep=1.25,
+ clos rear={module label opacity=0}] {};
+\end{tikzpicture}
+\end{codeexample}
+
+The options could also be introduced with the standard \Tikz\ syntax:
+\begin{command}{{\tikzset}\marg{options}}
+ Command that process the various \meta{options}: they should be provided separated by commas.
+\end{command}
+
+Therefore, the previous example could be modified into:
+\begin{codeexample}[]
+\tikzset{module size=0.5cm,pin length factor=0.5,
+ module ysep=1, module xsep=1.25,}
+\begin{tikzpicture}[N=9,r1=3,M=9,r3=3]
+ \node[clos rear={module label opacity=0}] {};
+\end{tikzpicture}
+\end{codeexample}
+
+It is also possible to declare \opt{styles} to set some options for later use: this helps to keep the code clean especially when the same options are re-used several times; an example:
+\begin{codeexample}[code only]
+\tikzset{module size definition/.style={
+ module size=0.75cm,
+ pin length factor=0.75,
+ module xsep=2,
+ module ysep=2,
+ }
+}
+\tikzset{module size definition,
+ P=16,
+}
+\begin{tikzpicture}
+ \node[benes] {};
+\end{tikzpicture}
+\end{codeexample}
+
+Here is a Benes Network $4 \times 4$ with an extremely large font size for the module labels with the connections disabled:
+\begin{codeexample}[]
+\tikzset{my style/.style={
+ module size=0.75cm,
+ pin length factor=0.75,
+ module xsep=2,
+ }
+}
+\tikzset{my style, P=4,
+ module font=\huge\slshape,
+ connections disabled=true
+}
+\begin{tikzpicture}
+ \node[benes complete] {};
+\end{tikzpicture}
+\end{codeexample}
+\pagebreak
+
+An example of Benes Network $32 \times 32$:
+\begin{codeexample}[]
+\tikzset{module size=0.6cm,pin length factor=0.6,
+ module ysep=0.9, module xsep=1.7,}
+\begin{tikzpicture}[P=32]
+ \node[benes] {};
+\end{tikzpicture}
+\end{codeexample}
+\pagebreak
+
+and its complete form:
+\begin{codeexample}[]
+\tikzset{module size=0.6cm,pin length factor=0.6,
+ module ysep=1, module xsep=2.275}
+\begin{tikzpicture}[P=32]
+ \node[benes complete={module label opacity=0}] {};
+\end{tikzpicture}
+\end{codeexample}
+
+
+\section{Advanced usage}
+In this section some more advanced examples are shown.
+
+\subsection{Identifying front input/output ports}
+In this subsection it is shown how to reference the front input and output ports for the first and last stage. Each front input port could be accessed by means of:
+\begin{flushleft}
+\verb|r1-|\bgroup\color{red!75!black}\verb|module number|\egroup\verb|-|\bgroup\color{red!75!black}\verb|front input|\egroup\verb|-|\bgroup\color{red!75!black}\verb|port number|\egroup; example: \verb|r1-1-front input-1|;
+\end{flushleft}
+Each front output port could be accessed by means of:
+\begin{flushleft}
+\verb|r3-|\bgroup\color{red!75!black}\verb|module number|\egroup\verb|-|\bgroup\color{red!75!black}\verb|front output|\egroup\verb|-|\bgroup\color{red!75!black}\verb|port number|\egroup; example: \verb|r3-1-front output-1|;
+\end{flushleft}
+Noticed that the first stage is always 1, but the last stage may be different from 3 in case the |benes complete| network is drawn. Errors will occur in case the last stage number is not correct and the user is responsible for the correct setting.
+
+A simple example with a Rearrangeable Clos network of 4 input and output ports; the first stage and the last one have both 2 modules.
+
+\begin{codeexample}[]
+\begin{tikzpicture}[module xsep=2]
+ \node[N=4,r1=2,M=4,r3=2,clos rear={module label opacity=0}] {};
+ \foreach \name
+ in {r1-1-front input-1,r1-1-front input-2,
+ r1-2-front input-1,r1-2-front input-2}
+ \node[left] at (\name) {\scriptsize{\texttt{\name}}};
+ \foreach \name
+ in {r3-1-front output-1,r3-1-front output-2,
+ r3-2-front output-1,r3-2-front output-2}
+ \node[right] at (\name) {\scriptsize{\texttt{\name}}};
+\end{tikzpicture}
+\end{codeexample}
+
+The following is a Strictly-non-Blocking Clos network of 9 input and output ports in which the first and last stage have 3 modules each one.
+
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[N=9,r1=3,M=9,r3=3,clos snb={module label opacity=0}] {};
+
+ \foreach \startmodule in {1,...,3}{
+ \foreach \port in {1,...,3}
+ \node[left] at (r1-\startmodule-front input-\port)
+ {\scriptsize{input \startmodule-\port}};
+ }
+ \foreach \startmodule in {1,...,3}{
+ \foreach \port in {1,...,3}
+ \node[right] at (r3-\startmodule-front output-\port)
+ {\scriptsize{output \startmodule-\port}};
+ }
+\end{tikzpicture}
+\end{codeexample}
+
+The same applies also for Benes Networks:
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[benes={module label opacity=0}] {};
+
+ \foreach \startmodule in {1,...,4}{
+ \foreach \port in {1,...,2}
+ \node[left] at (r1-\startmodule-front input-\port)
+ {\scriptsize{input \startmodule-\port}};
+ }
+ \foreach \startmodule in {1,...,4}{
+ \foreach \port in {1,...,2}
+ \node[right] at (r3-\startmodule-front output-\port)
+ {\scriptsize{output \startmodule-\port}};
+ }
+\end{tikzpicture}
+\end{codeexample}
+and for the complete form:
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[benes complete={module label opacity=0}] {};
+ \newcounter{port}
+ \setcounter{port}{0}
+ \foreach \startmodule in {1,...,4}{
+ \foreach \port in {1,...,2}
+ \stepcounter{port}
+ \node[left] at (r1-\startmodule-front input-\port)
+ {\scriptsize{input \theport}};
+ }
+ \setcounter{port}{0}
+ \foreach \startmodule in {1,...,4}{
+ \foreach \port in {1,...,2}
+ \stepcounter{port}
+ \node[right] at (r5-\startmodule-front output-\port)
+ {\scriptsize{output \theport}};
+ }
+\end{tikzpicture}
+\end{codeexample}
+Notice that in this case to access the \verb|front output| ports, the stage number correct is 5 and not 3 as usual.
+
+\subsection{Identifying input/output ports per module}
+
+It is also possible to access, for each module of each stage, its input and output ports. The syntax is similar to the one used for the front input and output ports; each input port could be accessed by means of:
+\begin{flushleft}
+\verb|r|\bgroup\color{red!75!black}\verb|stage number|\egroup\verb|-|\bgroup\color{red!75!black}\verb|module number|\egroup\verb|-|\bgroup\color{red!75!black}\verb|input|\egroup\verb|-|\bgroup\color{red!75!black}\verb|port number|\egroup; example: \verb|r1-1-input-1|;
+\end{flushleft}
+Each output port could be accessed by means of:
+\begin{flushleft}
+\verb|r|\bgroup\color{red!75!black}\verb|stage number|\egroup\verb|-|\bgroup\color{red!75!black}\verb|module number|\egroup\verb|-|\bgroup\color{red!75!black}\verb|front output|\egroup\verb|-|\bgroup\color{red!75!black}\verb|port number|\egroup; example: \verb|r2-1-output-1|;
+\end{flushleft}
+This allows to derive connections from the first stage to the last stage. Here is an example.
+
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[N=8,r1=4,M=8,r3=4,clos rear={module label opacity=0}] {};
+ \draw[red,ultra thick](r1-2-input-1)--(r1-2-output-2)
+ (r2-2-input-2)--(r2-2-output-3)
+ (r3-3-input-2)--(r3-3-output-2);
+ \draw[red,ultra thick](r1-4-input-1)--(r1-4-output-1)
+ (r2-1-input-4)--(r2-1-output-1)
+ (r3-1-input-1)--(r3-1-output-2);
+\end{tikzpicture}
+\end{codeexample}
+Similarly, an example in a Benes Network:
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[benes={module label opacity=0}] {};
+ \draw[red,ultra thick](r1-2-input-1)--(r1-2-output-2)
+ (r2-2-input-2)--(r2-2-output-3)
+ (r3-3-input-2)--(r3-3-output-2);
+ \draw[red,ultra thick](r1-4-input-1)--(r1-4-output-1)
+ (r2-1-input-4)--(r2-1-output-1)
+ (r3-1-input-1)--(r3-1-output-2);
+\end{tikzpicture}
+\end{codeexample}
+and in its complete form:
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[benes complete={module label opacity=0}] {};
+ \draw[red,ultra thick](r1-2-input-1)--(r1-2-output-2)--
+ (r2-3-input-2)--(r2-3-output-2)--
+ (r3-3-input-1)--(r3-3-output-2)--
+ (r4-4-input-1)--(r4-4-output-1)--
+ (r5-3-input-2)--(r5-3-output-2);
+ \draw[blue,ultra thick](r1-4-input-1)--(r1-4-output-1)--
+ (r2-2-input-2)--(r2-2-output-1)--
+ (r3-1-input-2)--(r3-1-output-1)--
+ (r4-1-input-1)--(r4-1-output-1)--
+ (r5-1-input-1)--(r5-1-output-2);
+\end{tikzpicture}
+\end{codeexample}
+
+\section{Didactic purposes}
+\label{sec:dida}
+To quickly draw a Clos Network it is possible to exploit:
+\begin{key}{/tikz/clos snb example}
+ Option for quickly drawing a Clos Network Strictly-non-Blocking.
+\end{key}
+\begin{key}{/tikz/clos rear example}
+ Option for quickly drawing a Clos Network Rearrangeable.
+\end{key}
+In this way the network is not seen in its whole complexity, but it is synthetically depicted. An example of a Strictly-non-Blocking Clos Network drawn with this approach:
+\begin{codeexample}[]
+\begin{tikzpicture}[N=12,r1=4,M=8,r3=4]
+ \node[clos snb example] {};
+\end{tikzpicture}
+\end{codeexample}
+
+Similarly, an example of a Rearrangeable Clos Network:
+\begin{codeexample}[]
+\begin{tikzpicture}[N=12,r1=4,M=8,r3=4]
+ \node[clos rear example] {};
+\end{tikzpicture}
+\end{codeexample}
+
+The networks drawn, automatically display the values at which the input parameters |N|, |M|, |r1| and |r3| have been set. However, to let the user to have the possibility of deploying labels rather than the input parameter values, the following option is available:
+
+\begin{key}{/tikz/clos example with labels}
+ Option for quickly drawing a Clos Network with custom labels.
+\end{key}
+
+The labels could be customized by means of:
+\begin{key}{/tikz/N label=\marg{value} (default N)}
+ This options sets the label representing the total number of ports in the first stage.
+\end{key}
+
+\begin{key}{/tikz/r1 label=\marg{value} (default r$_1$)}
+ This options sets the label representing the number of modules in the first stage.
+\end{key}
+
+\begin{key}{/tikz/m1 label=\marg{value} (default m$_1$)}
+ This options sets the label representing the number of ports per module in the first stage.
+\end{key}
+
+\begin{key}{/tikz/r2 label=\marg{value} (default r$_2$)}
+ This options sets the label representing the number of modules in the second stage.
+\end{key}
+
+\begin{key}{/tikz/M label=\marg{value} (default M)}
+ This options sets the label representing the total number of ports in the last stage.
+\end{key}
+
+\begin{key}{/tikz/r3 label=\marg{value} (default r$_3$)}
+ This options sets the label representing the number of modules in the last stage.
+\end{key}
+
+\begin{key}{/tikz/m3 label=\marg{value} (default m$_3$)}
+ This options sets the label representing the number of ports per module in the last stage.
+\end{key}
+
+An example with the default values for the labels:
+
+\begin{codeexample}[]
+%\tikzset{N=8,r1=4,M=8,r3=4} % setting the parameters here is useless
+\begin{tikzpicture}
+ \node[clos example with labels] {};
+\end{tikzpicture}
+\end{codeexample}
+
+To have automatically all labels in math mode, use:
+\begin{key}{/tikz/set math mode labels=\mchoice{true,false} (default false)}
+ This option is normally disabled |set math mode labels/.default=false|; to ensure labels be set completely in math mode is sufficient set |set math mode labels=true| before the type of the network.
+\end{key}
+
+An example:
+\begin{codeexample}[]
+\begin{tikzpicture}[set math mode labels=true]
+ \node[clos example with labels] {};
+\end{tikzpicture}
+\end{codeexample}
+
+This example, instead, represents a |clos example with labels| network with custom labels introduced by means of the |\tikzset| syntax.
+
+\begin{codeexample}[]
+\tikzset{N label={p$_1$ $\times$ q$_1$},M label={p$_3$ $\times$ q$_3$},
+r1 label=p$_1$, m1 label=q$_1$, r2 label=p$_2$,r3 label=p$_3$, m3 label=q$_3$}
+\begin{tikzpicture}
+ \node[clos example with labels] {};
+\end{tikzpicture}
+\end{codeexample}
+
+Notice that it does not exist an equivalent of |clos example with labels| or |clos rear example| for Benes Networks: this because Benes Networks are a particular type of Rearrangeable Clos Networks where |P|=|N|=|M| and $m1$=$m3$=$z$=2, thus |r1|=|r3|=$q=P/z$.
+
+For example:
+
+\begin{codeexample}[]
+\begin{tikzpicture}[N=8,r1=4,M=8,r3=4]
+ \node[clos rear example] {};
+\end{tikzpicture}
+\end{codeexample}
+
+\begin{codeexample}[]
+\tikzset{N label={P},M label={P},
+r1 label=q, m1 label=z, r2 label=z,r3 label=q, m3 label=z}
+\begin{tikzpicture}
+ \node[set math mode labels=true,clos example with labels] {};
+\end{tikzpicture}
+\end{codeexample}
+
+\clearpage
+\appendix
+
+\section{Benes complete internal connections algorithm}
+\label{sec:benesconnalg}
+To explain how the connections of the |benes complete| networks are drawn, the following reference example will be considered:
+\begin{center}
+\scalebox{0.75}{
+ \begin{tikzpicture}[module size=0.75cm, module ysep=1, module xsep=2.5]
+ \node[P=16, benes complete]{};
+ \end{tikzpicture}
+}
+\end{center}
+The network is $16\times 16$ (|P|=16), thus the number of stages $\mathcal{S}$ is:
+\[\mathcal{S}=2\log_2{P}-1 \implies \mathcal{S}_{16}=7\]
+Indeed:
+\begin{center}
+\scalebox{0.75}{
+ \begin{tikzpicture}[module size=0.75cm, module ysep=1, module xsep=2.5]
+ \node[P=16, benes complete]{};
+ \foreach \x in {1,...,7}
+ \node[above of=r\x-1, red] {\x};
+ \draw[red,thick,decorate,decoration={brace}]([yshift=0.1cm]r1-1.north west)--([yshift=0.1cm]r7-1.north east);
+ \end{tikzpicture}
+}
+\end{center}
+This parameter, therefore, allows to correctly draw all the modules of the network and, as it will be pointed out later better, its knowledge is important also to define the stages range of applicability of the algorithm. Notice the network symmetry: the connections from stage 1 to stage 4 are exactly the same from stage 7 to stage 4.
+\pagebreak
+
+The first step is \emph{labelling} modules and ports. \saTikZ\ uses this philosophy:
+\begin{itemize}
+\item progressive numeration for modules of the same stage;
+\item progressive numeration for ports of the same module.
+\end{itemize}
+
+Thus:
+\begin{center}
+\scalebox{0.75}{
+ \begin{tikzpicture}[module size=0.75cm, module ysep=1, module xsep=3.5, connections disabled=true]
+ \node[P=16, benes complete]{};
+ \foreach \stg in {2,...,6}{
+ \foreach \module in {1,...,8}{
+ \node[right,font=\scriptsize] at (r\stg-\module-output-1) {1};
+ \node[right,font=\scriptsize] at (r\stg-\module-output-2) {2};
+ \node[left,font=\scriptsize] at (r\stg-\module-input-1) {1};
+ \node[left,font=\scriptsize] at (r\stg-\module-input-2) {2};
+ }
+ }
+ \foreach \module in {1,...,8}{
+ \node[right,font=\scriptsize] at (r1-\module-output-1) {1};
+ \node[right,font=\scriptsize] at (r1-\module-output-2) {2};
+ }
+ \foreach \module in {1,...,8}{
+ \node[left,font=\scriptsize] at (r7-\module-input-1) {1};
+ \node[left,font=\scriptsize] at (r7-\module-input-2) {2};
+ }
+ \end{tikzpicture}
+}
+\end{center}
+
+Due to the network symmetry, at the beginning the attention will be focused only on the left side of the network, because for the right part things are dual:
+
+\begin{center}
+\scalebox{0.75}{
+ \begin{tikzpicture}[module size=0.75cm, module ysep=1, module xsep=3.5, connections disabled=true]
+ \node[P=16, benes complete]{};
+ \foreach \stg in {2,...,6}{
+ \foreach \module in {1,...,8}{
+ \node[right,font=\scriptsize] at (r\stg-\module-output-1) {1};
+ \node[right,font=\scriptsize] at (r\stg-\module-output-2) {2};
+ \node[left,font=\scriptsize] at (r\stg-\module-input-1) {1};
+ \node[left,font=\scriptsize] at (r\stg-\module-input-2) {2};
+ }
+ }
+ \foreach \module in {1,...,8}{
+ \node[right,font=\scriptsize] at (r1-\module-output-1) {1};
+ \node[right,font=\scriptsize] at (r1-\module-output-2) {2};
+ }
+ \foreach \module in {1,...,8}{
+ \node[left,font=\scriptsize] at (r7-\module-input-1) {1};
+ \node[left,font=\scriptsize] at (r7-\module-input-2) {2};
+ }
+ \begin{pgfonlayer}{background}
+ \draw[dashed, ultra thick, red, fill=red!10]
+ ($(r1-1-front input-1)+(-0.2,0.5)$)--($(r4-1-output-1)+(0.5,0.5)$)--($(r4-8-output-2)-(-0.5,0.5)$)--($(r1-8-front input-2)-(0.2,0.5)$)--cycle;
+ \end{pgfonlayer}
+ \end{tikzpicture}
+}
+\end{center}
+\pagebreak
+
+Now, by drawing some connections, it is possible to find a common behaviour:
+
+\begin{center}
+\scalebox{0.75}{
+ \begin{tikzpicture}[module size=0.75cm, module ysep=1, module xsep=3.5, connections disabled=true]
+ \node[P=16, benes complete]{};
+ \foreach \stg in {2,...,6}{
+ \foreach \module in {1,...,8}{
+ \node[right,font=\scriptsize] at (r\stg-\module-output-1) {1};
+ \node[right,font=\scriptsize] at (r\stg-\module-output-2) {2};
+ \node[left,font=\scriptsize] at (r\stg-\module-input-1) {1};
+ \node[left,font=\scriptsize] at (r\stg-\module-input-2) {2};
+ }
+ }
+ \foreach \module in {1,...,8}{
+ \node[right,font=\scriptsize] at (r1-\module-output-1) {1};
+ \node[right,font=\scriptsize] at (r1-\module-output-2) {2};
+ }
+ \foreach \module in {1,...,8}{
+ \node[left,font=\scriptsize] at (r7-\module-input-1) {1};
+ \node[left,font=\scriptsize] at (r7-\module-input-2) {2};
+ }
+ % some connections
+ \begin{pgfonlayer}{background}
+ % first-second stage
+ \draw[thick,red](r1-1-output-1)--(r2-1-input-1);
+ \draw[thick,red](r1-1-output-2)--(r2-5-input-1);
+ \draw[thick,red](r1-2-output-1)--(r2-1-input-2);
+ \draw[thick,red](r1-2-output-2)--(r2-5-input-2);
+ % second-third stage
+ \draw[thick,red](r2-1-output-1)--(r3-1-input-1);
+ \draw[thick,red](r2-1-output-2)--(r3-3-input-1);
+ \draw[thick,red](r2-2-output-1)--(r3-1-input-2);
+ \draw[thick,red](r2-2-output-2)--(r3-3-input-2);
+ \draw[thick,red](r2-3-output-1)--(r3-2-input-1);
+ \draw[thick,red](r2-3-output-2)--(r3-4-input-1);
+ \draw[thick,red](r2-4-output-1)--(r3-2-input-2);
+ \draw[thick,red](r2-4-output-2)--(r3-4-input-2);
+ % third-fourth stage
+ \draw[thick,red](r3-1-output-1)--(r4-1-input-1);
+ \draw[thick,red](r3-1-output-2)--(r4-2-input-1);
+ \draw[thick,red](r3-2-output-1)--(r4-1-input-2);
+ \draw[thick,red](r3-2-output-2)--(r4-2-input-2);
+ \end{pgfonlayer}
+ \end{tikzpicture}
+}
+\end{center}
+\begin{itemize}
+\item if the start module $st$ and the output port are odd (i.e. module 1, port 1), then it will be connected to
+\[\textrm{end module}=\dfrac{st+1}{2} \; , \; \textrm{port}=1 \]
+\item if the start module $st$ is odd and the output port is even (i.e. module 1, port 2), then it will be connected to
+\[\textrm{end module}=\dfrac{st+1+\gamma}{2} \; , \; \textrm{port}=1 \]
+\item if the start module $st$ is even and the output port is odd (i.e. module 2, port 1), then it will be connected to
+\[\textrm{end module}=\dfrac{st}{2} \; , \; \textrm{port}=2 \]
+\item if the start module $st$ and the output port are even (i.e. module 2, port 2), then it will be connected to
+\[\textrm{end module}=\dfrac{st+\gamma}{2}\; , \; \textrm{port}=2 \]
+\end{itemize}
+
+What is the term $\gamma$? It is a corrective term that depends on the starting stage. Consider indeed the connections of the output port 2 of the module 1 for the first and the second starting stages:
+\begin{flushleft}
+\texttt{r1-1-output-2} \tikz[baseline=-0.5ex]\draw[-stealth](0,0)--(0.5,0); \texttt{r2-5-input-1}\\
+\texttt{r2-1-output-2} \tikz[baseline=-0.5ex]\draw[-stealth](0,0)--(0.5,0); \texttt{r3-3-input-1}
+\end{flushleft}
+In the first case it points to module 5 while in the second case to module 3, thus in the first case $\gamma=8$ and in the second case $\gamma=4$. This suggest that $\gamma$ is related in some sense to the stage of the start module: in the example |P|=16 so the relation is
+\[\gamma=\dfrac{P}{2^{stage}}\]
+
+Following this strategy, however, allows to draw just part of the connections:
+\begin{center}
+\scalebox{0.75}{
+ \begin{tikzpicture}[module size=0.75cm, module ysep=1, module xsep=3.5, connections disabled=true]
+ \node[P=16, benes complete]{};
+ \foreach \stg in {2,...,6}{
+ \foreach \module in {1,...,8}{
+ \node[right,font=\scriptsize] at (r\stg-\module-output-1) {1};
+ \node[right,font=\scriptsize] at (r\stg-\module-output-2) {2};
+ \node[left,font=\scriptsize] at (r\stg-\module-input-1) {1};
+ \node[left,font=\scriptsize] at (r\stg-\module-input-2) {2};
+ }
+ }
+ \foreach \module in {1,...,8}{
+ \node[right,font=\scriptsize] at (r1-\module-output-1) {1};
+ \node[right,font=\scriptsize] at (r1-\module-output-2) {2};
+ }
+ \foreach \module in {1,...,8}{
+ \node[left,font=\scriptsize] at (r7-\module-input-1) {1};
+ \node[left,font=\scriptsize] at (r7-\module-input-2) {2};
+ }
+ % some connections
+ \begin{pgfonlayer}{background}
+ \foreach \stg[evaluate=\stg as \nextstg using int(\stg+1)] in {1,...,3}{
+ \pgfmathtruncatemacro\applicationon{16/(2^\stg)}% number of modules over which the algorithm is applied
+ \foreach \startmodule in {1,...,\applicationon}{
+ \pgfmathisodd{\startmodule}{initmodule}
+ \ifnum\initmodule=1
+ % if odd
+ \pgfmathtruncatemacro\endmodulei{int((\startmodule+1)/2)}
+ \pgfmathtruncatemacro\endmoduleii{int(ceil(\startmodule+1+\applicationon)/2)}
+ \draw[red](r\stg-\startmodule-output-1)--(r\nextstg-\endmodulei-input-1);
+ \draw[red](r\stg-\startmodule-output-2)--(r\nextstg-\endmoduleii-input-1);
+ \else
+ % if even
+ \pgfmathtruncatemacro\endmodulei{int((\startmodule)/2)}
+ \pgfmathtruncatemacro\endmoduleii{int((\startmodule+\applicationon)/2)}
+ \draw[red](r\stg-\startmodule-output-1)--(r\nextstg-\endmodulei-input-2);
+ \draw[red](r\stg-\startmodule-output-2)--(r\nextstg-\endmoduleii-input-2);
+ \fi
+ }
+ }
+ \end{pgfonlayer}
+ \end{tikzpicture}
+}
+\end{center}
+thus it is possible to claim that the algorithm has a \emph{module applicability range} that ultimately depends on the stage:
+\begin{itemize}
+\item in the first stage it could be applied for all modules;
+\item in the second stage it could be applied for half of the modules;
+\item in the third stage it could be applied just for two modules.
+\end{itemize}
+But, in the first stage $\gamma=8$ ($P/2^1$), in the second stage $\gamma=4$ ($P/2^2$) and in the third stage $\gamma=2$ ($P/2^3$): this means that $\gamma$ defines the \emph{module applicability range}.
+
+Notice now, that actually for the second stage and the third stage, the algorithm should be simply repeated:
+\begin{itemize}
+\item in the second stage 2 times;
+\item in the third stage 4 times.
+\end{itemize}
+The repetition $\psi$ depends on the stage with this relation:
+\[\psi= 2^{stage-1}\]
+Now, to draw automatically all the connections, the algorithm should know which are the starting module and ending module of the \emph{module applicability range} during the repetitions: for example, in the second stage, how to identify automatically the applicability range \texttt{1-4}, \texttt{5-8}?
+\pagebreak
+
+They could be defined as:
+\begin{itemize}
+\item starting module: $st_m=1+(\psi-1)\cdot\gamma $;
+\item ending module: $end_m=(st_m+\gamma)-1$.
+\end{itemize}
+Indeed for the second stage we have that $\gamma=4$ and $\psi=2\implies \{1,\, 2\}$, thus there are two starting and ending modules:
+\begin{itemize}
+\item starting modules: $st_{m_1}=1+(1-1)\cdot 4=1$ and $st_{m_2}=1+(2-1)\cdot 4=5$;
+\item ending modules: $end_{m_1}=(1+4)-1=4$ and $end_{m_2}=(5+4)-1=8$.
+\end{itemize}
+Unfortunately, the knowledge of the starting and ending modules per stage is not sufficient to reach the goal: this because the algorithm works and draws the connections perfectly when the module labels start with 1, but during the repetitions the new starting module labels are different, so the computation of the end connection point fails. This difference should be compensated with \emph{shifts} of the ending modules that depend on the level of repetition. The rules are:
+\begin{itemize}
+\item if $\psi=1$ (the algorithm works for all modules of the stage), then the ending module of the connection is computed as:
+\begin{itemize}
+\item if the start module $st$ and the output port are odd (i.e. module 1, port 1), then it will be connected to
+\[\textrm{end module}=\dfrac{st+1}{2} \; , \; \textrm{port}=1 \]
+\item if the start module $st$ is odd and the output port is even (i.e. module 1, port 2), then it will be connected to
+\[\textrm{end module}=\dfrac{st+1+\gamma}{2}\; , \; \textrm{port}=1 \]
+\item if the start module $st$ is even and the output port is odd (i.e. module 2, port 1), then it will be connected to
+\[\textrm{end module}=\dfrac{st}{2} \; , \; \textrm{port}=2 \]
+\item if the start module $st$ and the output port are even (i.e. module 2, port 2), then it will be connected to
+\[\textrm{end module}=\dfrac{st+\gamma}{2}\; , \; \textrm{port}=2 \]
+\end{itemize}
+\item if $\psi=2$ (the algorithm should be repeated twice), then the ending module of the connection is computed as
+\begin{itemize}
+\item if the start module $st$ and the output port are odd (i.e. module 1, port 1), then it will be connected to
+\[\textrm{end module}=\dfrac{st+1}{2}+\dfrac{\gamma}{2} \; , \; \textrm{port}=1 \]
+\item if the start module $st$ is odd and the output port is even (i.e. module 1, port 2), then it will be connected to
+\[\textrm{end module}=\dfrac{st+1+\gamma}{2}+\dfrac{\gamma}{2}\; , \; \textrm{port}=1 \]
+\item if the start module $st$ is even and the output port is odd (i.e. module 2, port 1), then it will be connected to
+\[\textrm{end module}=\dfrac{st}{2}+\dfrac{\gamma}{2} \; , \; \textrm{port}=2 \]
+\item if the start module $st$ and the output port are even (i.e. module 2, port 2), then it will be connected to
+\[\textrm{end module}=\dfrac{st+\gamma}{2}+\dfrac{\gamma}{2}\; , \; \textrm{port}=2 \]
+\end{itemize}
+\item if $\psi>2\implies t=3,\ldots, \psi$ (the algorithm should be repeated more than twice), then the ending module of the connection is computed as:
+\begin{itemize}
+\item if the start module $st$ and the output port are odd (i.e. module 1, port 1), then it will be connected to
+\[\textrm{end module}=\dfrac{st+1}{2}+\left(\dfrac{\gamma}{2}\cdot (t-2)\right) \; , \; \textrm{port}=1 \]
+\item if the start module $st$ is odd and the output port is even (i.e. module 1, port 2), then it will be connected to
+\[\textrm{end module}=\dfrac{st+1+\gamma}{2}+\dfrac{\gamma}{2}+\left(\dfrac{\gamma}{2}\cdot (t-2)\right)\; , \; \textrm{port}=1 \]
+\item if the start module $st$ is even and the output port is odd (i.e. module 2, port 1), then it will be connected to
+\[\textrm{end module}=\dfrac{st}{2}+\left(\dfrac{\gamma}{2}\cdot (t-2)\right)\; , \; \textrm{port}=2 \]
+\item if the start module $st$ and the output port are even (i.e. module 2, port 2), then it will be connected to
+\[\textrm{end module}=\dfrac{st+\gamma}{2}+\dfrac{\gamma}{2}+\left(\dfrac{\gamma}{2}\cdot (t-2)\right)\; , \; \textrm{port}=2 \]
+\end{itemize}
+\end{itemize}
+Unfortunately, the rule $\psi>2$ when applied to the intermediate stages
+\[I_1=\lfloor\mathcal{S}\div 2\rfloor \hspace*{1cm} I_2=\mathcal{S}-(I_1-1)\]
+does not work; this implies that:
+\begin{itemize}
+\item on the left side of the network the applicability of the algorithm is from the starting stage 1 up to the starting stage $I_1-1$ (in the example |P|=16: from the starting stage 1 up to the starting stage 2);
+\item on the right side of the network the applicability of the algorithm is from the starting stage $\mathcal{S}$ up to the starting stage $I_2-1$ (in the example |P|=16: from the starting stage 7 up to the starting stage 6);
+\item for the intermediate starting stages $I_1$ and $I_2$ (in the example |P|=16: the stages 3 and 5) another rule should be used:
+\begin{itemize}
+\item if the start module $st$ and the output port are odd (i.e. module 1, port 1), then it will be connected to
+\[\textrm{end module}=st\; , \; \textrm{port}=1 \]
+\item if the start module $st$ is odd and the output port is even (i.e. module 1, port 2), then it will be connected to
+\[\textrm{end module}=st+1\; , \; \textrm{port}=1 \]
+\item if the start module $st$ is even and the output port is odd (i.e. module 2, port 1), then it will be connected to
+\[\textrm{end module}=st-1 \; , \; \textrm{port}=2 \]
+\item if the start module $st$ and the output port are even (i.e. module 2, port 2), then it will be connected to
+\[\textrm{end module}=st\; , \; \textrm{port}=2 \]
+\end{itemize}
+\end{itemize}
+
+To summarize, the algorithm to \textbf{d}raw \textbf{B}enes \textbf{n}etwork \textbf{c}onnections (dBnc) is reported in~\ref{algo_dBnc}: for the rules, please refer to the descriptions mentioned above.
+
+\begin{algorithm}
+compute $\mathcal{S}=2\log_2{P}-1$\;
+compute $I_1=\lfloor\mathcal{S}\div 2\rfloor$\;
+compute $I_2=\mathcal{S}-(I_1-1)$\;
+\emph{from left to right}\;
+\For{$stg\leftarrow 1$ \KwTo $(I_1-1)$}{
+ compute $\gamma=P\div 2^{stg}$\;
+ compute $\psi=2^{stg-1}$\;
+ \For{$t\leftarrow 1$ \KwTo $\psi$}{
+ compute starting point $x=1+((t-1)\cdot\gamma)$\;
+ compute ending point $y=(x+\gamma)-1$\;
+ \ForEach{$\textrm{ start module } s \textrm{ in set } (x,y)$}{
+ \uIf{$t==1$}{
+ \uIf{$s$ is odd}{
+ use rules $\psi=1$ for starting module odd\;
+ }
+ \Else{
+ use rules $\psi=1$ for starting module even\;
+ }
+ }
+ \uIf{$t==2$}{
+ \uIf{$s$ is odd}{
+ use rules $\psi=2$ for starting module odd\;
+ }
+ \Else{
+ use rules $\psi=2$ for starting module even\;
+ }
+ }
+ \uIf{$t>2$}{
+ \uIf{$s$ is odd}{
+ use rules $\psi>2$ for starting module odd\;
+ }
+ \Else{
+ use rules $\psi>2$ for starting module even\;
+ }
+ }
+ }
+ }
+}
+\emph{from right to left}\;
+\For{$stg\leftarrow \mathcal{S}$ \KwTo $(I_2-1)$}{
+ repeat in dual mode $\textbf{6}-\textbf{32}$\;
+}
+\emph{complete with intermediate stages}\;
+\ForEach{$stg$ in set $(I_1,\, I_2)$}{
+ use rules for intermediate stages\;
+}
+\caption{\textbf{d}raw \textbf{B}enes \textbf{n}etwork \textbf{c}onnections (dBnc)}\label{algo_dBnc}
+\end{algorithm}
+
+
+% * * * * * * * * * * * * * * * * * * * * * * * * * *
+% belongs to \usepackage{makeindex}
+\printindex
+\end{document}