diff options
author | Karl Berry <karl@freefriends.org> | 2008-06-19 00:11:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-06-19 00:11:53 +0000 |
commit | 6f59b746f74b7ec973b019cd61ed9bf344073fa8 (patch) | |
tree | e5426bbe3d19b724f9fffa16d68c5973c35e4b0d | |
parent | 89bae23c0f3eecdab79cf863ed1af87a05441a12 (diff) |
new package tikz-inet (18jun08)
git-svn-id: svn://tug.org/texlive/trunk@8860 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/tikz-inet/README | 7 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikz-inet/tikz-inet-doc.pdf | bin | 0 -> 136305 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/tikz-inet/tikz-inet-doc.tex | 343 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/tikz-inet/tikz-inet.sty | 401 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 3 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/tikz-inet.tlpsrc | 2 |
6 files changed, 755 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/tikz-inet/README b/Master/texmf-dist/doc/latex/tikz-inet/README new file mode 100644 index 00000000000..9969d5a3a2e --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikz-inet/README @@ -0,0 +1,7 @@ +Name of package: tkz-inet +Author's name: Marc de Falco + +The purpose of this package is to extend tikz with some macros in order to +draw interaction nets. + +License: LaTeX Projet Public License diff --git a/Master/texmf-dist/doc/latex/tikz-inet/tikz-inet-doc.pdf b/Master/texmf-dist/doc/latex/tikz-inet/tikz-inet-doc.pdf Binary files differnew file mode 100644 index 00000000000..ec185b9ce19 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikz-inet/tikz-inet-doc.pdf diff --git a/Master/texmf-dist/doc/latex/tikz-inet/tikz-inet-doc.tex b/Master/texmf-dist/doc/latex/tikz-inet/tikz-inet-doc.tex new file mode 100644 index 00000000000..9ee1a52db9f --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikz-inet/tikz-inet-doc.tex @@ -0,0 +1,343 @@ +% Copyright 2008 by Marc de Falco +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +\documentclass[10pt,a4paper]{article} +\usepackage[fancy,color=orange]{tikz-inet} +\usetikzlibrary{calc} +\usepackage{ifthen} + +\usepackage{fancyvrb} +\usepackage{a4wide} +\usepackage{pgffor} + +\newenvironment{outputverbat}{% + \VerbatimEnvironment\begin{VerbatimOut}{\jobname.tmp}} + {\end{VerbatimOut}} +\newcommand{\code}[1][0.5]{ + \fbox{ + \begin{minipage}{#1\textwidth} + \VerbatimInput[gobble=4,fontsize=\footnotesize]{\jobname.tmp} + \end{minipage} + } +} +\newcommand{\picturefancy} + {\begin{tikzpicture}\input{\jobname.tmp}\end{tikzpicture}} +\newcommand{\picturenofancy} + {\begin{tikzpicture}\inetnofancy\input{\jobname.tmp}% + \inetfancy\end{tikzpicture}} +\newenvironment{exampleH}{\VerbatimEnvironment\begin{outputverbat}} + {\end{outputverbat} + \begin{center} + \begin{tabular}{c|cc}\picturefancy & \picturenofancy & \code\end{tabular} + \end{center}} +\newenvironment{exampleHv}{\VerbatimEnvironment\begin{outputverbat}} + {\end{outputverbat} + \begin{center} + \begin{tabular}{c} + \begin{tabular}{r|l} + \picturefancy & \picturenofancy + \end{tabular} + \\ \hline \\ \code[1]\end{tabular} + \end{center}} +\newenvironment{exampleVv}{\VerbatimEnvironment\begin{outputverbat}} + {\end{outputverbat} + \begin{center} + \begin{tabular}{rl} + \begin{tabular}{c} + \picturefancy \\ \hline \\ \picturenofancy + \end{tabular} + & \code + \end{tabular} + \end{center}} + +\begin{document} + +\title{The package \textsf{tikz-inet}} +\author{Marc de Falco} +\maketitle + +\begin{abstract} + The purpose of this package is to extend tikz + with some simple macros in order to draw interaction + nets. +\end{abstract} + +\section*{Changelog} +\newcommand{\changeitem}[2]{\item \textbf{#1} \textit{#2}} +\begin{itemize} + \changeitem{0.1}{initial release} +\end{itemize} + +\section*{TODO} +\begin{itemize} + \item add support for proofnets +\end{itemize} + +\section{Installation} +Install this package in your ressource directory or the root of your +document directory. + +This package obviously needs tikz and pgf, but \textbf{this package needs +the version, at least, 2.0 of them}. + +\section{Usage} +\subsection{Loading the package} +The command to load the package is the usual + +\verb+\usepackage[<+\emph{options}\verb+>]{tikz-inet}+ + +where \emph{options} are a comma separated list of keys ranging in + +\begin{description} + \item[fancy] Select a fancier style suitable for talks but + likely to frighten referees + \item[color=] The global color used by the fancy style, must + be xcolor compliant color + \item[angle=] The default orientation of cells, in degrees (default to $0$, that is a cell pointing downward) +\end{description} + +\subsection{Cell nodes} +The cells are displayed using the internal node system of tikz. +A special shape \emph{cellule} is inherited from the tikz shape +isosceles triangle, thus sharing the original anchors. + +A macro is defined to encapsulate the node creation. + +\verb+\inetcell[+\emph{tikz display keys}\verb+](+\emph{node name}% +\verb+){+\emph{symbol}\verb+}[+\emph{angle}\verb+]+ + +Every parameter is optional but the symbol. + +\begin{description} + \item[symbol] The symbol of the cell, that is the text displayed + in the center of the cell. This text is not assumed to be + in math mode. + \item[node name] This is the name of the node that will be + used for referencing it or connecting wires. This name + default to the symbol, which is a convenient way to make simple + drawings, this can lead to some error as soon as the symbol + is not simple, like a math text. + \item[angle] The angle of the principal port of the cell, + defaults to $0$ which means that the cell has a downward + orientation with the principal port on the right. + + Special values $U,D,L$ and $R$ are defined for up, down, left and right + orientation of the cell. + \item[tikz display keys] This additional display keys are + appended to the one used by the package and given to the + node construction. As it is appended after, it can be used to + redefine all display options. + + A special key \verb+arity+ allows to define arity based anchors + for ports. This is not really useful in most cases as the + three predefined anchors are more likely to suit your need. +\end{description} + +When using this macro a lot of parameters are given to tikz, one of +them is the current cell display style. More on this can be found later. + +\subsubsection{Ports} +Some anchors are named in order to reflect ports of the cell: +\begin{description} + \item[pal] the apex of the triangle, where lies the principal port + \item[middle pax] an auxiliary port aligned with the principal port + \item[left pax, right pax] auxiliaries ports on each side of the opposite + edge of the apex + \item[pax $n$, $1 \le n \le arity$] numbered auxiliary ports associated + with the arity key. +\end{description} + +Each anchor has a sibling a bit off the cell, it allows nice curving when +branching wires. To get this special anchor, just add \verb+above+ to the +other ones: e.g. \verb+above middle pax+ + +\begin{center} +\begin{tikzpicture} + \LARGE + \inetcell(c){Cell symbol}[90] + \fill (c.pal) circle (2pt) + node[above]{\footnotesize pal}; + \fill (c.above pal) circle (2pt) + node[right]{\footnotesize above pal}; + \fill (c.left pax) circle (2pt) + node[above left]{\footnotesize left pax}; + \fill (c.above left pax) circle (2pt) + node[below left]{\footnotesize above left pax}; + \fill (c.middle pax) circle (2pt) + node[above left]{\footnotesize middle pax}; + \fill (c.above middle pax) circle (2pt) + node[below left]{\footnotesize above middle pax}; + \fill (c.right pax) circle (2pt) + node[below left]{\footnotesize right pax}; + \fill (c.above right pax) circle (2pt) + node[above left]{\footnotesize above right pax}; + \foreach \x in {1,...,4} { + \fill (c.pax \x) circle (2pt) + node[right]{\footnotesize pax \x}; + } +\end{tikzpicture} +\end{center} + +\subsection{Wires} +Wires macros help connecting ports by taking into account the current +wire display style and dealing implicitly with the \emph{above} anchors. +The wires are displayed on a layer below the main one, so cells are always +on top of layers. To change this you have to use \verb+\pgfsetlayers+. + +\verb+\inetwire[+\emph{tikz extra display keys}\verb+](cell1.port1)(cell2.port2)+ + +The arguments are self-explanatory: this wire will connect the port \verb+port1+ +of \verb+cell1+ with the port \verb+port2+ of \verb+cell2+. It uses the current +wire style. + +\verb+\inetloop[+\emph{tikz extra display keys}\verb+]+ + +draws a loop, that is a circle with the current wire style + +\verb+\inetwirecoords[+\emph{tikz extra display keys}\verb+](A)(B)+ + +draws a wire from node A to node B with the current wire style. It's useful +to add extra wires non linking cell ports while using the current wire style. + +\verb+\inetwirefree[+\emph{tikz extra display keys}\verb+](cell.port)+ + +draws a wire from \verb+port+ of \verb+cell+ to \verb+above port+ +of the same cell, with +the current wire style. It allows fast declaration of free ports. + +\subsection{Boxes} +Boxes uses the current box style when being displayed, they lie on a +layer below the wire layer. + +\verb+\inetbox[+\emph{tikz extra display keys}\verb+]{+\emph{space +separated list of cells in the box}\verb+}(+\emph{box node name}+\verb+)+ +display a box containing the given cells + +\verb+\inetprombox[+\emph{tikz extra display keys}\verb+]{+\emph{space +separated list of cells in the box}\verb+}(+\emph{promotion cell +node name}+\verb+)+: display a box and add a promotion cell below it, +the name of the box is \verb+bname+ where \verb+name+ is the name +of the promotion cell. + + + +\subsection{Other macros} +\verb+\inetnofancy+, \verb+inetfancy+: hotswap the current display style + +\verb+\inetcellstyle+,\verb+\inetwirestyle+,\verb+\inetboxstyle+: get +the currently used style for each type of drawing. \textbf{Don't renew this +command to define your own style!} + +\verb+\inetcolor+: the current color for the fancy style, also passed +as an argument of the non fancy style. + +If you want to call a style you have to give an argument, unless you have +redefined the fancy styles to not use it. For a cell like element you have +to give the key \verb+\inetcellstyle=\inetcolor+. + +\subsubsection{Tikz styles} +This package define six styles : +\begin{itemize} + \item \emph{cellstyle} and \emph{fancycellstyle} + \item \emph{wirestyle} and \emph{fancywirestyle} + \item \emph{boxstyle} and \emph{fancyboxstyle} +\end{itemize} +You can redefine this styles as for any other tikz styles with the +command: + +\verb+\tikzset{+\emph{the style name}\verb+/.style={+\emph{tikz display keys}\verb+}}+ + +\section{Examples} +\subsection{Basic} + All examples are shown with the \textsf{fancy} key on the left. + + \begin{exampleH} + \inetcell{A} + \end{exampleH} + + \begin{exampleVv} + \matrix[row sep=0.5cm]{ + \inetcell{A} & & \inetcell{B} \\ + & \inetcell{C} & \\ + }; + \inetwirefree(A.middle pax) + \inetwirefree(B.middle pax) + \inetwirefree(C.pal) + \inetwire(A.pal)(C.right pax) + \inetwire(B.pal)(C.left pax) + \inetbox{(A) (B)}(b) + \end{exampleVv} + +\subsection{Style variations} + + \begin{exampleVv} + \matrix{ + \inetcell{A} & + \inetcell[fancycellstyle=green]{B} \\ + \inetcell[bottom color=green]{C} & + \inetcell[draw=black]{D} \\ + \inetcell[very thick]{E} & + \inetnofancy \inetcell{F} \inetfancy \\ + }; + \end{exampleVv} + +\subsection{Special cases} + \begin{exampleVv} + \inetcell{A} + \inetprombox{(A)}(pa) + \inetcell[at=(bpa.east),right=5pt]{B} + \inetwire(B.middle pax)(A.middle pax) + \inetprombox{(bpa)(pa)(B)}(p) + \inetwire(A.pal)(pa.middle pax) + \inetwirefree(pa.pal) + \inetwirefree(p.pal) + \inetwire(B.pal)(p.middle pax) + \end{exampleVv} + + \begin{exampleVv} + \newcount\angle + \foreach \x in {1,...,12} { + \pgfmathsetcount{\angle}{360*\x/12+90} + \inetcell[\inetcellstyle=green!\x0, + at=(\the\angle-90:1.5cm)] + (c\x){A}[\angle] + } + \end{exampleVv} + + \begin{exampleHv} + \newcount\angle + \newcount\order + \order=10 + \newcount\arity + \pgfmathsetcount{\arity}{\order-1} + \foreach \x in {1,...,\order} { + \foreach \y/\symbol in {0/!,1/?} { + \pgfmathsetcount{\angle} + {(180*(2*\x+\y))/\order+90} + \inetcell[at=(\the\angle-90:\the\order*1.8ex), + arity=\order-1](c\y\x){\symbol}[\angle] + \inetwirefree(c\y\x.pal) + } + } + + \newcount\nextcell + \newcount\nextport + \newcount\depth + \foreach \x in {1,...,\order} { + \foreach \y in {1,...,\arity} { + \pgfmathsetcount{\nextcell} + {mod(\x+\y-1,\order)+1} + \pgfmathsetcount{\nextport} + {\arity-\y+1} + \pgfmathsetcount{\depth}{(\x-1)*100/\order} + \inetwire[\inetwirestyle=\inetcolor!\the\depth!black]% + (c0\x.pax \y)(c1\the\nextcell.pax \the\nextport) + } + } + \end{exampleHv} + +\end{document} diff --git a/Master/texmf-dist/tex/latex/tikz-inet/tikz-inet.sty b/Master/texmf-dist/tex/latex/tikz-inet/tikz-inet.sty new file mode 100644 index 00000000000..69a54dd7217 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikz-inet/tikz-inet.sty @@ -0,0 +1,401 @@ +% Copyright 2008 by Marc de Falco +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{tikz-inet}[2008/06/02 v0.1 tikz interaction nets library] +\RequirePackage{tikz} +\RequirePackage{ifthen} + +% We need this to load the \emph{isosceles triangle} shape +\usetikzlibrary{shapes.geometric} +\usetikzlibrary{shadows} +\usetikzlibrary{positioning} +\usetikzlibrary{matrix} +\usetikzlibrary{fit} + +\pgfkeys{/pgf/.cd, + arity/.initial=4, +} + +% The definition of the shape of a cell +\pgfdeclareshape{cellule}{ + \savedmacro\arity{% + \pgfmathtruncatemacro\arity{\pgfkeysvalueof{/pgf/arity}}% + } + + \inheritsavedanchors[from=isosceles triangle] + \inheritanchorborder[from=isosceles triangle] + \inheritanchor[from=isosceles triangle]{center} + \inheritanchor[from=isosceles triangle]{left corner} + \inheritanchor[from=isosceles triangle]{right corner} + \inheritanchor[from=isosceles triangle]{south} + \inheritanchor[from=isosceles triangle]{west} + \inheritanchor[from=isosceles triangle]{north east} + \inheritanchor[from=isosceles triangle]{north west} + \inheritanchor[from=isosceles triangle]{south east} + \inheritanchor[from=isosceles triangle]{south west} + \inheritanchor[from=isosceles triangle]{east} + \inheritanchor[from=isosceles triangle]{north} + \inheritanchor[from=isosceles triangle]{lower left} + \inheritanchor[from=isosceles triangle]{apex} + + \anchor{above pax}{ + \trianglepoints + \pgfmathrotatepointaround{ + \pgfpointadd{ + \pgfpointadd{\pgfpoint{-2ex}{0cm}}{ + \pgfpointlineattime{0.5} + {\lowerleftanchor}{\lowerrightanchor} + } + } + {\centerpoint} + }{\centerpoint}{\rotate} + } + + + \anchor{above middle pax}{ + \trianglepoints + \pgfmathrotatepointaround{ + \pgfpointadd{ + \pgfpointadd{\pgfpoint{-2ex}{0cm}}{ + \pgfpointlineattime{0.5} + {\lowerleftanchor}{\lowerrightanchor} + } + } + {\centerpoint} + }{\centerpoint}{\rotate} + } + + \anchor{pax}{ + \trianglepoints + \pgfmathrotatepointaround{ + \pgfpointadd{\pgfpointlineattime{0.5} + {\lowerleftanchor}{\lowerrightanchor}}{\centerpoint}} + {\centerpoint}{\rotate} + } + + + \anchor{middle pax}{ + \trianglepoints + \pgfmathrotatepointaround{ + \pgfpointadd{\pgfpointlineattime{0.5} + {\lowerleftanchor}{\lowerrightanchor}}{\centerpoint}} + {\centerpoint}{\rotate} + } + + \anchor{above left pax}{ + \trianglepoints + \pgfmathrotatepointaround{ + \pgfpointadd{ + \pgfpointadd{\pgfpoint{-2ex}{0cm}}{ + \pgfpointlineattime{0.25} + {\lowerleftanchor}{\lowerrightanchor} + } + } + {\centerpoint} + }{\centerpoint}{\rotate} + } + + + \anchor{left pax}{ + \trianglepoints + \pgfmathrotatepointaround{ + \pgfpointadd{\pgfpointlineattime{0.25} + {\lowerleftanchor}{\lowerrightanchor}}{\centerpoint}} + {\centerpoint}{\rotate} + } + + \anchor{above right pax}{ + \trianglepoints + \pgfmathrotatepointaround{ + \pgfpointadd{ + \pgfpointadd{\pgfpoint{-2ex}{0cm}}{ + \pgfpointlineattime{0.75} + {\lowerleftanchor}{\lowerrightanchor} + } + } + {\centerpoint} + }{\centerpoint}{\rotate} + } + + + \anchor{right pax}{ + \trianglepoints + \pgfmathrotatepointaround{ + \pgfpointadd{\pgfpointlineattime{0.75} + {\lowerleftanchor}{\lowerrightanchor}}{\centerpoint}} + {\centerpoint}{\rotate} + } + + \anchor{above pal}{ + \trianglepoints + \pgfpointadd{\centerpoint}{ + \pgfmathrotatepointaround{ + \pgfpointadd{\pgfpoint{2ex}{0cm}}{\apexanchor}} + {\pgfpointorigin}{\rotate} + } + } + + + \anchor{pal}{ + \trianglepoints + \pgfpointadd{\centerpoint}{ + \pgfmathrotatepointaround{ + \pgfpointadd{\pgfpoint{-0.07cm}{0cm}}{\apexanchor} + }{\pgfpointorigin}{\rotate} + } + } + + + \backgroundpath{ + \trianglepoints{ + \pgftransformshift{\centerpoint} + \pgftransformrotate{\rotate} + \pgfpathmoveto{\apex} + \pgfpathlineto{ + \pgfpointlineattime{0.8}{\apex}{\lowerleft} + } + \pgfpathcurveto{ + \pgfpointlineattime{0.9}{\apex}{\lowerleft} + }{ + \pgfpointlineattime{0.1}{\lowerleft}{\lowerleft\pgf@y-\pgf@y} + }{ + \pgfpointlineattime{0.2}{\lowerleft}{\lowerleft\pgf@y-\pgf@y} + } + \pgfpathlineto{ + \pgfpointlineattime{0.8}{\lowerleft}{\lowerleft\pgf@y-\pgf@y} + } + \pgfpathcurveto{ + \pgfpointlineattime{0.9}{\lowerleft}{\lowerleft\pgf@y-\pgf@y} + }{ + \pgfpointlineattime{0.1}{\lowerleft\pgf@y-\pgf@y}{\apex} + }{ + \pgfpointlineattime{0.2}{\lowerleft\pgf@y-\pgf@y}{\apex} + } + + \pgfpathclose + } + } + + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@cellule\endcsname{% + \c@pgf@counta\arity\relax% + \pgfmathloop% + \ifnum\c@pgf@counta>0\relax% + \pgfutil@ifundefined{pgf@anchor@cellule@pax\space\the\c@pgf@counta}{% + % I HATE TeX + \expandafter\xdef\csname pgf@anchor@cellule@pax\space\the\c@pgf@counta\endcsname{% + \noexpand\pgfmathadd@{\noexpand\arity}{-1}% + \noexpand\c@pgf@countb=\noexpand\pgfmathresult% + \noexpand\pgfmathadd@{\the\c@pgf@counta}{-1}% + \noexpand\pgfmathdivide@{\noexpand\pgfmathresult}% + {\noexpand\the\c@pgf@countb}% + \noexpand\pgfmathmultiply@{\noexpand\pgfmathresult}{0.5}% + \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{0.25}% + \noexpand\let\noexpand\time\noexpand\pgfmathresult% + \noexpand\trianglepoints% + \noexpand\pgfmathrotatepointaround{% + \noexpand\pgfpointadd{% + \noexpand\pgfpointlineattime% + {\noexpand\time}% + {\noexpand\lowerleftanchor}% + {\noexpand\lowerrightanchor}% + }{\noexpand\centerpoint}% + }{\noexpand\centerpoint}{\noexpand\rotate}% + }% + \expandafter\xdef\csname pgf@anchor@cellule@above pax\space\the\c@pgf@counta\endcsname{% + \noexpand\pgfmathadd@{\noexpand\arity}{-1}% + \noexpand\c@pgf@countb=\noexpand\pgfmathresult% + \noexpand\pgfmathadd@{\the\c@pgf@counta}{-1}% + \noexpand\pgfmathdivide@{\noexpand\pgfmathresult}% + {\noexpand\the\c@pgf@countb}% + \noexpand\pgfmathmultiply@{\noexpand\pgfmathresult}{0.5}% + \noexpand\pgfmathadd@{\noexpand\pgfmathresult}{0.25}% + \noexpand\let\noexpand\time\noexpand\pgfmathresult% + \noexpand\trianglepoints + \noexpand\pgfmathrotatepointaround{% + \noexpand\pgfpointadd{% + \noexpand\pgfpointadd{ + \noexpand\pgfpoint{-2ex}{0cm}}{% + \noexpand\pgfpointlineattime% + {\noexpand\time}% + {\noexpand\lowerleftanchor}% + {\noexpand\lowerrightanchor}% + }% + }{\noexpand\centerpoint}% + }% + {\noexpand\centerpoint}% + {\noexpand\rotate}% + }% + }{\c@pgf@counta0\relax}% + \advance\c@pgf@counta-1\relax% + \repeatpgfmathloop% + }% + +} + +\newcommand\inetoptions{\setkeys{inet}} +\newcommand{\inetcolor}{red} +\define@key{inet}{color}{\renewcommand{\inetcolor}{#1}} +\newcommand{\inet@defaultangle}{0} +\define@key{inet}{defaultangle}{\renewcommand{\inet@defaultangle}{#1}} + +\newcount\inet@angle +\inet@angle=0 + +\tikzset{wirestyle/.style = {draw, line width=0.15ex, line cap=rect}} +\tikzset{cellstyle/.style = { + draw, line width=0.2ex, fill=white, + inner sep=0.2ex, + }} +\tikzset{boxstyle/.style = {draw,line width=0.1ex}} +\tikzfading[name=inet fading, + left color=transparent!0, + right color=transparent!100] +\tikzset{fancywirestyle/.style = {draw, line width=0.15ex, + draw=black!50!#1, + double=white!50!#1,double distance=0.2ex, + }} +\tikzset{fancycellstyle/.style={% + general shadow={fill, shadow scale=1.0,% + shadow xshift=0.3ex,shadow yshift=-0.3ex,opacity=0.2}, + line width=0.15ex,% + inner sep=0.2ex,% + draw=black!50!#1,% + top color=#1,% + bottom color=white,%!80!#1,% + shading angle=\inet@angle,% + }} +\tikzset{fancyboxstyle/.style = {line width=0.2ex,fill opacity=0.5, + fill=white!20!#1,draw=black!30!#1}} + +\newif\ifinet@fancy\inet@fancyfalse + +\DeclareOption{fancy}{\inet@fancytrue} +\DeclareOption{nofancy}{\inet@fancyfalse} + +\newcommand{\inetfancy}{\inet@fancytrue} +\newcommand{\inetnofancy}{\inet@fancyfalse} + +\newcommand{\inetsetfancycellstyle}[1]{ + \tikzset{fancycellstyle/.style = {#1}}% +} +\newcommand{\inetsetfancywirestyle}[1]{ + \tikzset{fancycellstyle/.style = {#1}}% +} + +\DeclareOption*{\expandafter\inetoptions\expandafter{\CurrentOption}} +\ProcessOptions\relax + +\pgfdeclarelayer{wire layer} +\pgfdeclarelayer{box layer} +\pgfsetlayers{box layer,wire layer,main} + +\makeatletter + +\newcommand{\inetcellstyle}{% + \ifinet@fancy fancycellstyle\else cellstyle\fi% +} + +\newcommand{\inetwirestyle}{% + \ifinet@fancy fancywirestyle\else wirestyle\fi% +} + +\newcommand{\inetboxstyle}{% + \ifinet@fancy fancyboxstyle\else boxstyle\fi% +} + + +\newcommand{\inetcell}[1][]{% + \@ifnextchar({% + \inetcell@ii[#1]% + }{% + \inetcell@iib[#1]% + }% +} + +\def\inetcell@iib[#1]#2{% + \inetcell@ii[#1](#2){#2}% +} + +\def\inetcell@ii[#1](#2)#3{% + \@ifnextchar[{\inetcell@iii[#1](#2){#3}% + }{\inetcell@iii[#1](#2){#3}[\inet@defaultangle]}% +} + +\def\inetcell@iii[#1](#2)#3[#4]{% + \ifthenelse{\equal{#4}{U}}{\inet@angle=180}{% + \ifthenelse{\equal{#4}{D}}{\inet@angle=0}{% + \ifthenelse{\equal{#4}{L}}{\inet@angle=270}{% + \ifthenelse{\equal{#4}{R}}{\inet@angle=90}{\inet@angle=#4}% + }% + }% + }% + \node[% + \inetcellstyle=\inetcolor% + ,shape border rotate=\inet@angle-90% + ,cellule, isosceles triangle apex angle=60,% + shape border uses incircle, #1] (#2) {#3};% +} + +\def\inetwirecoords(#1)(#2){% + \begin{pgfonlayer}{wire layer}% + \draw[\ifinet@fancy fancywirestyle\else wirestyle\fi=\inetcolor]% + (#1) -- (#2);% + \end{pgfonlayer} +} + +\def\inetwire{% + \@ifnextchar[{\inetwire@i}{\inetwire@i[]}% +} + +\def\inetwire@i[#1](#2.#3)(#4.#5){% + \begin{pgfonlayer}{wire layer}% + \draw[\inetwirestyle=\inetcolor,#1]% + (#2.#3) .. controls (#2.above #3) and (#4.above #5) .. (#4.#5);% + \end{pgfonlayer}% +} + +\def\inetwirefree{% + \@ifnextchar[{\inetwirefree@i}{\inetwirefree@i[]}% +} +\def\inetwirefree@i[#1](#2.#3){% + \begin{pgfonlayer}{wire layer}% + \draw[\ifinet@fancy fancywirestyle\else wirestyle\fi=\inetcolor,#1]% + (#2.#3) -- (#2.above #3);% + \end{pgfonlayer}% +} + +\newcommand{\inetloop}[1][]{% + \begin{pgfonlayer}{wire layer}% + \node[\ifinet@fancy fancywirestyle\else wirestyle\fi=\inetcolor,% + #1,circle,inner sep=6pt] {}; + \end{pgfonlayer}% +} + +\newcommand{\inetbox}[1][]{% + \inetbox@i[#1]% +} + +\def\inetbox@i[#1]#2(#3){% + \begin{pgfonlayer}{box layer}% + \node[\ifinet@fancy fancyboxstyle\else boxstyle\fi=\inetcolor, + fit=#2,inner sep=10pt,#1] (#3) {};% + \end{pgfonlayer}% +} + +\newcommand{\inetprombox}[1][]{% + \inetprombox@i[#1]% +} +\def\inetprombox@i[#1]#2(#3){% + \inetbox@i[#1]{#2}(b#3)% + \inetcell[above=-4ex of b#3.south](#3){$!$}% + %\inetcell[above=-4ex of $(b#3.south west)!.75!(b#3.south)$](#3){$!$}% +} + +\makeatother + +\endinput diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 2d3e06e27f7..ef7034261eb 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -187,7 +187,8 @@ my @WorkingTLP = qw( texpower texshade textcase textfit textopo textpath textpos theoremref thesis-titlepage-fhac - thinsp thmtools thumb thumbpdf thuthesis ticket titlefoot titlesec + thinsp thmtools thumb thumbpdf thuthesis ticket tikz-inet + titlefoot titlesec titling tocbibind tocloft todo tokenizer toolbox tools toptesi totpages tracking trajan translator tree-dvips trfsigns trivfloat trsym diff --git a/Master/tlpkg/tlpsrc/tikz-inet.tlpsrc b/Master/tlpkg/tlpsrc/tikz-inet.tlpsrc new file mode 100644 index 00000000000..a212b2dac70 --- /dev/null +++ b/Master/tlpkg/tlpsrc/tikz-inet.tlpsrc @@ -0,0 +1,2 @@ +name tikz-inet +category Package |